Jump to content

[SOLVED] - 4 Max Bones Influences Limit


MackeyK24
 Share

Recommended Posts

1 hour ago, MackeyK24 said:

Are there any plans to increase the 4 max bone influence limit of BabylonJS Skeleton Animations ???

Well @MackeyK24: all ready done I believe.

Here is the Mixamo "Zed" character with an animation that I mentioned in your previous topic

Zed Animated

The mesh for that character, which has the "numBoneInfluencers" set to 6 when exported :

"meshes":[{"name":"polySurface6","id":"polySurface6","materialId":"zed1c.Casual_Male_Lod_1","billboardMode":0,"position":[0,0,0],"rotation":[0,0,0],"scaling:[1,1,1],

"isVisible":true,"freezeWorldMatrix":false,"isEnabled":true,"checkCollisions":false,

"receiveShadows":false,"skeletonId":0,"numBoneInfluencers":6

,"positions":[...

The limit was set in the Blender exporter - see image below.

cheers,gryff :)

numBones.png

Link to comment
Share on other sites

11 hours ago, JCPalmer said:

Seeing that you just made a PR related to default Max Bone influencers, you should mark this topic as solved.  I do not know much about the 3Ds Max exporter, but I know it too bumped the max to 8.

Well Looking thru the codebase ... I DONT see that there is specific MAX bone influencer count... I see it started out defaulted to 4 in AbstractMesh... If the mesh.numBoneInfluencers > 4 it uses some EXTRA bone technique ... But i don't see a MAX bone count like 6 or 8 for example.

Now i changed thee babylon entities PR to default the bone influencer count to 4 just like the codebase because what default to 0 before.

So i can't say for sure what the MAX bone influencer count for babylon should be... For example if i have to RE-BIND a skin to a mesh ... What max bone influencer should i be using... still 4... or should i increase that count???

Is there such a thing as an optimum bone influencer count???

Link to comment
Share on other sites

The optimum max is 1 (from a shader optimization standpoint).  That is not really viable in many cases.  This is something that I consider data dependent in the Blender exporter.  Like the screen snap gryff posted, the "max" max is defaulted to 8.  The exporter will determine the actual max, based on observation.  It also lists statistics of the number of vertices which are at that max.

You can lower that "max" max though.  An example is if the log file says something like:

num positions      :  4603
num normals        :  4603
num uvs            :  9206
num uvs2           :  0
num colors         :  0
num indices        :  2095
	Skeleton stats:  
	Total Influencers:  15810
	Avg # of influencers per vertex:  3.4347
	Highest # of influencers observed:  5, num vertices with this:  38
	exported as 5 influencers
	num skeletonWeights and skeletonIndices:  36824

You could be rewarded with reduced memory requirements by setting the "max" max to 4, and seeing if those 38 can get away only using 4.  The export process sorts the amounts of raw influences, and would drop the lowest for the 38.

I cannot say much about the 3DS Max process, but thought it does support 8, if you ask for it.

Link to comment
Share on other sites

To be clear, in WebGL - isn't there a max influence of 4 bones per vertex due to the size of the VertexBuffer Array? Otherwise. I believe currently that anything beyond a vec4 in the VertexBuffer will throw an exception - unless some major change has occurred, and I certainly didn't catch it. Make certain you know the restrictions of your renderer, and rig your chracters for the target platform. Otherwise, the exporter will exclude bones with the smallest influence once the buffer reaches the limit of 4 in WebGL and OpenGL - and your mesh will no longer behave as you designed and animated.

Also, comign from game development, we've always found the best performance all around to be 2 bones per vertex in most cases. I undertand that it is possible to increase the limit, but iI have found there is generally no benefit and will cause more porblems than solve them.

DB

Link to comment
Share on other sites

Well i think this is a NON issue IF USING UNITY EXPORTER.

Even though BabylonJS now supports EXTRA BONES (more than 4)... Unity is OPTIMIZED for a MAX of 4.... Unity --> Quality Settings -> BlendWeights can be 1, 2 or 4.

I think they limit to 4 for mainly performance... And since we actually use UNITY REPRESENTATION of geometry (not the FBX or modeling file itself)... That means all our vertices and normals and so forth come from a Unity.Mesh object... We get our Bone Weights from Unity.Mesh... So if unity is CULLING those bone weights INTERNALLY in their Unity.Mesh (which is what we actually build a Babylon Mesh From) down to 4 or 2 or 1... No matter...

So i set the BabylonMesh.numBoneInfluencers = Unity.QualitySettings.BlendWeights... Again MAXED OUT a 4...

I can deal with that... My new Reskin tool has be set to default to 4 Max Influencers to make it even easier to One-Click Reskin A Model :)

So to recap... AS far a the U3D - BabylonJS Toolkit works... we default to the Unity 4 Max Bone Influencers Value

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...