- Home /
Performance of non deforming skinned mesh versus multiple mesh renderers (like robot or turret)?
Title says it all. Anyone have any experience comparing the two? Maximum 14 mesh or bones.
Answer by andrew-lukasik · May 22, 2021 at 09:20 AM
It's a simple question with no simple answer. Because it depends both on the specifics of your game, mesh and bone complexity, number of mesh variants, rendering backend in place and hardware you're targeting.
If by non-deforming skinned mesh
you mean no interpolations between vertex transformations, then it results in a slightly reduced workload PER VERTEX (so higher the vertex count the higher the saving is... as compared to fully deforming mesh).
Multiple mesh renderers
flattens number of vertex transformations and can potentially be beneficial but only IF there is an efficient batching mechanism in place (GPU instancing and number of variants is kept low or handles as per-instance data). Otherwise, if you have none of that, it will result in increased number of batches and no saving what's however.
Answer by Foulcloud · May 24, 2021 at 04:35 AM
Yes, these are great points which I was aware of but just being lazy on my end. However, I got off my lazy behind and did some actual benchmarking. Interesting results for my situation. I compared using two different articulated turrets. One was an optimized skinned mesh and the other was a multi mesh hierarchy. Both had the same joints and functions. Testing was done with 60 of these units visible and running on PC. All my animation is done through code (no animator on these objects).
Skinned mesh: 1 material, 1 skinned mesh renderer, around 8000 verts. No batching or gpu instance (will not work for skinned mesh).
Multi mesh: 3 materials, 7 mesh renderer, around 14000 verts. GPU instancing off, no batching happening. Around 25% better cpu load and framerate than the skinned mesh.
Multi mesh: same as above except with gpu instancing on. Around another 5% improvement in cpu load and framerate.
There are two caveats to this that may be due to me. The models were not the same - but the multi mesh was heavier as in more verts and more materials, otherwise very similar. The second thing is that I may be overlooking something I can turn off in the skinned mesh / rig in the modelling program. I did it from scratch though and pretty basic (that is all I am capable of ha!). Bones were parented to vert groups but no weight painting or any "deformations" present. I am a noob at Blender though so maybe there is something I need to turn off.
My tests over the years have always show a huge load for skinned mesh. This and physics (when used a lot) are usually my top two cpu suckers. So in summary, some objects like complex turrets, robots might be better suited to not using a skinned mesh.
I have some robots in my current project and contemplating moving these over. They do use animations and lots of complex humanoid type movements. Reading up, my plan is to keep the skinned mesh and animator but simply turn off the actual rendering. then I would just parent my individual mesh renderers to the bones. Kind of faking it but I have a feeling it could work well.
I've been in similar situation few years ago with mobile vr and your post mirrors my conclusions back then.
Btw. for shallow hierarchies (turret + static base, or similar) you may want to consider moving "look at"-type transformations etc. to a vertex shader ("look at" shader code example). You can encode bone id in (uint) uvw.w
component (from code) or (uint) floor( uv.x )
(easy to edit manually) and provide target position or direction in material property block per INSTANCE_ID
. With some coding this will generate basic skinning within a single draw call for N meshes.
Really cool. Once I wrap my head around my current challenges I will look into this. Also thanks for all the feedback. Unity community is great!
Very interesting results....thank for sharing.
I was just thinking about making an industrial machine model with lots of gears and was thinking of using a skinned mesh and bones to reduce it down to one draw call....now I'm wondering if it would be better to just use multiple mesh renderers instead...
Your answer
![](https://koobas.hobune.stream/wayback/20220613034035im_/https://answers.unity.com/themes/thub/images/avi.jpg)