|
This tutorial is a detour off of a main
series.
A Basis Function Detour
The choice of what Basis Function to use is the factor which
will most affect the resulting shape of your terrain, or the
layout of colors in a material or the amount of displacement,
or the density of the clouds or pretty much any parameter there
is in MojoWorld. Color textures are the most forgiving - any
basis function will work fine (though there may be aliasing
concerns for animations).
Terrain textures are quite unforgiving. When choosing Basis
Functions for terrain texturess, look for the smoother ones.
Sharp edges, such as those found in the Steps, Checkerboard and
some variants of Voronoi (lozenge, for one) and Sparse Convolution
(the disks and dishes kernels) will be prone to missing blocks
during renders and slow render times due to the vertical edges.
Here are the basis functions as they're listed in the v2 DDLB:
- Checkerboard
- Sine
- Steps
- Linear
- Value Perlin
- Gradient Perlin
- Value/Gradient Perlin
- Variable Value Gradient Perlin
- Voronoi
- Sparse Convolution
- Ridged Value
- Ridged Gradient
- Ridged Value Gradient
- Ridged Variable Value Gradient
- Distorted Noise
- Steep Steps
In trying to come up with a way to present these with
distinctive visual explanations, I've found it's going
to be clearer and easier to discuss them in terms of
their relationships to each other. They fit together
into different families.
- Checkerboard / Sine
Both of these basis functions can be drawn as simple
waves. Checkerboard uses a square wave and I'm sure
you've all heard of a Sine wave... Due to the vertical
edges created by the Checkerboard basis, it's not a
good one to use for terrain textures (and probably not
displacement textures either), but it can be very useful
in color materials.
Checkerboard / Sine
- Steps / Steep Steps / Linear
The Steep Steps basis function has a single parameter
called 'Slope Width'. If the slope width is set to 0,
the edges become vertical, thus making the Steep Steps
basis function the same as the Steps basis. When the
slope width is set to 2, the Steep Steps basis is the
same as the Linear basis. The plain Steps basis function
is not good for terrain textures. For terrains where
steps would be appropriate, Steep Steps is the basis to
use. The default slope width of 0.02 is about as steep
as you want to get for a terrain texture. The sample below
uses a slope width of 1.0.
Steps / Steep Steps / Linear
- Value Perlin / Gradient Perlin /
Value Gradient Perlin / Variable Value Gradient Perlin /
Ridged Value / Ridged Gradient / Ridged Value Gradient /
Ridged Variable Value Gradient
Ken Perlin is the guy responsible for Perlin noise. He
won an Oscar for it. All of the basis functions in this
group are based on his original algorithms. By far, the
most common question I get about these is "what's
the difference between _value_ and _gradient_, anyway?"
It has to do with a mathematical detail of how the noise
is generated.
Perlin noise is built on a grid. For the value type,
each intersection in the grid is assigned a psuedo-random
value. For every input point that is evaluated, the basis
function finds the surrounding set of grid intersections
and depending on the values at those intersections, calculates
a result that's smoothly in between the values at the
intersections. For gradient noise, instead of a single value
being assigned to each intersection, a 2d vector is assigned.
That's called the gradient vector. The sites I've found
describing the mathematics behind Perlin noise all skip over
the plain value type and describe only the gradient type
in gory detail.
One way to visualize the difference between value and
gradient is to imagine a chessboard with each square
containing a different-sized smooth and centered lump
of clay. That's value noise. Now gently push each lump
off center in a random direction. That's gradient noise.
Well, not precisely, but it's a reasonable analogy. For
one thing, there will be dimples as well as lumps... but
you get the idea...
Perlin
Value / VarValGrad 0.25 / ValGrad /
VarValGrad 0.75 / Gradient
Now that we've got the difference between value and gradient
sorted, what's the difference between Perlin and ridged?
Ridged noise is Perlin noise run through a simple filter
which looks like this:
Where the result of the Perlin noise is 0, the ridged version
outputs 1 and where the result of the Perlin noise is either
-1 or 1, the ridged version outputs 0. This is what creates
the sharp ridges. When we get to using large displacements in
materials applied to the terrain, it's best to avoid sharp ridges
in your terrain texture's basis function(s). But you can cheat
and filter plain Perlin noise through a 'similar but rounded on
top' output curve to get a ridged-like basis that responds better
to large material displacements.
Ridged
Value / VarValGrad 0.25 / ValGrad /
VarValGrad 0.75 / Gradient
Notice how the two Ridged Variable Value Gradient samples seem
to be so much lighter than the other three samples in the ridged
type? It turns out that the Ridged Variable Value Gradient basis
has some extra code in it (that got left in by mistake, so it's
technically a bug) causing the output to behave differently
than one would expect. But it's too late to change it now,
since to do so would change all the planets out there which
currently use this basis function in any of their textures.
It's just another caveat on the question to always ask when
making Mojo textures - what sort of input do we have and what
do we want to do with it?
- Voronoi / Sparse Convolution
These two are related in that they both use the same
choices of seed tables to determine the inital placement
of the cells. There's a discussion and diagram on page 35
of the main MojoWorld manual regarding these seed tables.
Both of these basis functions have a very wide variety of
possible effects, some of which are not very good for
terrains. These two are the slowest (and often the most
strikingly beautiful) basis functions.
This small sample below shows two variants of Voronoi
noise (the default and one of the other 192 types) and
two variants of Sparse Convolution (the default and one
of the other howevermany types).
- Distorted Noise
This gets to be all by its lonesome, because it is really
the interaction of two basis functions. Be sure to go into
the basis function editor and choose two other basis functions
otherwise Distorted Noise will output 0 everywhere, which
results in a totally flat fractal...
While it's possible to distort one basis with a differently
scaled version of the same basis, doing so will quite possibly
run into significant aliasing effects.
Back to Index
Back to Terrain Textures
|