Table of Contents Glide Programming Guide


f * aother SCALE_OTHER_ADD_LOCAL f



Download 6.22 Mb.
Page66/106
Date03.02.2023
Size6.22 Mb.
#60547
1   ...   62   63   64   65   66   67   68   69   ...   106
GLIDEPGM
f * aother

SCALE_OTHER_ADD_LOCAL

f * cother + clocal

f * aother + alocal

SCALE_OTHER_ADD_LOCAL_ALPHA

f * cother + alocal

f * aother + alocal

SCALE_OTHER_MINUS_LOCAL

f * (cotherclocal)

f * (aotheralocal)

SCALE_OTHER_MINUS_LOCAL_ADD_LOCAL
BLEND

f * (cotherclocal) + clocal
º f * cother + (1 – f) * clocal

f * (aotheralocal) + alocal
º f * aother + (1 – f) * alocal

SCALE_OTHER_MINUS_LOCAL_ADD_LOCAL_ALPHA

f * (cotherclocal) + alocal

f * (aotheralocal) + alocal

SCALE_MINUS_LOCAL_ADD_LOCAL
BLEND_LOCAL

f * (– clocal) + clocal
º (1 – f) * clocal

f * (– alocal) + alocal
º (1 – f) * alocal

SCALE_MINUS_LOCAL_ADD_LOCAL_ALPHA

f * (– clocal) + alocal

f * (–alocal) + alocal

  1. Table Texture Mapping.5 Scale factors for texture color generation.

The rgbFactor and alphaFactor arguments to grTexCombine() can take on any of the values listed in the first column. The second and third columns show the scale factor that will be used. clocal and alocal represent the color components generated by indexing and filtering from the mipmap stored on tmu; cother and aother represent the incoming color components from the neighboring TMU (refer to Figure Texture Mapping.1).
If GR_COMBINE_FACTOR_DETAIL_FACTOR or GR_COMBINE_FACTOR_ONE_MINUS_DETAIL_FACTOR is specified, the scale factor employs the detail blend factor, called b in the table. See the discussion of grTexDetailControl() in the next section for more information.
If GR_COMBINE_FACTOR_LOD_FRACTION or GR_COMBINE_FACTOR_ONE_MINUS_LOD_FRACTION is specified, the scale factor employs the fractional part of the computed LOD, called l in the table. See the discussion about computing an LOD earlier in this chapter for more information.

texture combine factor (prefixed with GR_COMBINE_FACTOR_)

scale factor f if specified as rgbFactor

scale factor f if specified as alphaFactor

NONE

unspecified

unspecified

ZERO

0

0

LOCAL

clocal / 255

alocal / 255

OTHER_ALPHA

aother / 255

aother / 255

LOCAL_ALPHA

alocal / 255

alocal / 255

DETAIL_FACTOR

b

b

LOD_FRACTION

l

l

ONE

1

1

ONE_MINUS_LOCAL

1 – clocal / 255

1 – alocal / 255

ONE_MINUS_OTHER_ALPHA

1 – aother / 255

1 – aother / 255

ONE_MINUS_LOCAL_ALPHA

1 – alocal / 255

1 – alocal / 255

ONE_MINUS_DETAIL_FACTOR

1 – b

1 – b

ONE_MINUS_LOD_FRACTION

1 – l

1 – l

13Examples of Configuring the Texture Pipeline


The following code examples illustrate how to configure the texture pipeline for different texture mapping effects. The examples all assume that appropriate textures have been loaded and the addressing mechanism in the TMU points to the right place. This process is described in detail in the next chapter; the examples will be repeated there, with the texture loading segments filled in. The examples also assume that grColorCombine() and/or grAlphaCombine() utilize texture mapping by setting the scale factor to GR_COMBINE_FACTOR_TEXTURE_ALPHA or GR_COMBINE_FACTOR_ONE_MINUS_TEXTURE_ALPHA.
The examples in this chapter attempt to cover most of the texture mapping techniques of interest. Table Texture Mapping.6 shows the principle texture mapping algorithms and describes the implementation in terms of available TMUs. We show examples utilizing one or two TMUs, mipmaps split across two TMUs, and a two-pass application.

  1. Table Texture Mapping.6 The number of TMUs affects texture mapping functionality.

The number of texture mapping units determines the performance of advanced texture mapping rendering. The table below describes the number of passes required to implement the texture mapping techniques supported by the Voodoo Graphics subsystem. Note that in a system with three TMUs, only the most complicated algorithm (trilinear filtering with mipmapping, projected, and detail textures) requires more than one pass.

Texture Mapping

Voodoo Graphics Performance

Functionality

One TMU

Two TMUs

Three TMUs

Point sampling with mipmapping

one pass

one pass

one pass

Bilinear filtering with mipmapping

one pass

one pass

one pass

Bilinear filtering with mipmapping and projected textures

two pass

one pass

one pass

Bilinear filtering with mipmapping and detail textures

two pass

one pass

one pass

Bilinear filtering with mipmapping, projected and detail textures

not supported

two pass

one pass

Trilinear filtering with mipmapping

two pass

one pass

one pass

Trilinear filtering with mipmapping and projected textures

not supported

two pass

one pass

Trilinear filtering with mipmapping and detail textures

not supported

two pass

one pass

Trilinear filtering with mipmapping, projected, and detail textures

not supported

two pass

two pass


1Configuring the Texture Pipeline for Decal Texture Mapping


The simplest texture mapping technique is decal mapping, which applies a texture to a polygon without modification. The first two entries in Table Texture Mapping.6 are decal mapping, differing only in the choice of minification and magnification filters. Decal mapping is a single pass operation on all Voodoo Graphics configurations.
Example Texture Mapping.1 Setting up simple (decal) texture mapping.
The following code sets up the texture pipeline so that a texel is placed into the pixel pipeline without modification. The code assumes that there is a single TMU, that a texture has already been loaded into texture memory with the texture base address pointing to it, and that the color combine unit is configured to use the texture color and/or alpha value.
grTexCombine( GR_TMU0, GR_COMBINE_FUNCTION_LOCAL, GR_COMBINE_FACTOR_NONE,
GR_COMBINE_FUNCTION_LOCAL, GR_COMBINE_FACTOR_NONE,
FXFALSE, FXFALSE );

2Configuring the Texture Pipeline for Projected Texture Mapping


Interesting spotlight effects are possible by multiplying two texture maps against each other. For example, one texture map can be an intensity map (e.g. a spotlight) and the other can be a source texture. Recall that the texture RGBA values from the “upstream” TMU1 become the other input to the “downstream” TMU0. In Example Texture Mapping.2, the spotlight texture is upstream, the source texture is downstream and the resulting RGBAtexture = RGBAspotlight × RGBAsource.
Example Texture Mapping.2 Applying a modulated (projected) texture.
The code segment below assumes that the texture maps have already been loaded: an intensity map for the spotlight in TMU0 and a source texture in TMU1. The resulting texture RGBA is a product of the texels chosen from the two textures. The color combine unit must be configured to use the output from the texture pipeline.
grTexCombine( GR_TMU0,
GR_COMBINE_FUNCTION_SCALE_OTHER, GR_COMBINE_FACTOR_LOCAL,
GR_COMBINE_FUNCTION_SCALE_OTHER, GR_COMBINE_FACTOR_LOCAL,
FXFALSE, FXFALSE );

grTexCombine( GR_TMU1,


GR_COMBINE_FUNCTION_LOCAL, GR_COMBINE_FACTOR_NONE,
GR_COMBINE_FUNCTION_LOCAL, GR_COMBINE_FACTOR_NONE,
FXFALSE, FXFALSE );


Download 6.22 Mb.

Share with your friends:
1   ...   62   63   64   65   66   67   68   69   ...   106




The database is protected by copyright ©ininet.org 2024
send message

    Main page