Shadow ray

When a ray bounces, a shadow ray is split off from the original ray. The shadow ray is a simpler ray that always bounce toward a random light source instead of taking the material into account.

If the ray can hit the light directly, we know that the spot we bounce from is directly lit by this light source. However, if we can’t connect directly to the light, we are in shadow from this light.

With enough shadow rays and the information about each light, we can learn how much light hit each spot in our scene.

So how can we use a shadow ray and what can we do with it in our material? Well, we can color our shadows.

https://s3-us-west-2.amazonaws.com/secure.notion-static.com/6fac6ab8-1a1f-432b-8f61-437bd44409a8/Untitled.png

To change the color of a shadow using the shadow rays, we use the transparent BSDF shader to tint or completely change the color of a shadow.

We can also use a texture with our transparent shader.

So how does this work? We can say that the light path node changes how an object look to its surrounding.

In our camera ray example, the cube looks blue to the camera ray. But to the floor, the cube looks green.

For our shadow ray the cube looks transparent and therefore contributes to the color of the shadow. If we set the transparent BSDF to white, the cube will be fully transparent to the shadow ray and therefore won’t cast a shadow.

You can also try to use a glass shader to see how the shadow change if the cube is viewed as glass by the shadow.

https://s3-us-west-2.amazonaws.com/secure.notion-static.com/d8085262-a500-404a-bf27-8ea684358d91/Untitled.png