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 R128DX7StenFX sample program shows how the stencil buffer may be used to dissolve from one frame into another using different dissolve patterns. Three different dissolve patterns are demonstrated: random noise, a tiled pattern, and a plasma image. Figure 1 shows R128DX7StenFX doing a dissolve using the plasma pattern.

R128DX7StenFX demonstrates two ways to perform the dissolve. The first is to only draw the second frame inside the dissolve loop, slowly building it up over the first frame with each iteration of the loop. The second draws both the initial and final frames within the dissolve loop, setting complementary stencil compare functions for each. The former is faster, but can produce inaccurate results under certain circumstances. For example, if the dissolve pattern is changed part way through the dissolve sequence, artifacts from the former pattern will appear during the rest of the dissolve. In the file R128DX7StenFX.cpp, the DRAW_SECOND_FRAME_ONLY macro causes the first dissolve method to be executed. Disable this macro to perform the second dissolve method.
 
Figure 1
 
R128DX7StenFX works as follows:

If DRAW_SECOND_FRAME_ONLY is defined:
  • Fill the stencil buffer with the desired dissolve pattern.
  • Set the stencil buffer to keep existing values on stencil pass.
  • Set the stencil function to D3DCMP_ALWAYS and draw the first frame.
  • Set the stencil function to D3DCMP_GREATEREQUAL before starting the dissolve sequence.
  • Dissolve sequence: loop from 0 to 255 in the desired step.
  • During each loop iteration, set the stencil reference to the loop counter, draw the second frame, and swap the drawing buffers.
If DRAW_SECOND_FRAME_ONLY is not defined:
  • Fill the stencil buffer with the desired dissolve pattern.
  • Set the stencil buffer to keep existing values on stencil pass.
  • Dissolve sequence: loop from 0 to 255 in the desired step.
  • At the start of each loop iteration, set the stencil reference to the loop counter.
  • Set the stencil function to D3DCMP_LESS and draw the first still frame.
  • Set the stencil function to D3DCMP_GREATEREQUAL and draw the second still frame.
  • Swap the front and back buffers. NOTE: Do NOT clear the stencil buffer at the start of each new frame.

R128DX7StenFX Controls
  • F1 - About
  • F2 - Select Driver/Device/Mode
  • [ALT]+[ENTER] - Toggle fullscreen/windowed
  • [ENTER] - Toggle Go/Stop
  • Space Bar - Single Step
  • D - Initiate scene dissolve
  • C - Cycle through dissolve patterns
  • [ESC] - Quit

Downloads

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


 



©2009 Advanced Micro Devices, Inc.  |  Contact AMD  |  Careers  |  RSS Feeds  |  Terms and Conditions  |  Privacy  |  Trademark information  |  Site Map