Ok, I need help on the weight shader. Not really sure what the correct fix is.

I get an error when you try to display the mesh in CPU Animation mode and then turn on the Weight Shader and the BoneMap Shader it will drop this error:


I know, that I have fixed this in the past but cant for the life of me remember how and will have to go look up some of my other shaders to figure it out but do not have time right this second. Ill fix it as soon as I can but was just wondering what others would suggest as an easy fix.

There’s probably a lot more information with the error than just this line?

That’s near impossible to find what’s going on with just this line.

One possible thing is that the shader is using a matricesIndices variable in the code, that has not been declared. Given the name of the variable, it would mean the attribute matricesIndices has not been declared in the vertex shader.

1 Like

Sounds like the shader is missing the attribute input declaration?

might want to add something along the lines of in vec4 matricesIndices where you’re declaring the rest of your attributes?

Yeah what @Evgeni_Popov said

1 Like

Was actually looking at my code of a shader that does the same think but works, the only thing I am missing is the specific attribute declaration to make sure that stuff is still there when it switches to CPU. I’ll test that when I get home and if I fixed it I’ll push.

Y’all can recreate it really easy, just go into a scene with a skeleton rigged to a mesh, go into the inspector and select the mesh toggle it to CPU mode then turn on the BoneWeights Shader.

I tried adding the attributes to the shader, but that did not seem to fix it… not sure why it works on the skeleton widget but not on this?

The matricesIndices and matricesWeights attributes are passed to the shader only when the bones are computed on the GPU (there’s no point to pass them otherwise).

So I guess the Display BoneWeights switch in the inspector should be disabled when Compute bones using shader is disabled.

I have a use case that needs it, we are working on real time weight painting and need the CPU version to work. Ive gotten it to work with the skeleton widget where we were able to make it selectable even with animations, but for some reason these ones are not doing the same thing with the same attributes. I’m just wondering what I did differently.

Are you sure you were using CPU skinning? With the existing code I don’t see how it can work because in CPU mode the indices/weights attributes are not passed to the shader.

I have made a PR to make it work in CPU mode too:


yeah for sure, that was the only way we could get picking to work on the widget that was deformed by a skeleton.

I can confirm that fix works @Evgeni_Popov you are am amazingly masterful programmer.

Oh yes!