Scattering in mist using photon mapping

I am playing around with Radiance, trying to reproduce the scattering and absorption that occurs in water. The image below shows my test scene: looking down along the length of a rectangular region of water (mist material) with a series of cylinders embedded within the water (two middle rows) and outside the water (rows to either side). The water material is defined as:

void mist Water_ft
  7 0.1 0.1 0.1 0.8 0.9 0.999999 0

Here are the commands I run:

oconv materials.rad sky.rad scene.rad > scene.oct
mkpmap -ds 0.1 -t 10 -apg scene.gpm 20k -apv scene.vpm 200k scene.oct
rpict -t 15 -vf view.vf -x 1200 -y 600 -ab 1 -ap scene.gpm 50 500 -ap scene.vpm 50 500 scene.oct > WaterTest.pic

Using pmapdump shows that mkpmap generates photons within the mist volume. However, rpict does not seem to find them, with output like this:

rpict: 4597412 rays, 51/500/191 global (-92.5/74.3/18.6% error), 0/0/0 volume (0.0/0.0/0.0% error), 100.00% after 0.0233 hours

The resulting image shows light is being absorbed, but scattering is clearly missing. Any idea what I am doing wrong?

A tangential question: how does Radiance handle surfaces within a mist volume? In my scene, I hollowed out tubes in the water volume so that the cylinders and water volume do not overlap. However, I placed a horizontal plane on the bottom left half of the water volume, entirely within the water volume. This is of the same material as the plane at the bottom of the scene (plastic, purely diffuse reflection, 80% reflectance). The embedded surface is very dark compared to the larger surface below it. However, if I change the mist material to:

void mist Water_ft
  7 0.1 0.1 0.1 0.8 0.9 1.0 0

I get the second image, where the surfaces look very similar. The only difference between the two images is the blue albedo changing from 0.999999 to 1.0. It appears Radiance treats the surface very differently if any albedo component is exactly 1. What is going on here? This behavior happens with or without photon mapping.

I can’t seem to upload the scene files here, but I can share them if there is a way.

Hi Savage,

nice to see someone using this niche functionality. :wink:

Your rpict call is missing the -ms integration step parameter that triggers the inscattering calculation in mist, both from light sources (as in RADIANCE Classic) and the volume photon map. Without it, the volume will simply render as a dark region.

As to your second question, there are caveats to the way RADIANCE handles mist. Essentially, there should be a mist boundary between the volume and the surfaces that lie within it; essentially you’d have to “punch holes” in the medium. For example, for a sphere submerged in water you would have to surround it by a mist bubble. This enables RADIANCE to registers that a ray has left the medium, resetting the extinction and albedo and travelling an infinitesimal distance until it reaches the surface. At least that’s how I understand the inner workings of the mist code, but anyone please correct me if I’m wrong.

Best regards,


Thank you for the quick response, Roland! Unfortunately, adding the -ms option does not seem to yield any difference (no scattering). On a 100x100x20 size scene, I varied -ms between 0.1 and 10, but rpict is still finding 0 volume photons.

I have tried both Radiance 5.0 (packaged with DIVA) and Radiance 5.2; both fail to include the scattering. The older Radiance version produces the same message as in my previous post, while the newer Radiance version produces a slightly different final message:

rpict: 406421 rays, 51/500/165 global photon bwidth (-85.2/51.0/14.0% error), 500/50/0 volume photon bwidth (999999995904.0/-999999995904.0/0.0% error), 45.25% after 0.0044 hours

but does not even yield a complete picture (the top of the picture is formed, down only to where the water starts).

Any other ideas of what I might be missing? I also tried playing with the -am option, with no effect. This rvu image of the photon map shows volume photons are definitely there.

Hi Savage,

a few comments about your commands and output. You’re using bias compensation with the volume photon map, which is infact now deprecated as I considered it redundant, currently only using the upper bound you specify as a fixed bandwidth. This also explains the junk statistics you’re getting in rpict’s progress report, as they’re no longer updated. This is a bug and has to be fixed, and a warning issued. Thanks for bringing it up.

Using bias compensation with the global photon map, rendered via an ambient bounce, doesn’t make sense as the latter averages any high-frequency illumination the bias compensation tries to preserve. This only makes sense if you render global photons directly with -ab -1, which requires a very large number of photons, and is primarily intended for the curious to visually examine their raw photon density estimates, and maybe have a chuckle or two. :wink:

Bias compensation only makes sense if you expect high illumination gradients (caustics) in your scene from reflection or refraction, in which case you should use the dedicated caustic photon map (option -apc to mkpmap) in addition to global and volume. If you’re trying to render caustics from water, you’ll also need to add texture to the water surface, otherwise you’ll wind up with fairly flat (non)caustics.

All of this doesn’t explain why you’re not getting inscattering in the volume, though, and I suspect this issue isn’t directly related to the photon map. Does the volume render at all with RADIANCE Classic if you omit the -ap parameters in your rpict call?

Best regards,


That was it! If I remove the second numeric parameter to the -ap options, the statistical messages go away and the scattering shows up, as seen in the below image. That is the result with Radiance 5.2: scattering is still missing in the older 5.0 release, so a recent release seems to be required.

Radiance Classic generates nearly identical images to the original post: light is extinguished appropriately, but no scattering occurs. If I am not mistaken, Radiance Classic requires light sources to be specified in the mist material definition for scattering to work?

Thank you for your work Roland – photon mapping is a wonderful addition to Radiance!

Yay! Obviously there’s sumptin’ skwewy with the parsing of the volume photon map parameters after disabling its bias compensation. I’ll fix that for the next release. Just specify one bandwidth to disable biascomp and you’re good to go.

You’re absolutely right: you need to specify the light sources that interact with the medium to get direct inscattering courtesy of RADIANCE Classic (in addition to the indirect inscattering from the photon map). My apologies for overlooking that.

Thanks, glad you appreciate it. You might also want to credit Peter Apian-Bennewitz for initiating its development at Fraunhofer way back when… :wink:

Happy photon mapping,