### Section 7.6.2.2
Normal 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...
      }

Where NUM_1, NUM_2, ... are float values between 0.0 and 1.0 inclusive. A NORMAL_BODY is anything that would normally appear inside a normal statement but the normal keyword and {} braces are not needed. Note that the [] brackets are part of the actual statement. They are not notational symbols denoting optional parts. The brackets surround each entry in the map. There may be from 2 to 256 entries in the map.

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.

A normal map is also used with the average normal type. See "Average" for details.

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.3
Bump 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.

Instead of placing the color of the image on the shape like an image map a bump map perturbs the surface normal based on the color of the image at that point. The result looks like the image has been embossed into the surface. By default, a bump map uses the brightness of the actual color of the pixel. Colors are converted to gray scale internally before calculating height. Black is a low spot, white is a high spot. The image's index values may be used instead (see section "Use_Index and Use_Color" below).

### Section 7.6.2.3.1
Specifying a Bump Map

The syntax for bump_map is...

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

Where FILE_TYPE is one of the following keywords gif, tga, iff, ppm, pgm, png or sys. This is followed by the name of the file using any valid string expression. Several optional modifiers may follow the file specification. The modifiers are described below. Note that earlier versions of POV-Ray allowed some modifiers before the FILE_TYPE but that syntax is being phased out in favor of the syntax described here.

Filenames specified in the bump_map statement will be searched for in the home (current) directory first and, if not found, will then be searched for in directories specified by any +L switches or Library_Path options. This would facilitate keeping all your bump maps files in a separate subdirectory, and specifying a library path to them. Note that any operating system default paths are not searched unless you also specify them as a Library_Path.

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.

The file name is optionally followed by one or more BITMAP_MODIFIERS. The bump_size, use_color and use_index modifiers are specific to bump maps and are discussed in the following sections. See section "Bitmap Modifiers" for other general bitmap modifiers.

After a bump_map statement but still inside the normal statement you may apply any legal normal modifiers except slope_map and pattern wave forms.

### Section 7.6.2.3.2
Bump_Size

The relative bump size can be scaled using the bump_size modifier. The bump size number can be any number other than 0 but typical values are from about 0.1 to as high as 4.0 or 5.0.

      normal {
        bump_map {
          gif "stuff.gif"
          bump_size 5.0
        }
      }

Originally bump_size could only be used inside a bump map but it can now be used with any normal. Typically it is used to override a previously defined size. For example:

      normal {
        My_Normal   //this is a previously defined normal identifier
        bump_size 2.0
      }

### Section 7.6.2.3.3
Use_Index and Use_Color

Usually the bump map converts the color of the pixel in the map to a gray scale intensity value in the range 0.0 to 1.0 and calculates the bumps based on that value. If you specify use_index, the bump map uses the color's palette number to compute as the height of the bump at that point. So, color number 0 would be low and color number 255 would be high (if the image has 256 palette entries). The actual color of the pixels doesn't matter when using the index. This option is only available on palette based formats. The use_color keyword may be specified to explicitly note that the color methods should be used instead. The alternate spelling use_colour is also valid. These modifiers may only be used inside the bump_map statement.

### Section 7.6.3
Finish

The finish properties of a surface can greatly affect its appearance. How does light reflect? What happens when light passes through? What kind of highlights are visible. To answer these questions you need a finish statement.

The finish statement is the part of a texture which defines the various finish properties to be applied to an object. Like the pigment or normal statement you can omit the surrounding texture block to save typing. Do not forget however that there is a texture implied. For example...

      this...                            can be shortened to this...

      object {                           object {
        My_Object                          My_Object
        texture {                          pigment {color Purple}
          pigment {color Purple}           finish {phong 0.3}
          finish {phong 0.3}             }
        }
      }

The most complete form for defining a finish is as follows:

      finish {
        FINISH_IDENTIFIER
        [ ambient COLOR ]
        [ diffuse FLOAT ]
        [ brilliance FLOAT ]
        [ phong FLOAT ]
        [ phong_size FLOAT ]
        [ specular FLOAT ]
        [ roughness FLOAT ]
        [ metallic [ FLOAT ] ]
        [ reflection COLOR ]
        [ refraction FLOAT ]
        [ ior FLOAT ]
        [ caustics FLOAT ]
        [ fade_distance FLOAT ]
        [ fade_power FLOAT ]
        [ irid { thickness FLOAT turbulence VECTOR } ]
        [ crand FLOAT ]
      }

The FINISH_IDENTIFIER is optional but should proceed all other items. Any items after the FINISH_IDENTIFIER modify or override settings given in the IDENTIFIER. If no identifier is specified then the items modify the finish values in the current default texture. Note that transformations are not allowed inside a finish because finish items cover the entire surface uniformly.

### Section 7.6.3.1
Ambient

The light you see in dark shadowed areas comes from diffuse reflection off of other objects. This light cannot be directly modeled using ray-tracing. However we can use a trick called ambient lighting to simulate the light inside a shadowed area.

Ambient light is light that is scattered everywhere in the room. It bounces all over the place and manages to light objects up a bit even where no light is directly shining. Computing real ambient light would take far too much time, so we simulate ambient light by adding a small amount of white light to each texture whether or not a light is actually shining on that texture.

This means that the portions of a shape that are completely in shadow will still have a little bit of their surface color. It's almost as if the texture glows, though the ambient light in a texture only affects the shape it is used on.

Usually a single float value is specified even though the syntax calls for a color. For example a float value of 0.3 gets promoted to the full color vector <0.3,0.3,0.3,0.3,0.3> which is acceptable because only the red, green and blue parts are used.

The default value is very little ambient light (0.1). The value can range from 0.0 to 1.0. Ambient light affects both shadowed and non-shadowed areas so if you turn up the ambient value you may want to turn down the diffuse value.

Note that this method doesn't account for the color of surrounding objects. If you walk into a room that has red walls, floor and ceiling then your white clothing will look pink from the reflected light. POV-Ray's ambient shortcut doesn't account for this. There is also no way to model specular reflected indirect illumination such as the flashlight shining in a mirror.

You may color the ambient light using one of two methods. You may specify a color rather than a float after the ambient keyword in each finish statement. For example

       finish { ambient rgb <0.3,0.1,0.1> } //a pink ambient

You may also specify the overall ambient light source used when calculating the ambient lighting of an object using the global ambient_light setting. The formula is given by

       AMBIENT = FINISH_AMBIENT * GLOBAL_AMBIENT_LIGHT_SOURCE

See section "Ambient Light" for details.

### Section 7.6.3.2
Diffuse Reflection Items

When light reflects off of a surface the laws of physics say that it should leave the surface at the exact same angle it came in. This is similar to the way a billiard ball bounces off a bumper of a pool table. This perfect reflection is called specular reflection. However only very smooth polished surfaces reflect light in this way. Most of the time, light reflects and is scattered in all directions by the roughness of the surface. This scattering is called diffuse reflection because the light diffuses or spreads in a variety of directions. It accounts for the majority of the reflected light we see.

POV-Ray and most other ray-tracers can only simulate directly one of these three types of illumination. That is the light which comes directly from actual light sources. Light coming from other objects such as mirrors via specular reflection (shine a flashlight onto a mirror for example). And last not least light coming from other objects via diffuse reflections (look at some dark area under a desk or in a corner: even though a lamp may not directly illuminate that spot you can still see a little bit because light comes from diffuse reflection off of nearby objects).

### Section 7.6.3.2.1
Diffuse

The keyword diffuse is used in a finish statement to control how much of the light coming directly from any light sources is reflected via diffuse reflection. For example

      finish {diffuse 0.7}

means that 70% of the light seen comes from direct illumination from light sources. The default value is diffuse 0.6.

### Section 7.6.3.2.2
Brilliance

The amount of direct light that diffuses from an object depends upon the angle at which it hits the surface. When light hits at a shallow angle it illuminates less. When it is directly above a surface it illuminates more. The brilliance keyword can be used in a finish statement to vary the way light falls off depending upon the angle of incidence. This controls the tightness of the basic diffuse illumination on objects and slightly adjusts the appearance of surface shininess. Objects may appear more metallic by increasing their brilliance. The default value is 1.0. Higher values from to about 10.0 cause the light to fall off less at medium to low angles. There are no limits to the brilliance value. Experiment to see what works best for a particular situation. This is best used in concert with highlighting.

### Section 7.6.3.2.3
Crand Graininess

Very rough surfaces, such as concrete or sand, exhibit a dark graininess in their apparent color. This is caused by the shadows of the pits or holes in the surface. The crand keyword can be added to cause a minor random darkening in the diffuse reflection of direct illumination. Typical values range from crand 0.01 to crand 0.5 or higher. The default value is 0. For example:

      finish { crand 0.05 }

The grain or noise introduced by this feature is applied on a pixel-by-pixel basis. This means that it will look the same on far away objects as on close objects. The effect also looks different depending upon the resolution you are using for the rendering. For these reasons it is not a very accurate way to model the rough surface effect but some objects still look better with a little crand thrown in.

Note that this should not be used when rendering animations. This is the one of a few truly random features in POV-Ray and will produce an annoying flicker of flying pixels on any textures animated with a crand value.

### Section 7.6.3.3
Highlights

Highlights are the bright spots that appear when a light source reflects off of a smooth object. They are a blend of specular reflection and diffuse reflection. They are specular-like because they depend upon viewing angle and illumination angle. However they are diffuse-like because some scattering occurs. In order to exactly model a highlight you would have to calculate specular reflection off of thousands of microscopic bumps called micro facets. The more that micro facets are facing the viewer the shinier the object appears and the tighter the highlights become. POV-Ray uses two different models to simulate highlights without calculating micro facets. They are the specular and Phong models.

Note that specular and Phong highlights are not mutually exclusive. It is possible to specify both and they will both take effect. Normally, however, you will only specify one or the other.

### Section 7.6.3.3.1
Phong Highlights

The phong keyword controls the amount of Phong highlighting on the object. It causes bright shiny spots on the object that are the color of the light source being reflected.

The Phong method measures the average of the facets facing in the mirror direction from the light sources to the viewer.

Phong's value is typically from 0.0 to 1.0, where 1.0 causes complete saturation to the light source's color at the brightest area (center) of the highlight. The default phong 0.0 gives no highlight.

The size of the highlight spot is defined by the phong_size value. The larger the phong size the tighter, or smaller, the highlight and the shinier the appearance. The smaller the phong size the looser, or larger, the highlight and the less glossy the appearance.

Typical values range from 1.0 (very dull) to 250 (highly polished) though any values may be used. Default phong size is 40 (plastic) if phong_size is not specified. For example:

      finish { phong 0.9 phong_size 60 }

If phong is not specified phong_size has no effect.

Next Section
Table Of Contents