Graphics Reference
In-Depth Information
The fragment shader computes the height, applies the noise function to
the radius of the current point, and uses it to compute the decaying-exponen-
tial hump height, d . It then inverts the equation
2
d
λ
=
λ
m
+
05
.
to become
2
d
η
λ
m
=
05
.
so that, like the DVD example, a minimum and maximum multiple can be
computed. Those multiples are looped through, computing a wavelength at
each, which is then turned into an RGB:
uniform sampler3D Noise3;
uniform float uMaxHeight; // variables from sliders
uniform float uNoiseMag;
uniform float uA;
in vec3 vMCposition;
in vec3 vCenter;
out vec4 fFragColor;
const float ETA = 1.4; // oil index of refraction
const float LAMBDAMIN = 400.; // blue
const float LAMBDAMAX = 600.; // red
const vec4 BLACK = vec4( 0., 0., 0., 0. );
int
AssignRGB( in float lambda, out vec3 color )
{
if( lambda < LAMBDAMIN || lambda > LAMBDAMAX )
return 0;
float t = ( lambda - LAMBDAMIN ) / ( LAMBDAMAX - LAMBDAMIN );
color = Rainbow( t );
return 1;
}
void
main( )
 
Search WWH ::




Custom Search