Jump to content

Bones Question


Pryme8
 Share

Recommended Posts

In the default material the line:
#include<bonesDeclaration>

Includes this:

 

#if NUM_BONE_INFLUENCERS > 0
	uniform mat4 mBones[BonesPerMesh];

	attribute vec4 matricesIndices;
	attribute vec4 matricesWeights;
	#if NUM_BONE_INFLUENCERS > 4
		attribute vec4 matricesIndicesExtra;
		attribute vec4 matricesWeightsExtra;
	#endif
#endif

Where does the value BonesPerMesh come from?
Where can I manually get the NUM_BONE_INFLUENCERS value from an imported mesh, so that in a custom shader I can set these values correctly.


Also when is the

finalWorld

variable defined in the process?
Link to comment
Share on other sites

I get 

"BJS - [15:32:16]: Error: ERROR: 0:143: 'finalWorld' : undeclared identifier
ERROR: 0:143: 'finalWorld' : undeclared identifier
ERROR: 0:143: 'assign' : l-value required (can't modify a const)
ERROR: 0:143: '=' : dimension mismatch
ERROR: 0:143: 'assign' : cannot convert from 'highp 4X4 matrix of float' to 'const highp float'"

When using:
 

#if NUM_BONE_INFLUENCERS > 0
    mat4 influence;
    influence = mBones[int(matricesIndices[0])] * matricesWeights[0];
 
    #if NUM_BONE_INFLUENCERS > 1
        influence += mBones[int(matricesIndices[1])] * matricesWeights[1];
    #endif  
    #if NUM_BONE_INFLUENCERS > 2
        influence += mBones[int(matricesIndices[2])] * matricesWeights[2];
    #endif  
    #if NUM_BONE_INFLUENCERS > 3
        influence += mBones[int(matricesIndices[3])] * matricesWeights[3];
    #endif  
 
    #if NUM_BONE_INFLUENCERS > 4
        influence += mBones[int(matricesIndicesExtra[0])] * matricesWeightsExtra[0];
    #endif  
    #if NUM_BONE_INFLUENCERS > 5
        influence += mBones[int(matricesIndicesExtra[1])] * matricesWeightsExtra[1];
    #endif  
    #if NUM_BONE_INFLUENCERS > 6
        influence += mBones[int(matricesIndicesExtra[2])] * matricesWeightsExtra[2];
    #endif  
    #if NUM_BONE_INFLUENCERS > 7
        influence += mBones[int(matricesIndicesExtra[3])] * matricesWeightsExtra[3];
    #endif  
 
    finalWorld = finalWorld * influence;
#endif

But the odd thing is it works o_O...  I am pretty confused on how this is possible.
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...