Graphics Reference
In-Depth Information
}
float v = (outAngle - myAngle)/(outAngle - inAngle);
//Get colors by sampling RainbowUnit at the fixed value:
vec2 Rainbowst = vec2(v, uWhere);
vec3 rrgb = texture( uRainbowUnit, Rainbowst ).rgb;
//Set alpha components of color for blending
vec4 rrgba = vec4( rrgb, uALF);
//0.5 degree dropoff band at outside edge of rainbow
if ( (angle > outAngle - 0.5) ) {
rrgba.a = uALF*(1. - smoothstep(outAngle-0.5,
outAngle, angle) );
}
//lighter color inside rainbow
if (angle < inAngle)
{
rrgba.a = uALF*cos((inAngle - angle)/PI);
}
float alpha = rrgba.a;
//Approximation of the background
if (alpha < 0.3 )
alpha = 0.3;
vec3 colorOut = (1. - alpha) * irgb + alpha * rrgb;
fFragColor = vec4 (colorOut, 1);
}
The Glory
A glory is the effect of seeing a bright spot with a
rainbow fringe at a point exactly opposite the sun.
An example is shown in Figure 16.18. Note that you
can actually see exactly where you are in the reflec-
tion (as the center of the halo) and that you can see
several color fringes centered at that point.
Glories are caused by interference between
frequencies of light backscatered toward the light
source (the sun) from atmospheric water droplets,
but the exact way this happens is obscure. Instead
of trying to simulate this directly, we look for simu-
lations that compute the color associated with the
Figure 16.18. The glory as seen from an air-
plane. You can tell where the photographer
was siting by the center of the glory.
Search WWH ::




Custom Search