I need to record the normal direction of faces on a mesh in object space. Is there a native maya shader that would capture this information in a render?
Thanks for looking
I need to record the normal direction of faces on a mesh in object space. Is there a native maya shader that would capture this information in a render?
Thanks for looking
Add comment viewed 536 times Latest activity 8 months ago
This should work:
It might not look right in the viewport, but when you render you should see that where the surface normal is facing the object's local X it will be red, local Y will be green, local Z will be blue. It will work where ever you put the camera or the object.
If you want the RGB aligned to XYZ world space, just plug the camera worldMatrix straight into the pointMatrixMult node.
The normals in negative XYZ will have negative RGB values, so you probably want to normalize the colors. You can make an expression:
surfaceShader1.outColorR = ((pointMatrixMult.outputX * 0.5) + 0.5);
and the same for green and blue...

Thats great Julian, thank you for taking the time with such a comprehensive answer, much appreciated
This is awesome Julian. But it doesn’t seem like Mental Ray knows what to do with this network. :(
Julian, I just tried to convert this to a file texture and the results weren’t correct. Any ideas why?