One mesh or multiples for duplicated objects

my question is more for a general principle in the future for more high poly stuff, but for a specific instance:
I’ve read some posts that leave me equally confused.

I made an 8 foot fence line and duplicated it like 40 times in blender. (the reason is because I built the whole scene and house and exported whole hierarchies as FBX so it all fits together properly.
Imported into Unity I have 40 different meshes. fence fence.001 etc.
for all the ones facing the same direction I could basically reduce the mesh count to 4 instead of 40. .

From what I have read there are pros and cons on performance.
These are pretty low poly in blender. lets say 160 vertices per fence section.
In unity it says 476 vertices and 320 triangles at 22kb.
With texture and normal map, it looks like a real wood fence.

Should I just leave all the native meshes or… reuse just 1 for each section in the same direction.

If you are just looking at one portion, is unity drawing all the fences with the same mesh then, in which case you would be better off using different meshes…

I also have a bunch of landscape rocks which are about the same and I could do the same with many reducing the duplicate meshes.

I’m unsure on best practices here for optimal performance.
This game will be windows based, installed on PC.

or does none of this matter if they are all static.
Any suggestions or knowledge appreciate.

the more objects you have, the more drawcalls. shadows and per pixel lights will essentially multiply lightnumber * modelnumber that is affected by lights, so having one mesh of rocks combined down from 20 is a 20x savings. 20x isn’t fully accurate, as a bigger model will obviously take more rendering power than one small object, but it can help a good bit for objects that use the same material

there’s more to it, with the batchers and whatnot (srp has very good batching), but even if just to make the hierarchy smaller it would be an improvement on performance

Thanks, so taking that heirarchy thing further.

I could join all the static objects in one mesh in blender. even though they would be “separate” groups of vertices they would be one mesh. I never thought to do that. That seems less efficient to me as the entire thing would be rendered around the house even if I just saw 1 rock or piece of fence out a window?

the one thing I was thinking was just using the recurring mesh in each of the objects.

The other thing with joining in blender, there would only be one mesh for the entire fence, or all the boulders.

suggestion on best option

Modern GPUs are very clever at culling triangles that are hidden behind other triangles. Although the triangle culling process obviously still takes time and so occlusion culling game objects can still be beneficial. I’d suggest you do tests to help you decide… Every game world is different and your game may be better suited to merged meshes.

You can also lose out on the benefits of LODs when merging meshes.

2 Likes

a lot of games have very rudimentary culling and still get away with it, silent hill 2 for example loads the world in chunks around the player, and since the game is very graphically simple it makes little difference to performance. you also will more likely be bottlenecked at the cpu unless you’re one of those people that turns shadows on for every light + object at max resolution. modern gpus can handle a lot of vertices and memory/drawcalls is normally what limits you the most, with fillrate only really coming into play if you’re always drawing a giant object only for it to be covered or if you’re using a lot of overlapping transparent objects.

(though with srp batcher drawcalls are somewhat of a non-issue.)

billions of factors always means test it yourself for your case! always profile before making assumptions based on what is good in one game.

2 Likes