Graphics Reference
In-Depth Information
Figure 10.10. Noise as a surface texture on the simple sphere (left) and the same noise
treated as turbulence on the sphere (right).
glman noise comes from a texture, we will only be using four octaves here,
which will be plenty for our discussion.
As we noted for two- and three-dimensional noise, the real effect of tur-
bulence does not lie in the pure 1D functions shown in Figure 10.9, but in the
appearance of images that use it. In Figure 10.10, we show the simple sphere
with ordinary noise (left) and turbulence (right) to illustrate the additional
complexity that turbulence usually presents.
To get a turbulence function in glman , take the absolute value of each of
the four components minus the mid-value 0.5. This gives us Table 10.2.
Term 3
Component
Term Range
0
abs( nv.r − .5 )
0.0000 → 0.5000
1
abs( nv.g − .5 )
0.0000 → 0.2500
2
abs( nv.b − .5 )
0.0000 → 0.1250
3
abs( nv.a − .5 )
0.0000 → 0.0625
sum
0.0000 → ~ 1.0000
Table 10.2. The four noise octaves converted to turbulence.
3. In GLSL, the abs( ) function is overloaded to take either the integer or floating point absolute value
depending on what type was passed in. There is no fabs( ) function for floating point absolute
value like there is in C and C++.
 
Search WWH ::




Custom Search