@microdee That’s all great stuff (seriously), but it’s the “closely tightened together” part I am reluctant to introduce as a dependency going forward. But it certainly has been very helpful and educational on this and other things, thank you!
@joreg Thanks for the example! It’s very similar to what I’ve pieced together as well. The problem I am having is I think with the normals, which was not included in your example. What I am seeing is that when I move/rotate the instances, the lighting moves with them; so directional lights are instance, not world, relative.
Here’s a snippet from the tekcor/microdee Instanced_Skinning example that made the above pic when its geometry output was sent into PhongDirectional:
float4 bldw = input.BlendWeight;
float4 bldi = input.BlendId+input.ii*BoneCount;
float4 pos = float4(0,0,0,1);
float4 ppos = float4(0,0,0,1);
float3 norm = 0;
for (int i = 0; i < 4; i++)
{
pos = pos + mul(float4(input.cpoint.xyz,1), SkinningMatrices[bldi[i]]) * bldw[i];
ppos = ppos + mul(float4(input.cpoint.xyz,1), PrevSkinningMatrices[bldi[i]]) * bldw[i];
norm = norm + (mul(float4(input.norm,1), SkinningMatrices[bldi[i]]) * bldw[i]).xyz;
}
output.cpoint = mul(float4(pos.xyz,1),iPreTr[input.ii % transformCount]);;
output.velocity = ppos;
output.norm = normalize(norm);
That norm line in the loop appears to have no effect; I can comment it out and just send the input normal to the output and it looks the same.
At first I thought this was a problem in the DX11 ports I was looking at, but actually it appears to be an issue in Mesh (EX9.Geometry Collada) as well, which uses the same formula.
Any ideas? Am I missing something? Thanks!