Swapped Arguments in Skinning_Compute


i’m on 3.2.0 and using the pbr lighting MatDefs. I had on jme 3.1.x a working instancing+skinned knight and now it is only showing the shadows. After comparing my lighting shader with pbr lighting i found no difference. But by inspecting the Skinning.glsllib i saw that the arguments in Skinning_Compute are pos, tan, normal. But in the provided shaders it is passed as pos, normal, tan. Sadly this not fixing my knights, but i wanted to inform you guys.

more concrete:
PBRLighting.vert#45 must be Skinning_Compute(modelSpacePos, modelSpaceTan, modelSpaceNorm);
Lighting.vert#95 must be Skinning_Compute(modelSpacePos, modelSpaceTan, modelSpaceNorm);

or in Skinning.glsllib#49 void Skinning_Compute(inout vec4 position, inout vec3 normal, inout vec3 tangent){

best regards.


Wow you’re right…
That’s a big bug…

Not sure why instancing + skinning doesn’t work though, could you provide a test case?

I fixed the tangent/normal arguments in the skinning lib


Hello nehon,

i will try to setup a simple test case.

But for the first setup, take an instance node and use a material where use_instancing is used.


Could it be that this change, Get normals and tangent synced with mikk tangent space. · jMonkeyEngine/jmonkeyengine@4abba9b · GitHub
is bringing a difference for usage of instancing? Do i have to use the TangentGenerator again?

edit, for some visual hints:

    Material MyMaterial : Common/MatDefs/Light/PBRLighting.j3md {
        MaterialParameters {
            NumberOfBones : 60
            BaseColorMap : Flip Repeat Textures/models/knight/Knight.png
            NormalMap : Flip Repeat Textures/models/knight/Knight_NRM.png
            PackedNormalParallax : true
            UseInstancing : true
            Metallic : 1.0
            Roughness : 0.01
        AdditionalRenderState {
          FaceCull Back


Spatial knightRef=...
InstancedNode knights = new InstancedNode("Knights");
BoundingBox box = ((BoundingBox) knightRef.getWorldBound());
int cellsPerRow = 3;
int half = cellsPerRow / 2;
int start = -half;
int end = start + cellsPerRow;
for (int z = start; z < end; z++) {
	for (int x = start; x < end; x++) {
		Spatial knight = knightRef.clone();
		knight.setLocalTranslation(box.getXExtent() * x, 0.0f, box.getZExtent() * z);