I have 2 skinnedMesh, use the same material. And one has 13 bones, another has 19 bones, then the allocateBones function will return 13 or 19, but not max(13, 19). It has led to some problem in Android.
I'm afraid your problem is somewhat unclear. Please invest more effort in this issue and demonstrate the problem with a live example. Alternatively, sharing a git repository with a reproduction test is also a good idea.
It has led to some problem in Android.
Please avoid using vague phrases like "some problems" or "not working". Try to formulate your post as concrete as possible. What problems do you see on Android? Any error messages or warnings?
I have 2 object, for example A and B.
A.skeleton=[bone1], B.skeleton=[bone1, bone2]
A.material = material1, B.material = material1
then if capabilities.floatVertexTextures is false, the allocateBones will return 1, and the shader on material1 will #define MAX_BONES 1
the allocateBones will return 1,
Please demonstrate this with a live example since I'm unable to reproduce. Because of the following line, the function should return 2 for the second skeleton:
sorry for my English.....
but the allocateBones won't execute twice, because of the same material.
this is a live example
https://jsfiddle.net/0h7ykj3p/
Okay, now I see what you mean. As a workaround, you have to apply a material per skinned mesh. Also try to avoid using the same bones in different skeletons.
I use FBX file from Maya, so it's hard to do that~
What happens if you convert the FBX file to glTF via:
I assume this issue here is a Won't fix because of several reasons:
setProgram() is complicated since the renderer would need the ability to match one material to multiple shader programs (we only support the other way around, see #15047)nVertexMatrices as maxBones value in allocateBones(). But as a result, the renderer might allocate too many resources depending on the use case.