Dispersion back

Board: Home Board index Raytracing General Development

(L) [2017/02/05] [ost by rheniser] [Dispersion] Wayback!

I am trying to approximate dispersion by stochastically sampling refraction rays derived from randomly sampled wavelengths in the visible spectrum. My resulting renders are much darker than I would expect, which I suspect is coming from my uncertainty of color theory and models in this case.

Following the common approach, like presented in Raytracing of Dispersion Effect In Transparent Materials (by Wilkie, Tobler, and Purgathofer), I randomly sample a wavelength (in the visible spectrum of 360-780 nm) and convert it to the CIE XYZ 1931 Standard Observer values ([LINK https://www.rit.edu/cos/colorscience/rc_useful_data.php]).

Next, I convert the CIE XYZ 1931 values to Linear sRGB (D65) by multiplying by the color transform matrix ([LINK https://en.wikipedia.org/wiki/SRGB]). This transformation can result in Linear sRGB values that are out of the [0.0, 1.0] range. For example:
Code: [LINK # Select all]|  3.2406 −1.5372 −0.4986 |   | 0.2511 |   | −0.06179508  |
| −0.9689  1.8758  0.0415 | x | 0.0739 | = | −0.04125302  |
|  0.0557 −0.204   1.057  |   | 1.5281 |   |  1.61411237  |

According to most sources, including [LINK https://en.wikipedia.org/wiki/SRGB], the linear RGB values are usually clipped to [0.0, 1.0], with display white represented as (1.0, 1.0, 1.0).

If I want to render dispersion, clipping here I think would be problematic. It appears to me that I would be clipping out samples, resulting in darker renders due to clipped out energy.

One possible solution that comes to mind is restricting my sampling to wavelengths that result in [0.0, 1.0] RGB value without clipping. I will try this next.

If clipping is the usual approach, are there other common ones, perhaps normalizing, that would work better here? Normalizing I suspect would result in an undesirable color shift.
(L) [2017/02/06] [ost by friedlinguini] [Dispersion] Wayback!

>> rheniser wrote:According to most sources, including [LINK https://en.wikipedia.org/wiki/SRGB], the linear RGB values are usually clipped to [0.0, 1.0], with display white represented as (1.0, 1.0, 1.0).
It's not entirely clear, but it sounds like you're talking about clamping individual samples. Don't do that. Just average the unclamped sample values and then clamp the average. Yes, there's still potential energy loss and color shifting, but that's the usual result of tone mapping to a low dynamic range display.
(L) [2017/02/07] [ost by rheniser] [Dispersion] Wayback!

Yes, that is where I went wrong. When I normalize the linear sRGB values and clamp at the end, I get a much better result:

[IMG #1 normalized.png]
Normalized and clamped

Here are the averages for the table data ([LINK https://www.rit.edu/cos/colorscience/rc_useful_data.php]) and the single lobe approximation ([LINK http://jcgt.org/published/0002/02/01/]) for the wavelength to linear sRGB conversion:

Average Linear sRGB D65 (360-780 nm at 5 nm steps) = {0.30276, 0.23830, 0.22843}, Max = {2.51679, 1.50899, 1.89752}, Min = {-0.92539, -0.22180, -0.16958}

Average Linear sRGB D65  (360-780 nm at 0.5 nm steps) = {0.30884, 0.23873, 0.22871}, Max = {2.49697, 1.51144, 1.96021}, Min = {-0.80496, -0.25638, -0.18061}
Average  Linear sRGB D50 (360-780 nm at 0.5 nm steps) = {0.26359, 0.24440, 0.31418}, Max = {2.34045, 1.54728, 2.60592}, Min = {-0.87620, -0.27376, -0.19881}

Thank you,
Ryan
[IMG #1]:Not scraped: /web/20190530234240im_/http://ompf2.com/download/file.php?id=250&sid=c5338ef26e0bd58a7f640795d9bcceac
(L) [2017/02/07] [ost by rheniser] [Dispersion] Wayback!

Yes, that is where I went wrong. When I normalize the linear sRGB values and clamp at the end, I get a much better result:
normalized.png
Here are the averages for the table data ([LINK https://www.rit.edu/cos/colorscience/rc_useful_data.php]) and the single lobe approximation ([LINK http://jcgt.org/published/0002/02/01/]) for the wavelength to linear sRGB conversion:

Average Linear sRGB D65 (360-780 nm at 5 nm steps) = {0.30276, 0.23830, 0.22843}, Max = {2.51679, 1.50899, 1.89752}, Min = {-0.92539, -0.22180, -0.16958}

Average Linear sRGB D65  (360-780 nm at 0.5 nm steps) = {0.30884, 0.23873, 0.22871}, Max = {2.49697, 1.51144, 1.96021}, Min = {-0.80496, -0.25638, -0.18061}
Average  Linear sRGB D50 (360-780 nm at 0.5 nm steps) = {0.26359, 0.24440, 0.31418}, Max = {2.34045, 1.54728, 2.60592}, Min = {-0.87620, -0.27376, -0.19881}

Thank you,
Ryan

back