So I understand how ray tracing works. And in shader nodes in Cycles you can use LightPath node to tell the renderer how certain material affects the rays that come from other object. For example if some other fragment (pixel) casts a shadow ray that intersects your material, you can use the isShadowRay to affect the value returned by that ray, up to making the material completely transparent for the shadow ray, i.e. not cast shadows on anything.

That's a very useful node, but is there a way to do the reverse? For example if my material casts a shadow ray, and it intersects some object, meaning that the shadow is cast on my material from light source. But can I take that returned value and affect it in any way? For example, it could be useful to make the shadow ray always return 0, i.e. no shadows are cast ON my material. I understand that you can achieve that particular effect through, for example, rendering layers, but I'd love to have that input available for me to do mode complex stuff.

Since someone misunderstood the question, I will ask again differently. Ray tracing works as such:

  • Cast a ray from the camera
  • It hits some pixel on our Material
  • Then many other rays are cast in different directions to test which other objects/materials are around that pixel. Those are shadow rays, transparent rays, diffuse rays, etc.
  • Each of those rays returns a value. The mathematical formulas are then used to determine the final color of the initial pixel that we have hit.
  • I want to take those values in the shader and affect them.

What LightPath node does is the reverse of what I want. It affects the result that THIS MATERIAL returns to OTHER MATERIALS that have cast certain rays.

  • 1
    $\begingroup$ First of all, the "Is..." outputs of the Light Path node are just giving two values: yes or no. If a ray is a shadow ray, the value is yes or 1 which shows as white, if not it's no or 0 showing as black. So if you want to reverse the answer of the question "is this a shadow ray?" then you can simply use an Invert node or a Color Ramp with white on the left and black on the right, or a Map Range node mapping 0..1 to 1..0 and maybe many other ways as well. $\endgroup$ Sep 1 at 10:28
  • 1
    $\begingroup$ Gordon Brinkmann, I appreciate you correcting me on the binary nature of the node, but you still have completely misunderstood the question. $\endgroup$ Sep 1 at 10:31
  • $\begingroup$ Now your question is more clear, thanks. $\endgroup$ Sep 1 at 11:00
  • $\begingroup$ You can check Use Nodes on the light object and try controlling the rays from there. I have a couple of answers with lighting cheats that might give you an idea. - blender.stackexchange.com/questions/229624/… - blender.stackexchange.com/questions/233991/… $\endgroup$ Sep 1 at 12:42

Your Answer

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

Browse other questions tagged or ask your own question.