[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

4.5.5 Texture Mapping

type texture ( string texturename[float channel]; ... )

type texture ( string texturename[float channel]; float s, t; ... )
type texture ( string texturename[float channel]; float s1, t1, s2, t2, s3, t3, s4, t4; ... )
Returns a filtered texture value (type can be either a float or a color), at the specified texture coordinates. If no texture coordinates are provided, s and t will be used. An optional channel can be specified to select a starting channel in the texture, this can be useful when a texture contains more that three channels. Use tdlmake to prepare your textures for improved performance and memory usage (see section 3.3 Using the Texture Optimizer - tdlmake). texture() accepts a list of optional parameters as summerized in the table below.

EXAMPLE
 
/* Sharper result (width<1) */
color c = texture( "grid.tdl", s, t, "width", 0.8 );

/* Returns the green component */
float green = texture( "grid.tdl"[1] );

/* Returns the alpha channel, or 1.0 (opaque) if no
   alpha channel is present */
float alpha = texture( "grid.tdl"[3], "fill", 1.0 );

type environment ( string texturename[channel]; vector V; ... )
type environment ( string texturename[channel]; vector V1, V2, V3, V4; ... )
Returns a filtered texture value from an environment map, for some specified direction. As in texture(), an optional channel can be specified to select a starting channel when performing texture lookups. Use tdlmake to prepare cubic and long-lat envmaps. If an unprepared TIFF is given to environment(), it will be considered as a lat-long environment map. environement() recognizes the same list of optional parameters as texture().

EXAMPLE
 
/* Do an env lookup */
normal Nf = faceforward( N, I );
color c = environment( "env.tdl", Nf );

/* Only fetch the alpha channel, if no alpha present, returns 1 */
float red_comp = environment( "env.tdl"[3], Nf, "fill", 1 );

Name Type Default Description
"blur" varying float 0 Specifies an additional area to be added to the texture lookup area in both s and t, expressed in units of texture coordinates (range = [0..1]). A value of 1.0 would request that the entire texture be blurred in the result;
"sblur" varying float 0 Specifies "blur" in s only;
"tblur" varying float 0 Specifies "blur" in t only;
"width" uniform float 1 Multiplies the width of the filtered area in both s and t;
"swidth" uniform float 1 Specifies "width" in s only;
"twidth" uniform float 1 Specifies "width" in t only;
"samples" uniform float 4 Specifies the sampling rate. Only useful for environment(), texture() uses an addaptative sampling algorithm;
"fill" uniform float 0 If a channel is not present in the texture, use this value;
"filter" uniform string "gaussian" Specifies the reconstruction filter to use when accessing the texture map. Supported filters are: `gaussian', `triangle' and `box'.

texture() and environment() optional parameters.

type shadow ( string shadowmap[float channel]; point Pt; ... ) *
type shadow ( string shadowmap[float channel]; point Pt1, Pt2, Pt3, Pt4; ... ) *
Computes occlusion at some point in space using a shadow map or a deep shadow map. Shadow lookups are automatically antialiased. When using deep shadow maps, colored shadows and motion blur will be correclty computed. It is possible to perform a ray traced shadow test by passing a "!" or "shadow". Note that if ray tracing is used, only objects tagged as visible to shadows will be considered (using Attribute "visibility" "transmission", section 4.2 Attributes). Optional parameters to shadow() are described in the table below. For additional information about shadow maps and deep shadow maps refer to section 5.1 Shadows.

Name Type Default Description
"blur" varying float 0 Specifies an additional area to be added to the texture lookup area in both s and t, expressed in units of texture coordinates (range = [0..1]). A value of 1.0 would request that the entire texture be blurred in the result;
"sblur" varying float 0 Specifies "blur" in s only;
"tblur" varying float 0 Specifies "blur" in t only;
"width" uniform float 1.0 Multiplies the width of the filtered area in both s and t;
"swidth" uniform float 1.0 Specifies "width" in s only;
"twidth" uniform float 1.0 Specifies "width" in t only;
"samples" uniform float 16 Specifies the number of samples to use for shadow lookups. This influances the antialis quality. A value of 16 is recommended for shadow maps and, 4 for deep shadow maps;
"bias" varying float 0.225 Used to prevent self-shadowing. If set to 0, the global bias will be used, as specified by Option "shadow" "bias" (see section 4.1 Options);

shadow() optional parameters.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

This document was generated by Aghiles Kheffache on July, 31 2003 using texi2html
3Delight 1.0.0. Copyright 2000-2003 The 3Delight Team. All Rights Reserved.