Normal Direction Shader
Basic ShaderNormal Direction Shader
This shader colors an object based on the direction of its surface Normals. Surfaces whose Normals point towards the rendering ray take Color 1, the other surfaces take Color 2.
In the example above, the surface Normals for the middle ring were reversed so that they point to the rear. The Normal Direction shader was loaded into the alpha channel, with Color 2 defined as black. The middle ring will therefore be masked out of the outer and inner rings.
Note that it’s the other way round for the reflection, where only the middle ring is seen! This is because for reflections, rendering rays are sent out from the mirror into the scene. The middle ring’s surface Normals point towards these reflection rays, hence the middle ring is reflected, whereas the Normals for the inner and outer rings face away from the reflection rays and their surfaces are not reflected. A similar effect is created by the hard shadow (which is created using raytracing, whose sample rays run from the floor to the light source producing an inverted result) in the example on the left. Hard shadows as well as area shadows show a "false" result in this example. Only soft shadows (Shadow Maps) show a "correct" result. False and correct were placed in quotes because the shaders are technically correct but the effects shown here are most often not wanted.