0
$\begingroup$

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).enter image description here

$\endgroup$

3 Answers 3

1
$\begingroup$

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:

enter image description here

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

enter image description here

$\endgroup$
1
$\begingroup$

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.

$\endgroup$
4
  • $\begingroup$ It doesn't have to be in material nodes, could be done with normal render pass, so nodes could possibly require very little effort. $\endgroup$ Commented Jan 25, 2019 at 21:53
  • $\begingroup$ @MartinZ i think he wants more harder colors than those normal colors. $\endgroup$ Commented Jan 25, 2019 at 21:54
  • $\begingroup$ 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. $\endgroup$ Commented Jan 25, 2019 at 22:51
  • $\begingroup$ hmmm yeah that could work for him anyways (what shows your other image). $\endgroup$ Commented Jan 25, 2019 at 23:39
0
$\begingroup$

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.

Material Render using Dot Product

Material Node setup with Dot

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

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .