Shadow ray distance (in volumes)

   1821   2   0
User Avatar
Member
4 posts
Joined: July 2013
Offline
Is it possible to get the distance the current ray has travelled?


I'm looking into doing something similar to this:

http://magnuswrenninge.com/wp-content/uploads/2010/03/Wrenninge-OzTheGreatAndVolumetric.pdf [magnuswrenninge.com]

where they have a nice way of simulating multiple scattering in volumes by varying some parameters along the shadow ray.
User Avatar
Member
7727 posts
Joined: July 2005
Online
Sorry, no time to check your link but have you tried looking at Pz? If you're sending out the rays yourself, then you can try getting that information via gather().
User Avatar
Member
293 posts
Joined:
Offline
I'm interested in this as well, but my rusty reading of the equation implies that they modify the shadow in a loop, calling the phase function multiple times, and lowering the shadow volume density in each iteration.

The only simple way I can think to do this using PBR is to evaluate the henyey greenstein F value for each octave, modifying the parameters and summing the result. It's slow and a little inflexible, however, because in pure PBR mode one can't modify the shadow opacity per-BSDF. So you have to do it in a loop and evaluate the BSDF multiple times. Someone please correct me if I'm wrong about that.

That's always annoyed me about the PBR implementation, having the F*Of black-boxed… I suppose if you wanted, you could hack the pathtracer code to somehow allow this, though.

I made a quick hack of it, see the attached HIP.

Attachments:
pbr_multiscatter_hack.hip (304.6 KB)

  • Quick Links