Volume Scattering only for directional light?

Guys,

I’m playing with volume scattering, I’d like the volume scatter to kinda affect only directional light coming into the room and ignore reflections because it causes the walls to lose contrast. Or even controlling it would be great. Did try light path with no success so far. Any ideas?

Thanks

I think this shader setup should be a good place to start.

I do not think the light path node will work in this case.

Disclaimer: take all this with a pinch of salt, I have been playing around with light paths for years and still sometimes have doubts.

The light path node refers to the light paths that propagate from the materials not the rays they receive.
Rays start at the camera the first time a camera ray hits the object the depth is 0 (it has not bounced the camera sees it directly).
If the object is reflected in a mirror the ray depth is 1 (it has bounced once)
If there is another mirror that reflects the bounced ray its ray depth is 2 (it has bounced twice before reaching the camera.)

Here is a weird example. I have a volume cube on top of a glossy plane, and another glossy plane that reflects the scene, there is one bright lamp that lights the volume.

The volume scatter is blue if the ray depth is 0, red if it is 1 and green if it is 2 (or more).

If I set the first “greater than” to -0.1 the blue cube turns red because 0 bounces is greater than -0.1.

Lets take Cire setup and adapt it to my scene

What it is doing is saying that if the bounces (from the volume) are 1 or over the volume density is 0 (only for the bounced rays in the mirrors) if they are 0 the density is 1. (because it uses the red volume node.) So the volume has disappeared in the mirrors.

The ray depth refers to the “Number of times the ray has been reflected or transmitted on interaction with a surface.”

The light path node does not know how many times the light the material receives has bounced before reaching it, when the volume receives indirect light it will also scatter it (and absorb it with the principled volume). It does not distinguish between the direct and indirect light rays that hit it, both will affect the volume.

I think the best way to do what you want is to model the “light shaft” and apply the volume to that.

Edit; Sorry edited bad grammar

2 Likes

Thanks for the clarification. I wasn’t really sure about my setup, though it seemed to work in a quick test.

And yeah, modelling the light shaft does seem the simplest option.

I did try something similar to you at first (before you posted) but it did not work out and I put on my thinking cap.

Maybe if ( a big and future if ) Cycles becomes a bidirectional path tracer it would open up many more possibilities for the light path node (and light linking)

1 Like

OMG Norman, you just made a scientific research imho. Thanks a lot for your explanation and all of you guys, thanks.

Yes, before posting this thread, I knew that the dirty solution is to put the box and apply scatter to it, but I didn’t know this is the only solution. Unfortunately, the shape of this box must be changed every time the Sun position changes.

1 Like