Why doesn't this material work as a shadow catcher?

Hi folks. Before I posted a question asking about why baking the diffuse colour of one of my objects causes an apparent darkening when I render it, I decided to do a bit more reading around the topic, just in case I was just doing something dumb.

I intend to do some animation, so I’m just trying to bake as much as possible and then work around the rest. I didn’t get particularly far into my reading before I got side-tracked by the Light Path node. It doesn’t really have anything to do with what I was originally going to post about, but it does seem like it may be of tremendous use in reducing render times. Once I started getting the swing of it, I thought that I must be able to make a shadow-catching material that I can put on duplicates of objects in another render layer to render an animated object and its shadows so that I can composit it on to a static background.

Here’s the material I tried, but it doesn’t work. Instead of behaving like shadow rays hit a white diffuse surface and and everything else is just transparent, iy just menders the whole thing as transparent. I’m curious as to why this is.

‘Is Shadow Ray’ looks at the material’s shadow. So in your node network it is setting it so that the shadow catcher doesn’t cast a shadow. It’s intended for use in glass type shaders, where you don’t want the glass to cast a shadow, but rather you’re using the volume absorption and scatter to effect the light passing through it.

Take a look at this… https://www.youtube.com/watch?v=99NTQUUGWUY

Exactly. In a pathtracer shadows are a “property” of the material casting them, not the material they are cast upon. That’s why shadow catchers are so difficult to implement. And that’s why the shaders of a material can control if the object casts a shadow or not.

What the light path node does in your case, is to tell Blender:
“For every shadow ray that this material casts: use the transparent shader. For any other ray type (including camera rays): use the diffuse shader.”

Thanks guys. I guess I got a bit over excited at the prospect of what I was hoping might be a super simple, material-based shadow catcher. For some reason I was thinking that a shadow ray would get drawn as if it was from a white diffuse material, whilst all other types would remain transparrent if I used the material I posted on an object that’s intended to serve as the shadow catcher (like a plane for example). I still keep getting the exact details about rays muddled muddled up, but I’m getting there… slowly.

Thanks for the help guys.