2
$\begingroup$

I have an idea in my head of an animation where the (soft) shadow of some otherwise invisible object is constantly being cast on a character's face. I created that shadow-casting object and parented it to the character's head bone and unticked the "Camera" option in its Cycles settings. So far so good. This would probably work for most shots.

However, that object's shadow is currently also being cast onto other objects such as a wall behind the character or another character standing in front of them which is not what I envisioned...

To put this in more bland, concrete terms:

Light source(s)

Object A (shadowcaster)

Object B (foreground)

Object C (shadowreceiver)

Object D (background)

ObjectA's shadow should only be visible on the surface of ObjectC, not ObjectB or ObjectD.
The shadows of ObjectB and ObjectC should be visible on all other objects that are behind them respectively.

I suspect the solution might be more related to render layers/passes and compositing rather than material settings (e.g. Light Path nodes) but so far I haven't been able to make it work either way...

Any hints?

$\endgroup$
3
$\begingroup$

It's pretty interesting question, but the answer is surprisingly easy. You need to duplicate part of the mesh, on which you need the shadow to be casted, give it Transparent shader and move it just a bit above the surface of the original mesh. Then to the casting object material, you need to add node setup shown below and voila. enter image description here

enter image description here

$\endgroup$
  • $\begingroup$ OK, I won't have time to try this out today but if I understand this correctly, the shadow will only show up on objects that are behind at least one layer of transparent material, is that it? So the transparent object wouldn't even necessarily have to have the same geometry as the receiving object (which might be rather dense)... Interesting. I'll investigate this. The only potential problem I could see at the moment is that this might break if there are any other transparent or transluscent objects in the scene which would then also trigger the shadow to be cast on anything behind them... $\endgroup$ – Oliver Giesen Dec 31 '17 at 17:14
  • $\begingroup$ Yes, you're correct. It's not perfect for all possible situations, but I'm guessing that statistic probability of appearing of such conditions are close to zero. $\endgroup$ – Mzidare Dec 31 '17 at 17:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.