Related topics include:
For an overview and a list of lookup tables, see Lookup Tables.
Each entry of a texture mapping table binds a set of attributes to a referenced texture map resource. The same texture map resource may be referenced by multiple texture mapping table entries.
--------------------------------------------------------------------------------------------------------------------- Table Value Description Fallback PEX Mask --------------------------------------------------------------------------------------------------------------------- PEXLUTVTMIDs 5.2 number of resources (n) 0 unused list of texture map resources PEXLUTVTMRenderingControl 5.2 rendering control PEXTMRCPostLight PEXLUTVTMParameterizationMethod 5.2 parameterization method PEXTMPMReflectionSphereVRC PEXLUTVTMFPDataIndex(a) 5.2 floating-point data index 0 PEXLUTVTMReflectionMatrix(b) 5.2 reflection matrix Identity reflection matrix hints Identity PEXLUTVTMOrientationMatrix 5.2 orientation matrix Identity orientation matrix hints Identity PEXLUTVTMCompositionMethod 5.2 composition method PEXTMCMReplace PEXLUTVTMChannelSelector(c) 5.2 channel selector PEXTMChannelRed PEXLUTVTMEnvironmentColor(d) 5.2 environment color {PEXColorTypeRGB, (0.0, 0.0, 0.0)} PEXLUTVTMBackgroundColor(e) 5.2 background color {PEXColorTypeRGB, (0.0, 0.0, 0.0)} PEXLUTVTMSampleMethod 5.2 minification sample method PEXTMSMSingleBase magnification sample method PEXTMSMSingleBase PEXLUTVTMBoundaryConditions 5.2 t0 boundary condition PEXTMBCWrap t1 boundary condition PEXTMBCWrap t2 boundary condition PEXTMBCWrap unused PEXLUTVTMClampMethod(f) 5.2 boundary clamp method PEXTMBCMDiscontinue PEXLUTVTMClampColor(g) 5.2 boundary clamp color {PEXColorTypeRGB, (0.0, 0.0, 0.0)} PEXLUTVTMSamplingHints 5.2 depth sampling bias hint 0.0 t0 frequency hint 1.0 t1 frequency hint 1.0 t2 frequency hint 1.0 PEXLUTVTMAll5_2 (selects entire table entry) 5.2 ---------------------------------------------------------------------------------------------------------------------
Related topics include:
The texture mapping table is accessed when rendering surface primitives if the pipeline state's interior style is PEXInteriorStyleTexture and the pipeline state's active textures field is non-empty. If the pipeline state's facet distinguish flag is True, then the implementation accesses the texture mapping table when rendering back-facing facets if the pipeline state's bf interior style is PEXInteriorStyleTexture and the pipeline state's bf active textures field is non-empty. The active textures lists select entries of the texture mapping table which each represent a texture map and an associated set of attributes. If the number of entries in the active textures list exceeds the maximum number of texture maps which can be applied to a single facet, then the implementation ignores the texture maps beyond the first MaxTextureMaps indices. Invoke request PEXGetImpDepConstants to inquire MaxTextureMaps. If the active textures list is empty, then the default table values are used to apply the single default texture map.
Not every texture map applies all of the texture mapping table fields. The descriptions of the values below indicate if, and how, the values are applied to the texture map.
Texture mapping table value texture map ids is used to reference the texture map resources which define the texture map. Texture map resources are discussed in Texture Mapping. The number of texture map resources needed to define a single texture map is determined by the texture mapping table's parameterization method field. All currently defined parameterization methods use a single texture map resource to define a texture map.
If the texture map ids fallback (an empty list) is used, then the implementation uses the default texture map; a black and white checkerboard of 8x8 squares. The checkerboard is defined by a 2D array of 16x16 texels, with each square defined by 2x2 texels. The square at t0=t1=0.0 is white.
Related topics include:
The parameterization attributes control how the texture map coordinates are derived. There are texture map coordinates associated with each point on the surface for which a texture map value is sampled. They are used to select the point within the texture map which is sampled. There is one texture map coordinate for each dimension of the texture map. For example, three texture map coordinates, represented as (t0, t1, t2), are used to sample a 3D texture map. The texture coordinates are normalized, that is, they range from 0.0 to 1.0 across the texture map.
The spheres have fixed orientations. The position of the reflection vectors relative to these orientations may be modified through the multiplication of the reflection vectors by the reflection matrix from the texture mapping lookup table. The reflection vectors are always multiplied by the reflection matrix before the reflection is performed. For best results, the reflection transformation should utilize only rotations. The reflection matrix hints provide an opportunity for optimizing this transformation. See PEXOCCSetGlobalTransform for an explanation of matrix hints.
If the primitive is not a non-uniform b-spline surface, then the texture map coordinates are set to: t0 = t1 = t2 = 0.0.
t0 = vertex_fp_data[fp data index] t1 = vertex_fp_data[fp data index + 1] (if 2D map) t2 = vertex_fp_data[fp data index + 2] (if 3D map)
If the primitive is a non-uniform b-spline surface, then the values are obtained from the spline's data splines:
t0 = first value of the data spline selected by the fp data index t1 = first value of the data spline selected by fp data index + 1 t2 = first value of the data spline selected by fp data index + 2
If the number of floating-point data values is insufficient for the dimension of the texture map, then the texture coordinate values used are implementation-dependent.
The reflection vector is calculated as follows:
where s is the reflection vector, n is the vertex normal (explicit or calculated), and i is the unit vector from the eyepoint (computed as described in View Table) to the vertex. This calculation is performed in VRC space, after the vertex and its normal have been transformed to VRC space. After this, the texture coordinates are derived as follows:
where:
The reflection vector is calculated as follows:
where s is the reflection vector, n is the vertex normal (explicit or calculated), and i is the unit vector from the eyepoint (computed as described in View Table to the vertex. This calculation is performed in WC space, after the vertex and its normal have been transformed to WC space. This parameterization method is primarily intended for use with a perspective, as opposed to orthogonal, view projection. After the reflection vector is calculated, the texture coordinates are derived as follows.
Related topics include:
Once the texture map coordinates are determined, independent of which parameterization method was used, they are transformed by the orientation matrix field of the texture mapping table. The orientation matrix hints provide an opportunity to optimize the transformation. See PEXOCCSetGlobalTransform for an explanation of matrix hints. The orientation transformation occurs before any interpolation of the texture map coordinates across the facet that may be required before the coordinates are used to sample the texture map. If the projection is perspective, then the interpolated texture map coordinates are also adjusted according to the pipeline state's tm perspective correction before the sampling is done. The following provides a graphical description of parameterization.
Related topics include:
The currently defined composition attributes control how the texture map color interacts with the primitive's color to determine the primitive's color after the texture map is applied.
The texture mapping table composition method value specifies how the texture map is blended with the primitive's existing data. The currently defined composition methods assume:
For each composition method, equations are given. The equations given are for the input into each texture map i and show the Cout and Aout for each texture map i. The output of each texture map i becomes the input of the next texture map i+1. The final output of the texture mapping stage is the output of texture map n, where there are n texture maps active for the stage. In some PreLight rendering control cases there are additional values used as input into each texture map i (e.g., CW) and used as output from the texture mapping stage (e.g., CS). The following table defines the symbols used to define the composition methods.
Symbols Used in Defining the Composition Methods -------------------------------------------------------------------------------------------------------------- Symbol Description -------------------------------------------------------------------------------------------------------------- in Primitive color components input into texture i of a texture mapping stage. out Primitive color components output from texture i of a texture mapping stage. R The red component. B The blue component. G The green component. C R, G, and B considered together. A The alpha component. L The luminance component. CW A portion of primitive color input into the PreLight texture mapping stage. CW is derived in the pre ceding lighting stage by applying ambient and diffuse terms of the reflectance equation assuming the primitive's color is white. The same value of CW is input into each texture i of the texture mapping stage; it is not modified by texture mapping. CD Another portion of primitive color input into the PreLight texture mapping stage. CD is the ambient and diffuse components of color derived in the preceding lighting stage by applying the reflectance equation using the primitive's color (as opposed to assuming the primitive is white). CS A third portion of primitive color input into the PreLight texture mapping stage. CS is the specular component of color derived in the preceding lighting stage by applying the ambient and diffuse terms of the reflectance equation using the primitive's color (as opposed to assuming the primitive is white). CS is not affected by the texture mapping stage. It is combined with the CD output from the texture mapping stage to form the RGB components of the primitive color output from the texture mapping stage. CT R, G, and B of the texture map color considered together. If the texels have a luminance component instead of RGB components, (fig)l AT The alpha component of the texture map color. CE When the composition method is BlendEnvColor, CE is taken from the environment color field of the texture mapping lookup table. CB When the composition method is DecalBackground, CB is taken from the background color field of the texture mapping lookup table. Γ When the composition method is Decal, Γ is taken from the texture map color. For texels defined with RGB or RGBA components: if the texture mapping lookup table's channel number is TMChannelRed, (fig); if channel number is TMChannelGreen, (fig); if channel number is TMChannelBlue, (fig), and if there is an alpha component and channel number is TMChannelAlpha, (fig). For texels defined with a luminance component: (fig) The channel number constants are defined in Channel Selection Constant Values --------------------------------------------------------------------------------------------------------------
PEXlib defines the following composition methods:
Composition Method Replace ----------------------------------------------------------------------------- Texel Rendering Control Interpolation Sample Cout Aout Components Method Frequency ----------------------------------------------------------------------------- RGB, L PreLight None, Color pixel (fig) and Cs (fig) None, Color InterpDep (fig) (fig) DotProduct, (any) Normal PostLight (any) (any) RGBA, LA PreLight None, Color pixel (fig) and Cs (fig) None, Color InterpDep (fig) (fig) DotProduct, (any) Normal PostLight (any) (any) -----------------------------------------------------------------------------
Composition Method Modulate ----------------------------------------------------------------------------- Texel Rendering Control Interpolation Sample Cout Aout Components Method Frequency ----------------------------------------------------------------------------- RGB, L PreLight None, Color pixel (fig) and Cs (fig) None, Color InterpDep (fig) (fig) DotProduct, (any) Normal PostLight (any) (any) RGBA, LA PreLight None, Color pixel (fig) and Cs (fig) None, Color InterpDep (fig) (fig) DotProduct, (any) Normal PostLight (any) (any) -----------------------------------------------------------------------------
Composition Method BlendEnvColor --------------------------------------------------------------------------- Texel Rendering Control Interpolation Sample Cout Aout Components Method Frequency --------------------------------------------------------------------------- RGB, L PreLight None, Color pixel (fig) and (fig) Cs None, Color InterpDep (fig) (fig) DotProduct, (any) Normal PostLight (any) (any) RGBA, LA PreLight None, Color pixel (fig) and (fig) Cs None, Color InterpDep (fig) (fig) DotProduct, (any) Normal PostLight (any) (any) ---------------------------------------------------------------------------
Composition Method Decal ----------------------------------------------------------------------------- Texel Rendering Control Interpolation Sample Cout Aout Components Method Frequency ----------------------------------------------------------------------------- RGB, L PreLight None, Color pixel (fig) and Cs (fig) None, Color InterpDep (fig) (fig) DotProduct, (any) Normal PostLight (any) (any) RGBA, LA PreLight None, Color pixel (fig) (fig) and Cs None, Color InterpDep (fig) (fig) DotProduct, (any) Normal PostLight (any) (any) -----------------------------------------------------------------------------
Composition Method DecalBackground ----------------------------------------------------------------------------- Texel Rendering Control Interpolation Sample Cout Aout Components Method Frequency ----------------------------------------------------------------------------- RGB, L PreLight None, Color pixel (fig) and Cs (fig) None, Color InterpDep (fig) (fig) DotProduct, (any) Normal PostLight (any) (any) RGBA, LA PreLight None, Color pixel (fig) (fig) and Cs None, Color InterpDep (fig) (fig) DotProduct, (any) Normal PostLight (any) (any) -----------------------------------------------------------------------------
Related topics include:
PEXlib defines the following channel selectors:
Related topics include:
The sampling attributes are used to determine how a texture map color is derived when the texture map is sampled.
Related topics include:
The sample min and mag field of the texture mapping table defines the minification and magnification sample methods. These methods specify how texels are sampled from the texture map and mapped to primitive pixels when the area covered by a texel and pixel differ.
In the case of a pixel overlapping more than one texture map texel, the texture minification method indicates how the sample value is derived for that pixel.
In the case of a pixel overlapping less than one texture map texel, the texture magnification method indicates how the sample value is derived for that pixel.
PEXlib defines the following sample methods:
Related topics include:
The boundary conditions field of the texture mapping table specifies the texturing to be applied to the primitive when the texture coordinates (t0, t1, t2) select a point beyond a boundary of the texture map. That is, the calculated texture coordinates are outside the range [0.0,1.0]. The boundary condition in each direction is independently controlled.
PEXlib defines the following boundary conditions:
Related topics include:
The clamping method field of the texture mapping table specifies whether to discontinue texturing or to use an explicit color when boundary condition ClampExplicitMethod is selected. Although these are seemingly really additional boundary conditions, they are controlled through a separate field of the texture mapping table by design. With this level of direction, it is always clear what the behavior should be when a location is beyond the texture map in more than one direction, even if the boundary conditions for those directions differ.
PEXlib defines the following boundary clamp methods:
Related topics include:
Use the texture mapping table sampling hints value to adjust the selected sampling location. The depth bias hint is used to adjust the sampling depth. A bias of -1.0 moves the sampling depth one level toward the texture map's base level, effectively making the texturing more detailed, or jaggy, than it would otherwise have been. A bias of 2.0, for example, moves the sampling depth away from the texture map's base level by two levels, effectively blurring the texturing. The following are the suggested formulae for implementations; PEX implementations may use other formulae which produce a similar effect.
The extension of the suggested formulae to three-dimensional texture maps is left unspecified.
The suggested depth bias formulae utilize the frequency hints. There is a frequency hint corresponding to each direction of the texture map. A frequency hint is set to something less than 1.0, but greater than 0.0, if blurring in that direction would be unacceptably high due to low spatial frequency. A value of 1.0 for the corresponding texture map coordinate's frequency hint indicates the spatial frequency isn't high. If the spatial frequency of the texture map data is unknown, then it is best to set the values to 1.0.
Inquire TMSamplingHintsUsed with request PEXGetImpDepConstants to determine if the sampling hints are used.
For general information about texture mapping lookup tables, see Texture Mapping Table.
The superseded requests PEXSetTableEntries, PEXGetTableEntries, PEXGetTableEntry, and PEXGetPredefinedEntries do not operate on texture mapping tables.
Valid texture mapping table indices are in the range [1, 65535]. The fallback entry is entry 1.