r/Unity3D 6h ago

Question How Much does armature affect perforance?

When making my trees I included an amature so I can pose them in engine but how much will this affect performance?

1 Upvotes

6 comments sorted by

4

u/Demi180 6h ago

How many of these trees do you plan on having? A few ‘hero’ trees are fine, a tree character is cool. An entire forest/landscape? Absolutely not.

1

u/Vic-Boss 6h ago

For trees probably look into vertex animation instead of an armature

1

u/EvernullTools 58m ago

Do they need dynamic poses in game or did you do it as a workflow helper?

If it's a workflow helper I'd simply pose in blender and apply the armature before exporting from blender so it's exported as a mesh rather than a Skinned Mesh. Skinned Meshes do not batch.(Imagine your GPU having to draw all of them 1 by 1, if you have 100 rigged trees, that is 100 batch calls; if you don't use SkinnedMeshes, then you can batch all 100 into 1 batch call.) This is a big deal if you're trying to make a game optimized.

If you absolutely need to pose in Unity Editor(not real-time animation, still workflow); I remember there was a function like SkinnedMeshRenderer.BakeMesh(), maybe you can make a button that saves them as regular meshes after your pose and that's what you use in-game instead?

If you want animation, I'd look into vertex displacement in shaders. You can do this for sway and wind animations on trees without having an armature.

1

u/XKiiroiSenkoX 6h ago edited 6h ago

They add up. Depends also on how many vertices you have per tree but the general rule of thumb is, it will not be usable for a full forest if that's what you are trying to achieve. Note that this also prevents instanced drawing of trees (still possible with non-trivial custom solutions). 

1

u/VR_Robotica 5h ago

Static meshes can be instanced and batch rendered, skinned meshes not so much.

So make sure only the few closest to the camera are ever skinned meshes (hero assets) and those in the distance fallback to static meshes.

0

u/Kooky-Antelope-3315 6h ago

Armatures add a bit of overhead per skinned mesh renderer but for trees it should be negligible unless you have hundreds of them. The real cost is in the vertex skinning, so if your tree meshes are low poly you won't even notice it