ATI SDK

ATI Product Information

Support for Alternate OS's

Hardware partners

Software partners

RenderMonkey

Drivers


 
 

Highlights


GPU MeshMapper (V1.0)

GPU PerfStudio (V1.2)

Samples: CrossFire Detect (update)

Samples: PostTonemapResolve

The Compressonator (version 1.41)

GPU Shader Analyzer (V1.42)

RenderMonkey™
(version 1.81) (New)


ATI Compress (version 1.6)

AMD Tootle 2.0 (New)

AMD OpenGL ES 2.0 Emulator (V1.1) (New)

HLSL2GLSL (V0.9)

AMD at GDC 2007

ATI SDK


 
 
ATI Developer - Source Code
 
Using the stencil buffer on the ATI Rage128 and Rage128 Pro with Direct3D

The R128DX7Reflect2 sample program expands on R128DX7Reflect to demonstrate view-dependant attenuation of the reflected objects. It also applies a gloss map to the reflecting surface to vary its reflectivity.

In the physical world, object reflections tend to fall off with distance from the reflecting surface as the view angle relative to the reflecting surface increases towards a perpendicular birds-eye view. As the view angle decreases towards a foreshortened view, reflections increase once again. This reflection fall-off may be modeled by varying the percentage of the reflection drawn with the sine of the view angle and the distance of the object relative to the reflecting surface. Figure 1 shows a nearly perpendicular view of the reflecting surface in R128DX7Reflect2. Notice that the columns in the reflected images fade towards their capitals, which are further away from the reflecting surface than the base of the columns. Figure 2 shows the same scene with view-dependant attenuation disabled.

The fidelity of the reflection effect may be further enhanced by applying a gloss map to simulate the unique reflection properties of the reflecting surface. For example, the reflectivity of marble tends to diminish over rougher regions such as its veins. This can be simulated by attenuating reflections with an alpha channel gloss map matching the base marble texture. Figure 3 shows the marble reflection in R128DX7Reflect2 with gloss mapping enabled. Figure 3 shows the same scene with gloss mapping disabled.
 
Figure 1
Figure 2
Figure 3
Figure 4
 
R128DX7Reflect2 attenuates object reflection by drawing the reflected objects with alpha blending enabled, D3DRENDERSTATE_SRCBLEND set to D3DBLEND_SRCALPHA, and D3DRENDERSTATE_DESTBLEND set to D3DBLEND_INVSRCALPHA. The alpha values are assigned to the diffuse alpha component of the object vertices. The column alphas are assigned once during scene initialization. The cube alphas are updated dynamically as the cube position and therefore its height varies each frame.

Gloss mapping is done by setting D3DRENDERSTATE_SRCBLEND to D3DBLEND_INVDESTCOLOR, D3DRENDERSTATE_DESTBLEND to D3DBLEND_SRCALPHA, and setting D3DTSS_ALPHAOP for the first multi-texture stage to D3DTOP_SELECTARG1 to use the texture's alpha values, which represent the gloss map. If gloss mapping is disabled, D3DRENDERSTATE_DESTBLEND is set to D3DBLEND_ONE.

R128DX7Reflect2 Controls
  • F1 - About
  • F2 - Select Driver/Device/Mode
  • [ALT]+[ENTER] - Toggle fullscreen/windowed
  • [ENTER] - Toggle Go/Stop
  • Space Bar - Single Step
  • Up/Down Arrows - Move camera up/down
  • Left/Right Arrows - Rotate scene left/right
  • S - Toggle use of stencil
  • A - Toggle view-dependant attenuation on/off
  • G - Toggle gloss mapping on/off
  • [ESC] - Quit

Downloads

DirectX 7 project file, source, executable, and support files
 
 
 


 



©2008 Advanced Micro Devices, Inc.    |    Contact AMD    |    Terms and Conditions    |    Privacy    |    Trademark information    |    Site Map