I've seen a few examples of using the light path node; looks cool and very useful! Most simply mix two shaders then control the factor via one of the outputs of the light path node. For example a green default cube with red shadows. I can't get this to work! Starting with a default scene, using cycles render engine, I place a plane under the cube then set the plane's shader to a simple white diffuse and the cube's shader up as shown in the demos. The result however is no different than if I just plug the top diffuse shader node directly into the material output. What am I missing? Have watched multiple examples of people explaining the node, all use the same node setup and no-one seems to mention any setting I might have missed.
1 Answer
I'm not sure what tutorials you've been watching, but this setup should work for you. Nothing special - like your attempt, the floor has a white Diffuse BSDF for it's material, and the material for the cube is shown in the graph. If this doesn't work, please let me know (ideally with a screenshot) what you're seeing instead:
This first image uses the Is Camera Ray output of the light path node to give a solid red shadow with no bounced light glow:
This setup uses the Is Shadow Ray output of the light path node, and gives a red shadow, with green bounced lighting:
Finally, this setup uses both Camera and Shadow rays, and gives a red shadow with red bounced lighting as well:
-
$\begingroup$ @ Christopher Bennett; Thank you! My fault was in not realizing the nature of the light path node, so following an example that mixed two diffuse BSDF nodes driven by the camera ray, but not realizing that one of those nodes was then switched to transparent BSDF when the ray was switched to shadow. $\endgroup$ Apr 11, 2021 at 19:51