Surfaces question

Blitz3D Forums/Blitz3D Programming/Surfaces question

AbbaRue(Posted 2004) [#1]
If I have say 3 different meshes, and each has 4 surfaces.
Can all 3 meshes share the same 4 surfaces.
Say I texture surface1 of mesh1. Could mesh2 and mesh3 also share that same surface, so mesh2's and mesh3's surface1 would also be textured with the same texture.

The method for my madness is, I could design a landscape, made of 100's of different meshes, but have those meshes share a few dozen surfaces.
Then texturing a surface of one mesh would texture the same surface on dozens of other meshes, so a few textures could be used to create an entire landscape.
Also sharing the same surfaces would save on rendering time, because there are so few surfaces to render.
This kind of system could be used to create a 3d tiled landscape, that renders fast, which is my ultimate goal!
That is if it works?


N(Posted 2004) [#2]
I don't believe you can have them share the same surface.. I may be wrong, though. The reason I think this is because one mesh has one or more surfaces which contain the triangles/vertices. So, each mesh would require a new surface to store the triangles/vertices in unless the new mesh was appended to the old mesh.


Jeremy Alessi(Posted 2004) [#3]

unless the new mesh was appened to the old mesh



You can combine the meshes into one object like that. But it is true that each mesh has 1 or more surfaces otherwise. Still though you can have many entities which share the same mesh. If you use CopyMesh() it speeds things up dramatically by using one mesh for many entities.

I had a prototype of a RTS game which sped up many times with 100 entities (which used the same mesh) by copying the first mesh to all the other entites instead of loading a new mesh for each one. This way all 100 shared the same mesh and surfaces.

It is smart to strike a balance by grouping some meshes in larger groups to form one large mesh, copying meshes when you need them separate, and laying things out logically so things get culled properly.

It is a mistake to worry only about surface count and use one mesh which will not cull any polygons out of a scene. Just find that balance and you'll be fine. I'd imagine a 3D tiled landscape is doable by copying certain instances. Sswift made a landscape lib already and it's much quicker than Blitz terrains. I'm not sure exactly what method he used.