Fractal Noise

Building A Marble Pattern Using Fractal Noise
by David Cornette
Computer Science Department
University of Southern Maine
Faculty Advisor: Dr. Bruce MacLeod

An important technique for generating procedural textures is the use of fractal noise.  This page illustrates the how this procedure works.

Noise Level 1The first element of the procedure is to create a noise function.  The noise function should be smooth, and appear to be random.  It should not be truly random, however, since if it were, the pattern would change every time a new frame was rendered to the screen.   The GLSL specification calls for a built-in facility for a noise function.  However, it is up to each vendor to decide the specifics of the implementation.  At least one vendor does not currently implement it at all.  Therefore in some cases it is necessary to use an alternative implementation.  The image to the right is a representation of what this looks like.

Noise Lever 2The next step is to repeat the same pattern, but at a different scale.  The image to the left shows a picture of this.  This image is very much like the first, but it appears to have been zoomed out, and all of the detail is smaller.  If you look closely at the lower left-hand corner of both images, you can see the similarity.  This second image also appears somewhat fainter.  The variation between the very darkest parts of the second  and the very brightest parts is less than it is for the first image.  This is because the value of the noise function has been scaled down by the same factor as the pattern was zoomed.

These steps are repeated several more times, as illustrated in the two images below.  Each of these is zoomed out more than the one before it, and each is also fainter.  The fourth images is so zoomed out and so faint that from a distance, it may appear to be a solid gray rectangle.

Noise Level 3            Noise Lever 4

Once all of these noises at different scales have been generated, the four images are added together, as illustrated below.  The result is the final image, which is the fractal noise pattern.  Click on it to see a larger view.

Noise level 1 + Noise Level 2 + Noise Level 3 + Noise Level 4 = Fractal Noise

Mapping used for blue marble shader The final step is to convert the grayscale noise pattern, into Marble Patternthe desired colors that will make the surface look like it is made of blue marble.  This is done with a mapping, which takes every level of gray in the fractal noise pattern, and changes it to a color.  The image to the right shows this mapping.  The top half shows the different levels of gray, with black at the right, and white on the right.  The bottom half shows which color each level is mapped to.  That is, for every point in the fractal noise pattern, find the corresponding level of gray in the top half of the image.  Then get the color below that spot in the bottom half of the mapping.  This is the color that that point has in the final pattern.  To the left is the result of this mapping.  Finally,  this may be mapped on to a three dimensional model, as seen below.

The marble pattern displayed on a teapot

Other mappings are possible as well.  The next two images show a mapping for a cloudy sky and the resulting pattern.

Mapping for a cloud texture
A cloudy sky pattern

This mapping could represent a mossy rock.

Mapping for a mossy rock
A mossy rock pattern