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