trueSKY generates a Rainbow Lookup texture based on the colour and the power of the main directional light source; either the sun or the moon. It calucates any losses due reflections of light entering or exiting the raindrop and the wavelength of the emitted light at all angles between 40.7 and 53.5 degrees. For raindrops that are small than 1mm in diameter, a submillimetric light scattering approximation is used to adjust the spectral output.
When compositing rainbows to our cubemap, trueSKY uses the previously generated lookup texture, along with checks for the total occlusion of the main directional light source, moisture levels within the clouds and rain streaks and the desired depth point to draw the rainbow about the antisolar or antilunar point, which was either automatically or manually set. Any bright or dark areas of the rainbow are also composited at this point.
The rendering of the Rainbow Lookup Texture takes about 0.007ms , and compositing takes about 0.20ms of GPU time. Adjustments to the resolution of cloud cubemap will directly affect the compositing time. All rendering is disable if the either the Rainbow Intensity, Rain Strength or Rain Streaks are set to 0.