Is instancing meshes faster?

Blitz3D Forums/Blitz3D Programming/Is instancing meshes faster?

JoshK(Posted 2003) [#1]
Would it be faster to load a copy of a "static mesh" in a level, and then rotate and scale a copy of it for each static mesh that occurs in the map?

The new editor I am working on stores quaternion rotations, so this would actually work.


Rob(Posted 2003) [#2]
I can't see how it's faster. You save memory though I guess.


JaviCervera(Posted 2003) [#3]
And also have in mind that all the vertex info must be the same for all the instances, so lightmap (or vertex color data) will be the same for all static meshes, which is not good.


sswift(Posted 2003) [#4]
I'm not sure what you mean by "a copy", but that doesn't matter.


It would be better to use copyentity for each one if you can, versus copymesh. Copymesh would require additional video ram for each copy of the mesh, whereas CopyEntity does not.

The downside of using EntityCopy is that you can't have unique vertex colors on each copy. However, if you use lightmaps, you can still texture each with a different lightmap.

So if possible you should use EntityCopy. You'll quickly run out of ram with MeshCopy if you have a lot of meshes with a lot of polys.


JaviCervera(Posted 2003) [#5]
However, if you use lightmaps, you can still texture each with a different lightmap.
Extremely hard to do, because all the instances will have the same lightmap UV coordinates.


sswift(Posted 2003) [#6]
"Extremely hard to do, because all the instances will have the same lightmap UV coordinates."

You're mistaken.

Why is that hard to do? I can have 10 copies of the same level with the same UV coordinates each textured with a different lightmap with lights in different locations in the level.

Assuming no funny business with lightmap optimization is going on, then the'll all map to their lightmaps exactly the same regardless of how the lights are placed.

Unless of course you are assuming that I was suggesting to use a single lightmap texture for all entities with each being packed into a different part of the map. That is not what I was suggesting.


JaviCervera(Posted 2003) [#7]
Oh, in that case it is ok. Anyway, I prefer to not instance the static meshes and use vertex lighting in them, like Unreal2 does. Then instance all your game items, ammo, weapons, enemies, etc.