|
Patterned textures are complex textures made up of multiple textures. The component textures may be plain textures or may be made up of patterned textures. A plain texture has just one pigment, normal and finish statement. Even a pigment with a pigment map is still one pigment and thus considered a plain texture as are normals with normal map statements.
Patterned textures use either a texture_map
statement to
specify a blend or pattern of textures or they use block textures such as
checker
with a texture list or a bitmap similar to an image map
called a material map specified with a material_map
statement.
The syntax is...
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" [BITMAP_MODS...] TEXTURE... [TRANSFORMATIONS...] } } TEXTURE_PATTERN_MODIFIER: PATTERN_MODIFIER | TEXTURE_LIST | texture_map { TEXTURE_MAP_BODY }
There are restrictions on using patterned textures. A patterned texture may not be used as a default texture (see section "The #default Directive"). A patterned texture cannot be used as a layer in a layered texture however you may use layered textures as any of the textures contained within a patterned texture.
In addition to specifying blended color with a color map or a pigment map
you may create a blend of textures using texture_map
. The syntax
for a texture map is identical to the pigment map except you specify a
texture in each map entry.
The syntax for texture_map
is as follows:
TEXTURE_MAP: texture_map { TEXTURE_MAP_BODY } TEXTURE_MAP_BODY: TEXTURE_MAP_IDENTIFIER | TEXTURE_MAP_ENTRY... TEXTURE_MAP_ENTRY: [ Value TEXTURE_BODY ]
Where Value
is a float value between 0.0 and 1.0
inclusive and each TEXTURE_BODY is anything which can be inside a
texture{...}
statement. The texture
keyword and
{}
braces need not be specified.
Note: the []
brackets are part of the actual
TEXTURE_MAP_ENTRY. They are not notational symbols denoting optional
parts. The brackets surround each entry in the texture map.
There may be from 2 to 256 entries in the map.
For example:
texture { gradient x //this is the PATTERN_TYPE texture_map { [0.3 pigment{Red} finish{phong 1}] [0.3 T_Wood11] //this is a texture identifier [0.6 T_Wood11] [0.9 pigment{DMFWood4} finish{Shiny}] } }
When the gradient x
function returns values from 0.0 to 0.3
the red highlighted texture is used. From 0.3 to 0.6 the texture identifier
T_Wood11
is used. From 0.6 up to 0.9 a blend of
T_Wood11
and a shiny DMFWood4
is used. From 0.9 on up
only the shiny wood is used.
Texture maps may be nested to any level of complexity you desire. The textures in a map may have color maps or texture maps or any type of texture you want.
The blended area of a texture map works by fully calculating both contributing textures in their entirety and then linearly interpolating the apparent colors. This means that reflection, refraction and lighting calculations are done twice for every point. This is in contrast to using a pigment map and a normal map in a plain texture, where the pigment is computed, then the normal, then reflection, refraction and lighting are calculated once for that point.
Entire textures may also be used with the block patterns such as
checker
, hexagon
and brick
. For
example...
texture { checker texture { T_Wood12 scale .8 } texture { pigment { White_Marble } finish { Shiny } scale .5 } } }
Note: that in the case of block patterns the texture
wrapping
is required around the texture information. Also note that this syntax
prohibits the use of a layered texture however you can work around this by
declaring a texture identifier for the layered texture and referencing the
identifier.
A texture map is also used with the average
texture type. See
"Average" for details.
You may declare and use texture map identifiers but the only way to declare a texture block pattern list is to declare a texture identifier for the entire texture.
Earlier versions of POV-Ray had a patterned texture called a tiles
texture. It used the tiles
and tile2
keywords
to create a checkered pattern of textures.
TILES_TEXTURE: texture { tiles TEXTURE tile2 TEXTURE [TRANSFORMATIONS...] }
Although it is still supported for backwards compatibility you should use
a checker
block texture pattern described in section
"Texture Maps" rather than tiles textures.
The material_map
patterned texture extends the concept of
image maps to apply to entire textures rather than solid colors. A material
map allows you to wrap a 2-D bit-mapped texture pattern around your 3-D
objects.
Instead of placing a solid color of the image on the shape like an image map, an entire texture is specified based on the index or color of the image at that point. You must specify a list of textures to be used like a texture palette rather than the usual color palette.
When used with mapped file types such as GIF, and some PNG and TGA images, the index of the pixel is used as an index into the list of textures you supply. For unmapped file types such as some PNG and TGA images the 8 bit value of the red component in the range 0-255 is used as an index.
If the index of a pixel is greater than the number of textures in your list then the index is taken modulo N where N is the length of your list of textures.
Note: The material_map
statement has nothing to do with the
material
statement. A material_map
is
not a way to create patterned material
. See
"Material" for explanation of this unrelated, yet similarly named,
older feature.
The syntax for a material_map
is:
MATERIAL_MAP: texture { material_map { BITMAP_TYPE "bitmap.ext" [BITMAP_MODS...] TEXTURE... [TRANSFORMATIONS...] } } BITMAP_TYPE: gif | tga | iff | ppm | pgm | png | jpeg | tiff | sys BITMAP_MOD: map_type Type | once | interpolate Type
After the required BITMAP_TYPE keyword is a string expression containing the name of a bitmapped material 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 material_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 material maps files in a separate subdirectory and giving a
Library_Path
option to specify where your library of material maps
are. See "Library Paths" for details.
By default, the material is mapped onto the x-y-plane. The material is projected onto the object as though there were a slide projector somewhere in the -z-direction. The material exactly fills the square area from (x,y) coordinates (0,0) to (1,1) regardless of the material's original size in pixels. If you would like to change this default you may translate, rotate or scale the texture to map it onto the object's surface as desired.
The file name is optionally followed by one or more
BITMAP_MODIFIERS. There are no modifiers which are unique to a
material_map
. It only uses the generic bitmap modifiers
map_type
, once
and interpolate
described in
"Bitmap Modifiers".
Although interpolate
is legal in material maps, the color
index is interpolated before the texture is chosen. It does not interpolate
the final color as you might hope it would. In general, interpolation of
material maps serves no useful purpose but this may be fixed in future
versions.
Next is one or more texture
statements. Each texture in the
list corresponds to an index in the bitmap file. For example:
texture { material_map { png "povmap.png" texture { //used with index 0 pigment {color red 0.3 green 0.1 blue 1} normal {ripples 0.85 frequency 10 } finish {specular 0.75} scale 5 } texture { //used with index 1 pigment {White} finish { ambient 0 diffuse 0 reflection 0.9 specular 0.75 } } // used with index 2 texture {pigment{NeonPink} finish{Luminous}} texture { //used with index 3 pigment { gradient y color_map { [0.00 rgb < 1 , 0 , 0>] [0.33 rgb < 0 , 0 , 1>] [0.66 rgb < 0 , 1 , 0>] [1.00 rgb < 1 , 0 , 0>] } } finish{specular 0.75} scale 8 } } scale 30 translate <-15, -15, 0> }
After a material_map
statement but still inside the texture
statement you may apply any legal texture modifiers.
Note: no other pigment, normal, or finish statements may be added to the texture outside the material map.
The following is illegal:
texture { material_map { gif "matmap.gif" texture {T1} texture {T2} texture {T3} } finish {phong 1.0} }
The finish must be individually added to each texture. Earlier versions of POV-Ray allowed such specifications but they were ignored. The above restrictions on syntax were necessary for various bug fixes. This means some POV-Ray 1.0 scenes using material maps many need minor modifications that cannot be done automatically with the version compatibility mode.
If particular index values are not used in an image then it may be necessary to supply dummy textures. It may be necessary to use a paint program or other utility to examine the map file's palette to determine how to arrange the texture list.
The textures within a material map texture may be layered but material map textures do not work as part of a layered texture. To use a layered texture inside a material map you must declare it as a texture identifier and invoke it in the texture list.
|