Changing Normal Material Color

I am using MeshNormalMaterial for some shading. However, I want to be able to change the colors dynamically (e.g. when a user selects the mesh).

Is there any way to control the colors when using Normal Material?

Hi!
One option is to use hue shift:

The other options involve the using of modifications of shaders too, as there is no out-of-box functionality to achieve the thing you want.

1 Like

It’s actually not intended that users change the color of MeshNormalMaterial. It just maps normal vectors to RGB colors so it’s more or less a technical material for debugging or post-processing effects.

However, an extensions like the one from @prisoner849 should do the trick.

1 Like

@Mugen87 - Thanks for the confirmation, I thought as much, but didn’t know if there were some uniforms I could simply change.

@prisoner849 - Thanks for the suggestion. I think for my use case Ill have to make my own custom shader, but an interesting approach regardless, thankyou

1 Like

You could make a clone of the normal material model, give it a different look and feel, make it match the original in 3d space and then swap them when you mouseover or select.