2
$\begingroup$

Please help. I'm trying to implement a ray tracer, going by the PBRT book and got stuck on an issue that I fail to find the answer to. My scenes are made from objects and light sources. From that, I can get the spectral power distribution(SPD) of radiance for each pixel (in watts per steradian per meter squared per meter of wavelength). The problem is, how to correctly convert them to RGB color values? It appears that I should first get the XYZ color, and then convert to RGB. But how do you go from an SPD to the XYZ color? I could just integrate the SPD with the xyz-color-mathing-functions, but they work with "relative power distributions", and I have absolute. The problem is with this scaling that needs to be done. So, if my understanding is correct so far, then the question is, how should I scale my SPDs so that the final image is correct and the XYZ values don't fly far out of the 0..1 range?

I'm not an expert in color, and it's possible that my undestanding of the situation is wrong. Does it make sense to ask, what absolute(i.e. not relative) SPD of radiance should the pixel get(watts per steradian per meter cubed), so that its RGB value is exactly white (1, 1, 1) ?

$\endgroup$
0
$\begingroup$

There is no unique answer or approach and it's not simple either. I'm afraid that once you know the absolute spectral distribution of light that falls onto your camera, you've only computed half the story. What happens now depends on what observer you are trying to simulate, and to what accuracy.

I can highly recommend Moving Frostbite to Physically Based Rendering 3.0 from SIGGRAPH 2014. It contains many details especially section 4.3 and 5.1.

If you are trying to simulate a camera you need to answer some other questions for yourself:

  • What ISO am I simulating?
  • What is my shutter speed?
  • What is my aperture?

With the answers to that you can correct how much light falls onto your sensor and how sensitive it is to that light. Perhaps you don't have to correct for aperture if you already simulate this for depth-of-field.

Then knowing that you need to know how that sensor responds to light of different wavelengths. Perhaps you can find some spectral responsitivity diagrams for the camera sensor you are interested in simulating? Then you can divide by integrate for each sensor type (R, G, B) to get RAW exposure, which still needs processing to turn into sRGB (which involves choosing a whitepoint). It's not simple.

I'm not an expert in color, and it's possible that my undestanding of the situation is wrong. Does it make sense to ask, what absolute(i.e. not relative) SPD of radiance should the pixel get(watts per steradian per meter cubed), so that its RGB value is exactly white (1, 1, 1) ?

Absolutely not. If you are indoors and look at a piece of paper, that is white, right? Now if you move outdoors, a much greater amount of light hits your eye, yet you still view it as white.

Assuming you view your image on a monitor, there's a lot of color spaces involved: the absolute spectral distribution, the camera, the stored image, the monitor used to display the image and your eyes. They all have different ideas of what 'white' means, and they all have different settings to tweak it: brightness, whitepoint, exposure, viewing conditions, etc.

$\endgroup$
  • $\begingroup$ wow, thanks a ton for this answer. it is of huge help. at first glance that document seems like just what I need. there's much to learn $\endgroup$ – egor Apr 30 at 20:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.