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).
2.5.2.3.1 Specifying a Bump Map
The syntax for a bump_map is:
BUMP_MAP:
normal
{
bump_map
{
BITMAP_TYPE "bitmap.ext"
[BUMP_MAP_MODS...]
}
[NORMAL_MODFIERS...]
}
BITMAP_TYPE:
gif | tga | iff | ppm | pgm | png | jpeg | tiff | sys
BUMP_MAP_MOD:
map_type Type | once | interpolate Type | use_color |
use_colour | bump_size Value
After the required BITMAP_TYPE keyword is a string expression containing the name of a bitmapped bump file
of the specified type. Several optional modifiers may follow the file specification. The modifiers are described
below.
Note: earlier versions of POV-Ray allowed some modifiers before the BITMAP_TYPE
but that syntax is being phased out in favor of the syntax described here.
Note: sys format is a system-specific format such as BMP for Windows or
Pict for Macintosh.
Filenames specified in the bump_map statements 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 or
Library_Path options active. This would facilitate keeping all your bump maps files in a separate subdirectory
and giving a Library_Path option to specify where your library of bump maps are. See "Library
Paths" for details.
By default, the bump pattern is mapped onto the x-y-plane. The bump pattern is projected onto the object
as though there were a slide projector somewhere in the -z-direction. The pattern exactly fills the square area from
(x,y) coordinates (0,0) to (1,1) regardless of the pattern's original size in pixels. If you would like to change this
default you may translate, rotate or scale the pigment or texture to map it onto the object's surface as desired. If
you would like to change this default orientation you may translate, rotate or scale the pigment 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 the generic bitmap
modifiers map_type , once and interpolate described in "Bitmap
Modifiers"
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
}
2.5.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.
|