Graphics Reference
In-Depth Information
The GLSL specification lists a built-in noise function. However, at the time of this
writing, its exact behavior has not yet been universally decided upon. So, while it is in
the spec, you might not be able to use it. This chapter will discuss the fundamentals
of noise for graphics shaders, and will show how glman uses 2D and 3D textures to
get around the absence of a working GLSL noise function. Even if you are not using
glman , you will see how to computationally generate noise, which you can then use by
embedding it in your own texture.
Fundamental Noise Concepts
A noise function is a real-valued function that takes on values between 0. and 1.
over some domain. 1 A noise function is often generated by determining pseudo-
random numbers ( PRNs ) at each of a number of fixed points in a domain and
processing those values to generate a function across the entire domain. If the
domain is an interval, we have one-dimensional noise; if the domain is a plane
region, we have two-dimensional noise; if the domain is a region in three-dimen-
sional space, we have three-dimensional noise. The values of the noise function
can be used to modify values of such things as the pixel properties in a fragment
shader. In this section we will briefly introduce some kinds of noise functions
and their properties, based on one-dimensional noise operations for simplicity.
There are some choices we will need to make as we design a shader that is
to use noise functions. Below we discuss some of those choices. If you are using
glman with your study of shaders, you will find the noisegraph application as
part of the distribution, and you can use that to experiment with many of the
noise concepts you will find in this chapter. All the 1D noise function graphs
that you will see as figures in this chapter were developed with noisegraph .
Three Types of Noise: Value, Gradient, and Value+Gradient
One choice you will need to make is whether you want to use value noise or
gradient noise . The value and gradient noise functions produce results that have
qualitative differences. Both kinds of noise functions are based on piecewise
interpolating their definitions at a fixed set of points in their domain, usually
regularly spaced. Both kinds of noise need values at each point; these are given
by using system-generated pseudo-random numbers. In value noise , the pseudo-
random values at each fixed point are used as the noise function values, and the
1. Some noise functions prefer the range -1. to 1. It doesn't really mater. It just means that you will
transform the noise return values differently.
 
Search WWH ::




Custom Search