# Is there a way to render a pass that will color planes depending on a direction they facing?

I have this cube like head. Is there a way to quickly render a "mask" pass that will color all planes facing in the same direction to a same color?

For example, all planes facing forward - red. All planes facing top - green, etc.

I thought normal pass will do it, but it seems R B G channles of normal pass render only 1 side of a mesh, while other side remains black (in this particular image this measn G channel will be almost black, only exception is sphere eyes, because all white or 1 pixels will be on the other side of the head).

Normals are normalized vectors and their values can be negative. You can just shift them from (-1,1) to (0,1) for them to be visible as colors:

You can also do math or use something like mixed color ramps to separate specific angles:

the upper one gives that result but you can also add a material with custom colors to each surface which its better than adding a node setup imo.

• It doesn't have to be in material nodes, could be done with normal render pass, so nodes could possibly require very little effort. Commented Jan 25, 2019 at 21:53
• @MartinZ i think he wants more harder colors than those normal colors. Commented Jan 25, 2019 at 21:54
• The values are 32 bit floats even if they look like regular colors, so there is enough of accuracy to separate any angles with math or mixed color ramps of separated x,y,z normal vector components. It's just a mater of what is needed. Commented Jan 25, 2019 at 22:51
• hmmm yeah that could work for him anyways (what shows your other image). Commented Jan 25, 2019 at 23:39

You can use the Dot Product of the Normal vector and the facing vector you wish.

Vector math knowledge is really useful for this type on special materials.

• I do not see how this answers the question. Commented Jan 25, 2019 at 22:57