Detectors in Radiance

Hey, is there a simple way to have a detector (which counts the amount of photons or the illuminance) in my scene. I’ve thought about using the command mkpmap with the option -aps. But I’m not sure how to define the sensor surfaces. I’ve already read the photon map manual but I still encountered a few problems. I’ve generated a plain which has the material detector_mat:

void antimatter detector_mat
1 void

and then tried to run the command mkpmap -apg photons.gpm 10k -aps detector_mat. First of all I would like to know if this is the correct way to use the option -aps. Additionally I’ve got the following Error: fatal - proc 0: too many prepasses, no global photons stored. I have a simple scene, which contains one light source and two plains. The first plain is made of a trans material and the second one is made of antimatter. I defined my light source like this:

void light bright
3 100 100 100

bright sphere fixture
4 0 -200 50 5

I’ve experimented a bit and came to the conclusion that maybe I need a ground and there is a problem with my light source which leads to the error message from mkpmap. Additionally i wanted to ask if there is an option to get the information from the sensor surfaces. Or if there is an easier way to have a detector it would be great if someone could help me.

Greetings Philip

The -I (upper-case “i”) option to rtrace interprets input vectors as positions and surface orientations, and computes irradiance at those points.

If you want something other than a cosine-weighted detector, there is the rsensor program.

Hi Philip,

your definition of the sensor surface using antimatter looks fine to me, ditto your mkpmap command.

The error you’re getting is likely due to no photons being deposited on the sensor surface (edit: if this is indeed the only receiving surface in the scene). Did you actually define a geometry (e.g. polygon) with the detector_mat material? Also, check the normal of that plane; photons will only be deposited if incident from the front side, i.e. facing the normal.

Also, 10k is a very low number of photons. It’s OK for testing, but once you’ve established your workflow and expect reasonable results, you’ll want to crank this up to something closer to 1m or more.

There are also a number of optimisations to speed up mkpmap (depending to a certain extent on what else your scene includes), so let me know how it goes.

Hope this helps!


Hey and sorry for my late replay.

@Greg_Ward thanks for your tip. It helped me a lot. But i have a few additional questions. So if I use the rtrace command as you mentioned i get three parameters. My question is whether the unit of these parameters is W/m^2 and whether there is a way to compute a total irradiance with those three values. Additionally I don’t quite understand why there are three parameters and not just one.

@Dr_Roland_Schregle thanks a lot for your quick comment but i think the solution Greg recommended is better suited for my problem, but I will keep your advice in mind in case i will be working with mkpmap in the future.
Greetings Philip

The three values are for three input channels, nominally red green and blue in the color space defined in src/common/color.h, but you can really assign the channels to be whatever you want. If you average them together, you should get a reasonable estimate of watts/sq.meter.

Hi Philip,

You’re right. For sparse scenes with predominantly diffuse materials, Radiance “Classic” will indeed be faster and easier to use, in particular because it doesn’t need explicit sensor surfaces. You will only benefit from Photon Mapping when specular materials contribute significantly to light transport in your model.

Best regards,


Hi all but especially @Greg_Ward, I wanted to test your last statement. So I used a scene where I created a sun and a sky with:

!gensky 3 20 12:07 +s -a 0 -o -0 -m 0

. At this time and place the solar time is 12:00 and the sun is in the zenith. Because of this I expected that I measure an irradiance of around 1000 W/sq.meter but with the input for rtrace -I:

0 0 0 0 0 1

I only measured:

4.306492e+02 4.306492e+02 4.306492e+02

. If I average those values I am well below 1000 Watts/sq.meter and that got me confused. So did I use the gensky command wrong or is there something else that I’ve missunderstood?

Thanks for all the replies, I’m grateful for this community and the fast replies.

Greetings Philip

Two things. First, you can specify solar noon directly by saying +12 instead, then you don’t need the meridian or longitude options. Second, the irradiance is not going to be 1000 unless you also specify -R 1000 to set the solar radiance.

Normally, you would model both sun and sky, and you can specify the solar irradiance due to each with the -R and -B options, respectively. Then, gensky will set values that produce these component irradiances on an unobstructed horizontal plane regardless of the solar angles.