Reference:Bump Map
When all else fails and none of the 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 the sections Use_Index
and Use_Color below.
Specifying a Bump Map
The syntax for a bump_map
is:
BUMP_MAP: normal { bump_map { [BITMAP_TYPE] "filename" [gamma GAMMA] [premultiplied BOOL] [BUMP_MAP_MODs...] } [NORMAL_MODFIERS...] } BITMAP_TYPE: exr | gif | hdr | iff | jpeg | pgm | png | ppm | sys | tga | tiff GAMMA: Float_Value | srgb | bt709 | bt2020 BUMP_MAP_MODS: map_type Type | once | interpolate Type | use_color | use_colour | bump_size Value
After the optional 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.
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 sub-directory 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.
While POV-Ray will normally interpret the bump map input file as a container of linear data irregardless of file type, this can be overridden for any individual bump map input file by specifying gamma
GAMMA immediately after the file name. For example:
bump_map { jpeg "foobar.jpg" gamma 1.8 }
This will cause POV-Ray to perform gamma adjustment or decoding on the input file data before building the bump map. Alternatively to a numerical value, srgb
may be specified to denote that the file is pre-corrected or encoded using the sRGB transfer function instead of a power-law gamma function. New in version 3.8, other valid special values are bt709
and bt2020
, denoting that the file is encoded or pre-corrected using the ITU-R BT.709 or BT.2020 transfer function, respectively. See section Gamma Handling for more details.
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 the section Bitmap Modifiers where the generic bitmap modifiers map_type
, once
and interpolate
are described.
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 }
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.