fbe University of New South Wales Sydney Australia UNSW
Faculty of the Built Environment search

8 - Texturing

8.1 Texturing Functions
8.2 Image Texturing
8.3 Mapping Functions


Textures are used to modify the appearance of an object through the use of procedural functions. A texture may modify any surface characteristic, such as diffuse color, reflectivity, or transparency, or it may modify the surface normal ("bump mapping") in order to give the appearance of a rough surface.

Any number of textures may be associated with an object. If more than one texture is specified, they are applied in the order given. This allows one to compose texturing functions and create, for example a tiled marble ground plane using the checker and marble textures.

Textures are associated with objects by following the object specification by a number of lines of the form:

    texture name <Texturing Arguments> [Transformations]
Transformations may be applied to the texture in order to, for example, shrink or grow feature size, change the orientation of features, and change the position of features.

Several of the texturing functions take the name of a colormap as an argument. A colormap is 256-line ASCII file, with each line containing three space-separated values ranging from 0 to 255. Each line gives the red, green, and blue values for a single entry in the colormap.


8.1 Texturing Functions

blotch BlendFactor surface
Produces a mildly interesting blotchy-looking surface. BlendFactor is used to control the interpolation between the default surface characteristics and the characteristics of the given surface. A value of 0 results in a roughly 50-50 mix of the two surfaces. Higher values result in a great portion of the default surface characteristics.

bump scale
Apply a random bump map. The point of intersection is passed to DNoise(). The returned normalized vector is weighted by scale and the result is added to the normal vector at the point of intersection.

Using an image texture applied to the "bump" component offers a more direct way to control the modification of surface normnals (see below).

checker <Surface>
Applies a 3D checkerboard texture. Every point that falls within an "even" unit cube will be assigned the characteristics of the named surface applied to it, while points that fall within "odd" cubes will have its usual surface characteristics. Be wary of strange effects due to roundoff error that occur when a planar checkered surface lies in a plane of constant integral value (e.g., z = 0) in texture space. In such cases, simply translate the texture to ensure that the planar surface is not coincident with an integral plane in texture space (e.g., translate 0 0 0.1).

cloud scale H L octaves cthresh lthresh tscale
This texture is a variant on Geoff Gardner's ellipsoid-texturing algorithm. It should be applied to unit spheres centered at the origin. These spheres may, of course, be transformed at will to form the appropriately-shaped cloud or tree.

A sample of normalized fBm (see the fbm texture) is generated at the point of intersection. This sample is used to modulate the surface transparency. The final transparency is a function of the sample value, the proximity of the point of intersection to the edge of the sphere (as seen from the ray origin), and three parameters to control the overall "density." The proximity of the point to the sphere edge is determined by evaluating a limb function, which varies from 0 on the limb to 1 at the center of the sphere.
                          fBm - cthresh - (lthresh - cthresh)(1 - limb)
        transp =  1.  -   ---------------------------------------------
                                             tscale
fbm offset scale H L octaves thresh [colormap]
Generate a sample of discretized fractional Brownian motion and uses it to scale the diffuse and ambient component of an object's surface. Scale is used to scale the value returned by the fBm function. Offset allows one to control the minimum value of the fBm function. H is the Holder exponent used in the fBm function (a value of 0.5 works well). L is used to control lacunarity, and specifies the frequency difference between successive samples of the fBm basis function (a value of 2.0 will suffice). Octaves specifies the number of octaves (samples) to take of the fBm basis function (in this case, Noise()). Between five and seven octaves usually works well. Thresh is used to specify a lower bound on the output of the fBm function. Any value lower than thresh is set to zero.

If a colormap is named, a 256-entry colormap is read from the named file, and the sample of fBm is scaled by 255 and is used as an index into the colormap. The resulting colormap entry is used to scale the ambient and diffuse components of the object's surface.

fbmbump offset scale H L octaves
Similar to the fbm texture. Rather than modifying the color of a surface, this texture acts as a bump map.

gloss glossiness
Gives reflective surfaces a glossy appearance. This texture perturbs the object's surface normal such that the normal "samples" a cone of unit height with radius 1. - glossiness. A value of 1 results in perfect mirror-like reflections, while a value of 0 results in extremely fuzzy reflections. For best results, jittered sampling should be used to render scenes that make use of this texture.

marble [colormap]
Gives a surface a marble-like appearance. The texture is implemented as roughly parallel alternating veins of marble, each of which is separated by 1/7 of a unit and runs perpendicular to the Z axis. If a colormap is named, the surface's ambient and diffuse colors will be scaled using the RGB values in the colormap. If no colormap is given, the diffuse and ambient components are simply scaled by the value of the marble function. One may transform the texture to control the density and orientation of the marble veins.

sky scale H L octaves cthresh lthresh
Similar to the fbm texture. Rather than modifying the color of a surface, this texture modulates its transparency. cthresh is the value of the fBm function above which the surface is totally opaque. Below lthresh, the surface is totally transparent.

stripe <Surface< size bump <Mapping>
Apply a "raised" stripe pattern to the surface. The surface properties used to color the stripe are those of the given surface. The width of the stripe, as compared to the unit interval, is given by size. The magnitude of bump controls the extent to which the bump appears to be displaced from the rest of the surface. If negative, the stripe will appear to sink into the surface; if positive, it will appear to stand out of the surface.

wood
Gives a surface a wood-like appearance. The feature size of this texture is approximately 0.01 of a unit, making it often necessary to scale the texture in order to achieve the desired appearance.


8.2 Image Texturing

Rayshade also supports an image texture. This texture allows you to use images to modify the characteristics of a surface. You can use three-channel images to modify the any or all of the ambient, diffuse, and specular colors of a surface. If you are using the Utah Raster Toolkit, you can also use single-channel images to modify surface reflectance, transparency, and the specular exponent. You can also use a single-channel image to apply a bump map to a surface.

In all but the bump-mapping case, a component is modified by multiplying the given value by the value computed by the texturing function. When using the Utah Raster Toolkit, surface characteristics are modified in proportion to the value of the alpha channel in the image. If there is no alpha channel, or you are not using the Utah Raster Toolkit, alpha is assumed to be everywhere equal to 1.

component <Component>
The named component will be modified.

Possible surface components are:
             ambient   modify ambient color,
             diffuse   modify diffuse color,
             specular  modify specular color,
             specpow   modify specular exponent,
             reflect   modify reflectivity,
             transp    modify transparency,
             bump      modify surface normal.
The specpow, reflect, transp, and bump components require the use of a single-channel image.

range high low
Specify the range of values to which the values in the image should be mapped. A value of 1 will be mapped high, 0 to low. Intermediate values will be linearly interpolated.

smooth
When given, pixel averaging will be performed in order to smooth the sampled image. If not specified, no averaging will occur.

textsurf <Surface Specification>
For use when modifying surface colors, this keyword specifies that the given surface should be used as the base to be modified when the alpha value in the image is non-zero. When alpha is zero, the object's unmodified default surface characteristics are retained.

The usual behavior is for the object's default surface properties to be used.

tile un vn
Specify how the image should be tiled (repeated) along the u and v axes. If positive, the value of un gives the number of times the image should be repeated along the u axis, starting from the origin of the texture, and positive vn gives the number of times it should be repeated along the v axis. If either value is zero, the image is repeated infinitely along the appropriate axis.

Tiling is usually only a concern when planar mapping is being used, though it may also be used if image textures are being scaled. By default un and vn are both zero.

A mapping function may also be associated with an image texture.


8.3 Mapping Functions

Mapping functions are used to apply two-dimensional textures to surfaces. Each mapping functions defines a different method of transforming a three dimensional point of intersection to a two dimensional u - v pair termed texturing coordinates. Typically, the arguments to a mapping method define a center of a projection and two non-parallel axes that define a local coordinate system.

The default mapping method is termed u - v mapping or inverse mapping. Normally, there is a different inverse mapping method for each primitive type (see chapter 5). When inverse mapping is used, the point of intersection is passed to the uv method for the primitive that was hit.

map uv
Use the uv (inverse mapping) method associated with the object that was intersected in order to map from 3D to determine texturing coordinates. The inverse mapping method for each primitive is described in chapter 5.

map planar [origin» vaxis» uaxis»]
Use a linear mapping method. The 2D texture is transformed so that its u axis is given by uaxis» and its v axis by vaxis». The texture is projected along the vector defined by the cross product of the u and v axes, with the (0,0) in texture space mapped to origin».

map cylindrical [origin» vaxis» uaxis»]
Use a cylindrical mapping method. The point of intersection is projected onto an imaginary cylinder, and the location of the projected point is used to determine the texture coordinates. If given, origin» and vaxis» define the cylinder's axis, and uaxis» defines where u = 0 is located.

See the description of the inverse mapping method for the cylinder in chapter 5. By default, the point of intersection is projected onto a cylinder that runs through the origin along the z axis, with uaxis» equal to the x axis.

map spherical [origin» vaxis» uaxis»]
Use a spherical mapping method. The intersection point is projected onto an imaginary sphere, and the location of the projected point is used to determine the texturing coordinates in a manner identical to that used in the inverse mapping method for the sphere primitive. If given, the center of the projection is origin», vaxis» defines the sphere axis, and the point where the non-parallel uaxis» intersects the sphere defines where u = 0 is located.

By default, a spherical mapping projects points towards the origin, with vaxis» defined to be the z axis and uaxis» defined to be the x axis.

Go to the next section Appendix A - Options
Go to the Contents