Saturday, March 9, 2013

Better Dispersion

Photorealizer now has high quality, physically accurate, spectral dispersion.

I improved the dispersion system in Photorealizer using some ideas that I wrote about in two old posts and a comment (here, here, and here). Instead of just tracing rays for RGB primaries, I now trace rays across the entire visible spectrum. Most parts of Photorealizer still use RGB color, but when a dispersive material is encountered, I choose a single wavelength from the visible spectrum, determine the index of refraction using the Sellmeier equation, and then continue path tracing with that wavelength. Then I convert the results to sRGB primaries using the spectral responsivity curves of the camera's RGB sensor. I derived these spectral responsivity curves from the new physiologically relevant CIE XYZ color matching functions (which I wrote about in this post on my sky renderer blog), and normalized them such that pure white light (containing equal amounts of all the wavelengths of the visible spectrum) is transformed into pure white in the sRGB color space (1,1,1) (i.e., I made each curve integrate to one). The spectral responsivity curves can take on negative values, and I don't clip negative color components until a bitmap image is output, which allows colors outside the sRGB gamut to be represented using the sRGB primaries. While these negative colors can't be displayed on a typical display, they are still useful and necessary for accurate color math. For example, adding a positive color to a negative one can result in a positive color in the displayable range, but if the negative color had been clipped to zero the result of the addition would be different and wrong.

I rendered new images of diamonds using my improved dispersion system. These images are 1600x900. You can click on an image to enlarge it, or you can open an image in a new tab or download it to ensure that you are viewing it at full size.

Diamonds with dispersion. The scene is completely grayscale; all of the colors in the image come from dispersion. Click to view at full size and see all of the colorful details.

Diamonds without dispersion.

Diamonds with dispersion but without transmission.

Highly saturated version of the image above, to clearly show that dispersion affects reflection, not just refraction (higher frequency (i.e., bluer) → higher index of refraction → higher reflection coefficient).

An old dispersion render (from this post) in which I traced only 3 specific wavelengths: 1 for red, 1 for green, and 1 for blue. (There are some other differences between this and the new render as well.)

3 comments: