Ever since roblox released skinned meshes, I’ve been having a lot of fun with them. Some of you may have seen my water demo showcased here and on the blog.
I absolutely love that roblox gave us this power, but it is currently far too limiting for one simple reason.
Bones that aren’t doing anything still incur a large performance penalty
Why
Why is this an issue you may ask? Well, for things like characters which most people are using skinned meshes for, it’s hardly one because you won’t have that many bones in your game.
However, a lot of devs I know, myself included, want to use skinned meshes for things that aren’t character related.
- Interactive water
- grass that bends/deforms with your character
- trees which wave in the wind when your camera is nearby.
All of these things are currently very hard if not impossible to optimize properly, or flat out impossible due the fact that bones/skinned meshes existing in the workplace alone incurs a hefty performance cost.
Proof/Details
I was working on a grass project when I noticed this, and realized something.
I was updating grass in chunks near your camera + viewing frustum, but having the meshes in the workspace even when they were thousands of studs away or not doing anything, still hurt performance.
-
having 50 of my many quad skinned meshes in workspace makes performUpdateCoordinateFrame take 1ms per frame
-
having 50 of the non-skinned version, uploaded using the exact same fbx, doesn’t cost anything
For a quick test, In studio, I just ran a script that duplicates a skinned mesh with 201 bones inside
performUpdateCoordinateFrame takes about 13ms, updateSkinningIslands about 2ms and updateDynamicParts about 12ms
updateDynamicParts can be lowered by cframing the skinned meshes further apart from each other, but it’s not great
basically, updateSkinningIslands seems to scale with number of bones and performUpdateCoordinateFrame seems to scale with bones and triangles/vertices
Whether or not they’re actually updating seems to change absolutely nothing
Solution
My proposed solution is a simple one, although I’m not sure how simple it is for roblox to implement.
I propose that we simply have a bool value property under a bone or skinned mesh, that acts as a flag for roblox’s skinned mesh update/render code, to skip any of the updates that are hurting performance.
It’s not the cleanest solution but it’s the only way I can think of to allow developers to further utilize this feature and power our imaginations, because currently we are far too limited in what we could use this otherwise incredibly powerful tool for.
Thanks!