Spectral Lighting

 

First calculate wavelength = ((420*(x/nx))+380), and do a lookup into the table Pete provided to find the amplitude.

Next, find X, Y, Z = amplitude*intensity (intensity = y/ny).

Next, find x, y, z = X/(X+Y+Z), Y/(X+Y+Z), Z/(X+Y+Z)

Next, find y0 = kY/(1+kY), x0 = x*y0 / y , z0 = (1-x-y) * y0 / y

Finally, Tone map using the matrix Pete provided and clamp to [0, 1]

 

k = 0.5

 

k = 1

 

 

k = 4

 

k = 16

 

 

k = 200