16
$\begingroup$

I have read the Blender documentation wikis on both the light path node and on light paths. But neither of them seems to clearly explain what a shadow ray is.

For instance, the light paths wiki says:

Shadow: the ray is used for (transparent) shadows

It then shows a diagram with the ray labeled “shadow” going (backwards) from a surface to a light source.

This doesn't make much sense to me. The text doesn't make sense because in cycles (as far as I know) a shadow is just an area with less light than the areas around it, which is not a technical value.

From the diagram, it looks like a shadow ray is a ray that is about to hit a light source (speaking from the actual backwards ray-tracing point of view). But I don't understand how that works either, how can cycles know what a ray is about to hit? Especially if that information could be used to change the direction of the ray.

So what is a shadow ray?

$\endgroup$
1
  • 3
    $\begingroup$ I like to think of it like this: Mixing an object's shader with a transparent shader, using the Diffuse ray as the mix factor, will make the object invisible to diffuse objects (or at least the diffuse rays from those objects). Using shadow ray instead diffuse ray will make the object invisible to lamps. $\endgroup$
    – gandalf3
    Commented Jan 20, 2015 at 21:59

1 Answer 1

20
$\begingroup$

A shadow ray is the last segment on the light path traveling through the scene (from camera to light source). It is just a technical term, only a label. In a nutshell it marks anything that goes to light.

When the light path begins, it starts as a camera ray, when it's reflected it becomes a reflection ray, when it goes through glass it becomes a transmission ray and from the last point to a lamp it is a shadow ray. These are the 4 base types of rays in cycles (they divide more into diffuse, glossy etc. also).

With Light Path node and Shadow rays, you can for example color shadows to some tint of your liking. Here the object will be transparent and blue for the shadow part of a path but opaque and green for the rest of it:

enter image description here

Note: In 2.75 rendering colored shadows from transparent objects is buggy - when adding Transparent BSDF in rendered viewport the shadow won't be colored - you need to restart the render-viewport (on CPU and GPU).

$\endgroup$
8
  • $\begingroup$ You have to be aware that the above does not apply to mesh lights (as of 2.75). You can only color shadows from lamps (eg. area lamp, sun lamp etc.) with your example. Please amend your answer to reflect that as it may be confusing to users who prefer mesh lights. $\endgroup$
    – jubi
    Commented Jun 28, 2015 at 11:36
  • $\begingroup$ @jubi 2.75 is not out yet, things might still change. In 2.75 RC2 GPU Shadow ray support was moved into the Experimental feature set, it works for CPU in Supported feature set. And in GPU with Supported feature set it won't work for both mesh or lights. $\endgroup$ Commented Jun 28, 2015 at 15:08
  • $\begingroup$ Just for clarity.. What is "from the last point to lamp"? Suppose the ray has reached its last bounce at point X and then gets traced back to the light source, but then on this way back it crosses another object at point Y that blocks the path, then is the shadow ray from X to light or from Y to light? $\endgroup$
    – Gnub
    Commented Nov 13, 2017 at 12:42
  • 2
    $\begingroup$ @Gnub If the max of bounces is reached and the ray didn't hit a light source this ray is not longer contributing to the render and is discarded. You also speak about tracing back to light source - the rays are traced from camera to lights, and when they hit light the rays illuminate all the surfaces they bounced on, there is no tracing "back to light source". $\endgroup$ Commented Nov 13, 2017 at 14:55
  • 2
    $\begingroup$ @Gnub Yes there are some optimizations that can be done like for example light portals or multiple importance sampling that "guides rays towards light": blender.stackexchange.com/questions/8152/…. But generally what you said is the disadvantage of simple light path renderers - small light sources introduce noise into the scene because they are hard to trace. This is where bi-directional path tracers have advantages - they trace from camera but also from lights. $\endgroup$ Commented Nov 13, 2017 at 15:38

You must log in to answer this question.

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