The Online POV-Ray Tutorial

Normal Reference

The following topics are covered in this section. The following scene is used for examples of the different normal modifiers. Right now it contains a Featureless Red Sphere. Some phong was added to make the effects of the normal modifiers more apparent.

The "bumps 0" statement was added just to keep POV from complaining. It doesn't actually have any effect in this scene.


Bump Map

Bump maps are sort of a cross between an image map and a height field. They allow you to map a set of normals around an object. The intensity of the pixel value at each point in the input file for the bump map determines the "height" of the corresponding point. This can be changed with the "use_index" keyword (see below). Here's the general syntax for a bump map.

normal {
   bump_map {
      type "filename"
      [bump_size size]
      [interpolate mode]
      [use_color]
      [use_index]
      [once]
      [map_type map mode]
   }
}

Any specifiers in square brackets ([]) are optional.

type specifies the type of the file that is the source for the bump map. It should be gif, iff, tga, or dump. This is followed by the full name of the file (filename), in double quotes. This image will mapped onto the object. The image will be mapped onto the x-y plane and rescaled to fit into the range (0, 0), (1, 1). To chnage this default mapping mode, you can make use of the map_type keyword. Larger images do not produce larger bump maps, but rather bumps maps with better resolution. By default, the bump map is repeated infinitely in the x and y directions; this can be altered with the once keyword.

The bump_size parameter is used to control the apparent depth of the bumps generated by the bump map. This can be any number you want, as long as you don't want 0. 0 is bad. Large numbers give you big depths, small numbers give you little wrinkles. Negative numbers make the highs into lows and the lows into highs.

Normally (ha!), the relative height of each point on the mapped surface is determined by the intensity (gray scale value) of the corresponding pixel. This creates a surface which looks like it has the image embossed into it. If you would rather have the bump map height based on the palette index of the corresponding color (as with height fields) you can include the optional keyword "use_index". The "use_color" keyword may be included to specifically state that a bump map uses the default behavior. It will not usually have any effect.

Interpolation is good for smoothing out jagged or low resolution bump maps. By default, POV-Ray takes each surface intersection and assigns it a pixel value in the bump map. With low resolution bump maps, the surface will look blocky. Interpolation smooths the bump map by averaging surrounding pixel values. The parameter for interpolation tells POV-Ray what kind of interpolation to use. This can be either 2 (Bilinear) or 4 (Normalized Distance). As is usual with such things, you can either get speed or quality. Bilinear interpolation is better, but Normalized Distance is faster. By default, no interpolation is used.


Bumps

The bumps normal creates a random bumpy pattern on the object. In fact, it uses a similar pattern to the bozo pigment. The result is really pretty cool. The bumps normal takes a float parameter from 0.0 (Flat) to 1.0 (Mountainous) that describes the depth of the bumps. The following image was rendered with "bumps 1.0".

By default the bumps are pretty large (about 0.5 to 1.0 units across), so the normal was scaled down to make it fit. Note that this only changes the spacing of the bumps, it does not modify their apparent depth.

For more information on declaring normals, see the normal section.


Dents

The dents normal basically makes the object look like someone attacked it with a sledgehammer. The surface appears to have dents (naturally enough) beaten into it. Dents takes a float parameter from 0.0 (Brand New) to 1.0 (Survived a Hail Storm) which specifies the depth of the dents. Here's what happens if we take the Featureless Red Sphere and beat it up a bit with "dents 1.0".

The normal was scaled to get it to fit nicely onto the sphere. Note that scaling only changes the spacing of the dents, it does not modify their depths.

For more information on declaring normals, see the normal section.


Normal

The normal component of a texture allows you to create effects on the surface of an object. Since much of the way we perceive objects is based on how they reflect light, it is possible to trick the eye into thinking a surface is bumpy by just modify the surface normal vectors. This is what the "normal" modifier does. Say you wanted to create a lake with ripples moding across the surface. Trying to model such a thing mathematically (whether with height fields or csg) would be excrutiatingly painful. So POV-Ray gives you the ability to modify the way light reflects off of the surface. Although not 100% realistic, it's "close enough" for most purposes. You should note, though, that specifying a normal modifier for an object does not actually change the location of the surface, it just makes it look different. But anyway, here's how to specify a normal modifier for an object (really it's quite simple).

normal {
   type depth   /* OR */
   bump_map {
      /* bump map specifiers */
   }
   /* modifiers go here */
   /* any rotations, scales, and translations
      go here */
}

Normals have three parts, the type, the modifiers, and then transformations. A normal can only have one type, and that is one of bumps, dents, ripples, waves, or wrinkles. They each take a depth parameter between 0.0 (Flat) and 1.0 (Violent). Each type is covered with an examples in its own section.

One modifier that is supported for normals is turbulence. Turbulence is covered in depth in the pigment section and will not be covered again here. Turbulence can really create some wacky normals. As an example, here's a standard ripples normal and another with "turbulence 0.7". Note the ripples have been translated to put their center on the top of the sphere.

Only certain normal modifiers respond to the keywords "frequency" and "phase". These are the ripples and waves. The frequency keyword controls the density of the ripples or waves, while phase controls their location. Incrementing phase from 0.0 to 1.0 will bring the normal back to where it started from.

Transformations that are applied to normals only modify the locations of the normal components, they do not change the depths of the normals. You can create some pretty wacky effects (in animations) by translating bumps or dents perpendicular to the surface of the object.

Normals are fun to play with, and easy to specify. They should be added last, in the "fine tuning" section of scene production. They can turn an object that looks great into an object that looks absolutely spectacular.


Ripples

The ripples normal creates evenly space, smooth ripples which originate from 10 random locations inside the box with corners <0, 0, 0>, <1, 1, 1>. All the waves have the same frequency, so the ripple effect is smooth at a significant distance from the center. Ripples takes the standard 0.0 to 1.0 parameter. Compare the look of ripples to that of waves. Here's how ripples look, scaled a bit and translated so they will appear on the surface of the previously Featureless Red Sphere.

The appearance of these ripples can be modified to some extent with the frequency and phase modifiers.

For more information on declaring normals, see the normal section.


Waves

Waves are similar to ripples, except instead of creating smooth, even ripples, it creates more rough and tumble waves. Theoretically these look more like deep ocean waves. The waves normal takes the standard 0.0 (Becalmed) to 1.0 (Tsunami) parameter. Here's what "waves 1.0" looks like (scaled to some extent to get it to look good).

The appearance of the waves can be modified to some extent with the frequency and phase modifiers.

For more information on declaring normals, see the normal section.


Wrinkles

Wrinkles is one of the neatest surface normals, but it is also one of the slowest to compute. This normal specifier basically makes the object look like it had been wadded up and then stretched back out again. It basically works repeatedly denting the surface with smaller and smaller dents. Here's how a wrinkled by otherwise Featureless Red Sphere might look.

For more information on declaring normals, see the normal section.


Reference Index Top of Document Beginning of the Tutorial

The Online POV-Ray Tutorial © 1996 The Online POV-Ray Tutorial ThinkQuest Team