PBRT Spectrum toRGB range

180 views Asked by At

For academic purposes I have adapted PBRT so that it writes out data about intersections and general path related data (I used the path surface integrator).

There is however some difficulty in getting the RGB value of a spectrum at a certain intersection. It is pretty obvious that I have to use ToRGB(float* rgb) on the Spectrum class generated at a intersection, but the data observed afterwards is a bit strange. It would make sense for the RGB values to reside between a 0-1 range. This seems to be the case often, but at times I also see triplets such as

(1.851088, 0.882869, 0.772866)

Upon closer inspection, it turns out that the max values for RGB for my set of roughly 400.000 intersections are 3.77 2.00 and 1.76. The lower bound do seem correct as they are close to zero. So the question is what is the range used by PBRT so that I might transform it to 0.0 - 1.0.

Thank you

1

There are 1 answers

2
Tavian Barnes On BEST ANSWER

I haven't read PBRT yet or looked at its source code in detail, but I don't entirely believe your premise that

It would make sense for the RGB values to reside between a 0-1 range.

In reality, the light intensity at any point can be pretty much arbitrarily large; the sun is certainly brighter than the brightest pixel your monitor can display. So I'm assuming that PBRT spectra can be arbitrarily intense. In that case, to map it down to a limited light model, you can either downscale the values, or clamp them to 1.0 (or some combination of both).

Downscaling is analogous to decreasing your camera's aperture or constricting your pupils.

Clamping the values allows colours to "wash out", in the same way that a digital photograph of the sun may have many pixels all pegged to 1.0, 1.0, 1.0.