### Section 7.6.2.1Slope Maps

A slope map is a normal pattern modifier which gives the user a great deal of control over the exact shape of the bumpy features. It is best illustrated with a gradient normal pattern. Suppose you have...

plane{ z, 0 pigment{ White } normal { gradient x } }

This gives a ramp wave pattern that looks like small linear ramps that climb from the points at x=0 to x=1 and then abruptly drops to 0 again to repeat the ramp from x=1 to x=2. A slope map turns this simple linear ramp into almost any wave shape you want. The syntax is as follows...

normal{ PATTERN_TYPE Value slope_map { [ NUM_1 POINT_SLOPE_1] [ NUM_2 POINT_SLOPE_2] [ NUM_3 POINT_SLOPE_3] ... } NORMAL_MODIFIERS... }

The NUM_1, NUM_2, ... are float values between 0.0 and 1.0 inclusive. POINT_SLOPE_1, POINT_SLOPE_2, ... are 2 component vectors such as <0,1> where the first value represents the apparent height of the wave and the second value represents the slope of the wave at that point. The height should range between 0.0 and 1.0 but any value could be used.

The slope value is the change in height per unit of distance. For example a slope of zero means flat, a slope of 1.0 means slope upwards at a 45 degree angle and a slope of -1 means slope down at 45 degrees. Theoretically a slope straight up would have infinite slope. In practice, slope values should be kept in the range -3.0 to +3.0. Keep in mind that this is only the visually apparent slope. A normal does not actually change the surface.

For example here is how to make the ramp slope up for the first half and back down on the second half creating a triangle wave with a sharp peak in the center.

normal { gradient x // this is the PATTERN_TYPE slope_map { [0 <0, 1>] // start at bottom and slope up [0.5 <1, 1>] // halfway through reach top still climbing [0.5 <1,-1>] // abruptly slope down [1 <0,-1>] // finish on down slope at bottom } }

The pattern function is evaluated and the result is a value from 0.0 to 1.0. The first entry says that at x=0 the apparent height is 0 and the slope is 1. At x=0.5 we are at height 1 and slope is still up at 1. The third entry also specifies that at x=0.5 (actually at some tiny fraction above 0.5) we have height 1 but slope -1 which is downwards. Finally at x=1 we are at height 0 again and still sloping down with slope -1.

Although this example connects the points using straight lines the shape is actually a cubic spline. This example creates a smooth sine wave.

normal { gradient x // this is the PATTERN_TYPE slope_map { [0 <0.5, 1>] // start in middle and slope up [0.25 <1.0, 0>] // flat slope at top of wave [0.5 <0.5,-1>] // slope down at mid point [0.75 <0.0, 0>] // flat slope at bottom [1 <0.5, 1>] // finish in middle and slope up } }

This example starts at height 0.5 sloping up at slope 1. At a fourth of the way through we are at the top of the curve at height 1 with slope 0 which is flat. The space between these two is a gentle curve because the start and end slopes are different. At half way we are at half height sloping down to bottom out at 3/4ths. By the end we are climbing at slope 1 again to complete the cycle. There are more examples in slopemap.pov in the sample scenes.

You may declare and use slope map identifiers. For example:

#declare Fancy_Wave = slope_map { // Now let's get fancy [0.0 <0, 1>] // Do tiny triangle here [0.2 <1, 1>] // down [0.2 <1,-1>] // to [0.4 <0,-1>] // here. [0.4 <0, 0>] // Flat area [0.5 <0, 0>] // through here. [0.5 <1, 0>] // Square wave leading edge [0.6 <1, 0>] // trailing edge [0.6 <0, 0>] // Flat again [0.7 <0, 0>] // through here. [0.7 <0, 3>] // Start scallop [0.8 <1, 0>] // flat on top [0.9 <0,-3>] // finish here. [0.9 <0, 0>] // Flat remaining through 1.0 } object{ My_Object pigment { White } normal { wood slope_map { Fancy_Wave } } }

### Section 7.6.2.2Normal Maps

Most of the time you will apply single normal pattern to an entire surface but you may also create a pattern or blend of normals using a normal map. The syntax for a normal map is identical to a pigment map except you specify a normal in each map entry.

A normal map is specified by...

normal{ PATTERN_TYPE normal_map { [ NUM_1 NORMAL_BODY_1] [ NUM_2 NORMAL_BODY_2] [ NUM_3 NORMAL_BODY_3] ... } NORMAL_MODIFIERS... }

For example

normal { gradient x //this is the PATTERN_TYPE normal_map { [0.3 bumps scale 2] [0.3 dents] [0.6 dents] [0.9 marble turbulence 1] } }

When the gradient x function returns values from 0.0 to 0.3 then the scaled bumps normal is used. From 0.3 to 0.6 dents are From 0.6 up to 0.9 a blend of dents and a turbulent marble is used. From 0.9 on up only the turbulent marble is used.

Normal maps may be nested to any level of complexity you desire. The normals in a map may have slope maps or normal maps or any type of normal you want.

Entire normals may also be used with the block patterns such as checker, hexagon and brick. For example...

normal { checker normal { gradient x scale .2 } normal { gradient y scale .2 } } }

Note that in the case of block patterns the normal wrapping is required around the normal information.

You may not use normal_map or individual normals with a bump_map. See section "Texture Maps" for an alternative way to do this.

### Section 7.6.2.3Bump Maps

When all else fails and none of the above normal pattern types meets your needs you can use a bump map to wrap a 2-D bit-mapped bump pattern around your 3-D objects.

### Section 7.6.2.3.1Specifying a Bump Map

The syntax for bump_map is...

normal { bump_map { FILE_TYPE "filename" BITMAP_MODIFIERS... } NORMAL_MODIFIERS... }

By default, the bump pattern is mapped onto the x-y-plane. The bumps are projected onto the object as though there were a slide projector somewhere in the -z-direction. The bump pattern exactly fills the square area from (x,y) coordinates (0,0) to (1,1) regardless of the bitmap's original size in pixels. If you would like to change this default, you may translate, rotate or scale the normal or texture to map it onto the object's surface as desired.

Next Section