This page may include unlocalized contents


Ray Switch

Table Of Contents

 

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

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.

This enables separate front/back face shading for camera primary rays.


This is the default color as seen by camera primary rays, or when front-facing.


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

Enables reflection ray switching.


Enables separate front / back face shading for reflection rays.


The color seen by reflection rays when front-facing.


The color seen by reflection rays when back-facing.

Reflection Front Color: Disabled

Reflection Back Color: Disabled

Red

Disabled

Red

Blue


Refraction

Enables refraction ray switching.


Enables separate front / back face shading for refraction rays.


The color seen by refraction rays when front-facing.


The color seen by refraction rays when back-facing.

Refraction Front Color: Disabled

Refraction Back Color: Disabled

Green

Disabled

Green

Yellow


GI

Enables global illumination ray switching.


Enables separate front / back face shading for global illumination rays.


The color seen by global illumination rays when front-facing.


The color seen by global illumination rays when back-facing.

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.