Performance Tests and Some Results.. what highway should I take?

Hi everyone!!

First of all let me contextualize: We are creating a 3d adventure game that is suposed to works in low specs computers running Windows 10, over browser/webgl. So, we are very very concerned about three aspects of performance:

  • size of my final bundles,
  • runtime memory consuption
  • speed (load time, fps, etc)

All our scenes must be full of color and life. So, our (kind of) forests must have a good diversification of species.

To achieve such condition we created a “tree” mesh and rigged it. This way we can have a lot of diferente representations of each specie just manipulating bones inside Unity. We created 9 copies of this rigged mesh but each one with a diferente UV map. Just one texture map (albedo and normal) was used to create a material that is applied to all 9 objects.

So, we have 9 prefabs that use the same single material, the same textures pair.
We create a tool to populate randomly a polygon área with these 9 prefabs and, after place it, we randomize the bones, so each tree is different of others.

After this stage we make use of a custom mesh combiner that bakes all skinnedmeshes in current position and combine everything in one single huge mesh.

I hope my explanation be satisfactory until here!

To verify if this approach is bringing us the very best performance we create a sequence of tests and took some print screens of profiler to compare the results.

An empty scene is our control and bring us the following numbers:

Our next test was populate the scene with our trees and let everything as is, I mean, we let them as skinned meshes. Results:

Next test: All skinned mesh was baked (material with instance enabled)

Finnaly we combined all meshes into a single, huge one:
ps.: this mesh, saved into a file, has 7MB

Looking fast at scene memory and draw calls, I would have no doubts: one single huge mesh is the way. BUT the size of the file is a problem… a tipical scene should have at least 4 of this kind of baked/combined mesh…

Ok. This is my context!

Thanks for Reading until here!

Which way seems to be the best one??

Regards,

Joao Reigota

bump

bump again…

wow… 9 days and nobody has a single word about the theme… :confused:

Hi @reigota – I’m no expert, but based on your stats agree that the single mesh seems the most optimal in terms of performance.

That said having the flexibility to keep things separate to reduce overall file size if streaming, might be preferred (I’m making assumptions here). So, if your performance is good enough and you can reduce the file sizes, perhaps that’s the way to go if it gives a better loading / waiting experience to players.

Edit:
Not sure if run-time mesh baking could be an option too, seems like it could be possible.

Thanks for you reply @WildStyle69 .
Yes, I could do it in runtime. I would get a small download but I think the process of baking the mesh is a bit memory consumming task… I will get a peak in of memory usage and this moment can raise an out of memory exception in low end devices. I am speculating, of course, but the chance exist and is not so small…