Is your game better optimized if you re-use models?
I am new to game development. I don't know how to exactly ask this.
I want to make a city in my game. I would rather make every single house unique, but I am worried that it will affect optimization. Will my game be more optimized if I re-use the same models?
About this post
- Posted
- Archived
- Score
- 1 · 100% up
- Kind
- Text
- ID
- ny8m78
4 comments
Probably. It depends on your engine. Unity has a technique called GPU Instancing which is a significant optimization if you are rendering multiple copies of the same mesh. Other engines likely have something similar. You need to look at the details of your rendering stack to understand what opportunities there are for sharing geometry. In the end, optimization is going to depend on the details of your code and how you build your game.
It will take less space and use less RAM. If you use instance static meshes in ue4 it will count as a single draw call per mesh
Best idea would be to make one base mesh for a house, then have multiple little add-on meshes that you just place over top of the base mesh. The base mesh would be instanced multiple times so it only has to be loaded once, and the smaller add-ons would all be loaded.
As said - the best for performance do as UE4 does - create a level with different models, then "bake" it into one huge static mesh. Renderer will "cut" invisible parts of this mesh and draw only what in camera (UE4 does it on engine level, but it can be implemented with pure DX/GL code).
But "bake" will not work if you need to interact with doors, they must be separated objects.
Also each object must have Level of detail mesh - LOD0-1-2. When we close to house - engine use LOD0 with high poly model, when it far away - engine loads simplified model.
Sometimes they even use sprites to replace LODx but for me it looks ugly.