Table Of Contents
Introduction
Sometimes you might want your material to shade differently when intersected by specific ray types, or whether it is seen front-facing or back-facing. Differentiating between front and back faces is important for representing very thin 'double sided' materials such as paper, or decals on glass, without having to model the actual thickness with different materials for each side.
Enabling different shading for specific ray types can be useful for special effects such as boosting GI color bleeding, reducing rough reflection noise, or simply hand optimizing the material by reducing its shader graph complexity for specific ray types.
Redshift distinguishes between rays of the following types:
- Camera (i.e. primary rays)
- Reflection
- Refraction/Transparency
- GI
This shader node can be placed anywhere in the shader graph for a material at no extra cost.
Camera
This controls the basic properties of the shader. By default all ray types will just use the colors specified in the 'Camera' section, unless the specific ray type is enabled.
Enable Front/Back
This enables separate front/back face shading for camera primary rays.
Color
This is the default color as seen by camera primary rays, or when front-facing.
Back-Face Color
This is the color as seen by camera primary rays when back-facing.
|
|
|
Face normals for Ray Switch examples |
Camera Front Color: Grey Camera Back Color: Disabled |
Grey Red |
Reflection / Refraction / GI
Enable
This enables the ray switch type color.
Enable Front/Back
This enables separate front/back face shading for ray type.
Color
This is the default color as seen by the ray type, or when front-facing.
Back-face color
This is the color as seen by the ray type when back-facing.
|
|
|
Reflection Front Color: Disabled Reflection Back Color: Disabled |
Red Disabled |
Red Blue |
|
|
|
|
|
|
Refraction Front Color: Disabled Refraction Back Color: Disabled |
Green Disabled |
Green Yellow |
|
|
|
|
|
|
GI Front Color: Disabled GI Back Color: Disabled |
Green Disabled |
Green Pink |
Ray Switch Example
The following scene demonstrates a GI ray switch (left sphere), Reflection ray switch (middle sphere) and Camera Front/Back (right single-sided plane). A mirror has been placed in the scene to show this in action.
You can clearly see a different GI color (green) on the left sphere. In the mirror reflection you can see we are using a different texture for the middle sphere material when reflected. The front side of the right plane is blue and glossy, with the back side orange, which can be clearly seen in the reflection and GI.
The shader graph for the left sphere, with a green GI ray switch.
The shader graph for the middle sphere with a texture reflection ray switch.
The shader graph for the right plane with back-face camera ray switch.