Textures
The texture
statement is an object modifier which describes
what the surface of an object looks like, i.e. its material. Textures are
combinations of pigments, normals, and finishes. Pigment is the color or
pattern of colors inherent in the material. Normal is a method of simulating
various patterns of bumps, dents, ripples or waves by modifying the surface
normal vector. Finish describes the reflective properties of a material.
Note: In previous versions of POV-Ray, the texture also contained
information about the interior of an object. This information has been moved
to a separate object modifier called interior
. See
Interior for details.
There are three basic kinds of textures: plain, patterned, and layered. A plain texture consists of a single pigment, an optional normal, and a single finish. A patterned texture combines two or more textures using a block pattern or blending function pattern. Patterned textures may be made quite complex by nesting patterns within patterns. At the innermost levels however, they are made up from plain textures. A layered texture consists of two or more semi-transparent textures layered on top of one another.
Note: Although we call a plain texture plain it may be a very complex texture with patterned pigments and normals. The term plain only means that it has a single pigment, normal, and finish.
The syntax for texture
is as follows:
TEXTURE: PLAIN_TEXTURE | PATTERNED_TEXTURE | LAYERED_TEXTURE PLAIN_TEXTURE: texture { [TEXTURE_IDENTIFIER] [PNF_IDENTIFIER...] [PNF_ITEMS...] } PNF_IDENTIFIER: PIGMENT_IDENTIFIER | NORMAL_IDENTIFIER | FINISH_IDENTIFIER PNF_ITEMS: PIGMENT | NORMAL | FINISH | TRANSFORMATION LAYERED_TEXTURE: NON_PATTERNED_TEXTURE... PATTERNED_TEXTURE: texture { [PATTERNED_TEXTURE_ID] [TRANSFORMATIONS...] } | texture { PATTERN_TYPE [TEXTURE_PATTERN_MODIFIERS...] } | texture { tiles TEXTURE tile2 TEXTURE [TRANSFORMATIONS...] } | texture { material_map { BITMAP_TYPE "bitmap.ext" [MATERIAL_MODS...] TEXTURE... [TRANSFORMATIONS...] } } TEXTURE_PATTERN_MODIFIER: PATTERN_MODIFIER | TEXTURE_LIST | texture_map { TEXTURE_MAP_BODY }
In the PLAIN_TEXTURE, each of the items are optional but if they are present the TEXTURE_IDENTIFIER must be first. If no texture identifier is given, then POV-Ray creates a copy of the default texture.
Next are optional pigment, normal, and/or finish identifiers which fully override any pigment, normal and finish already specified in the previous texture identifier or default texture. Typically this is used for backward compatibility to allow things like:
texture { MyPigment }
where MyPigment
is a pigment identifier.
Finally we have optional pigment
, normal
or finish
statements which modify any pigment, normal and finish already specified in the identifier. If no texture identifier is specified the pigment
, normal
and finish
statements modify the current default values. This is the typical plain texture:
texture { pigment { MyPigment } normal { MyNormal } finish { MyFinish } scale SoBig rotate SoMuch translate SoFar }
The TRANSFORMATIONS may be interspersed between the pigment, normal and finish statements but are generally specified last. If they are interspersed, then they modify only those parts of the texture already specified. For example:
texture { pigment { MyPigment } scale SoBig //affects pigment only normal { MyNormal } rotate SoMuch //affects pigment and normal finish { MyFinish } translate SoFar //finish is never transformable no matter what. //Therefore affects pigment and normal only }
Texture identifiers may be declared to make scene files more readable and to parameterize scenes so that changing a single declaration changes many values. An identifier is declared as follows.
TEXTURE_DECLARATION: #declare IDENTIFIER = TEXTURE | #local IDENTIFIER = TEXTURE
Where IDENTIFIER is the name of the identifier up to 40 characters long and TEXTURE is any valid texture
statement. See #declare vs. #local for information on identifier scope.
The sections below describe all of the options available for Pigment, Normal, and Finish. They are the main part of plain textures. There are also separate sections for Patterned Textures and Layered Textures which are made up of plain textures.
Note: The tiles
and
material_map
versions of patterned textures are obsolete and are only supported for backwards compatibility.