Pryme8 Posted May 3, 2018 Share Posted May 3, 2018 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? Quote Link to comment Share on other sites More sharing options...
Guest Posted May 3, 2018 Share Posted May 3, 2018 So you can have a look here where all these info are provided: https://github.com/BabylonJS/Babylon.js/blob/master/materialsLibrary/src/simple/babylon.simpleMaterial.ts#L149 https://github.com/BabylonJS/Babylon.js/blob/master/materialsLibrary/src/simple/babylon.simpleMaterial.ts#L213 Quote Link to comment Share on other sites More sharing options...
Pryme8 Posted May 3, 2018 Author Share Posted May 3, 2018 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. Quote Link to comment Share on other sites More sharing options...
Guest Posted May 4, 2018 Share Posted May 4, 2018 Well this is weird Quote Link to comment Share on other sites More sharing options...
Pryme8 Posted May 4, 2018 Author Share Posted May 4, 2018 I think it has to do something with fallbacks, is why its working. I was gonna PM you about this, but I moved on and I feel like this is very specific. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.