|
This sample application illustrates
the use of the DirectX® 9 High Level Shading Language
through the D3DX Effects framework.
For a detailed look at HLSL and some of the effects
shown in this sample, be sure to tune in live for the
NetSeminar "High
Level Shading with DirectX® 9 on the ATI Radeon® 9700"
on 11 December 2002 at 11am Pacific time. This
event will also be archived for six months so that you
can tune in at a later date.
All of the techniques used by this application are
kept in a single file: HLSL_FX.fxl. There are
several techniques (such as asm_wood and hlsl_wood) which are implemented in both
assembly language and high level shading language.
These can be useful for comparative purposes and also
to show how to utilize a mix of assembly and HLSL shaders
in the same effect file. Several other effects
such as hlsl_velvet,
hlsl_bluemarble
and hlsl_gooch are implemented as HLSL-only
effects and were ported to DirectX® 9 HLSL from publicly
available RenderMan surface shaders.
One lesser-known feature of the HLSL that many developers
have asked about is the ability to bind a particular
high-level constant to a specific hardware constant
register. This is illustrated in the HLSL_FX effect
file by the following code:
VECTOR lightWood : register (c2); //
xyz == Light Wood Color, w == ringFreq
VECTOR darkWood
: register (c3); // xyz == Dark Wood Color, w == noise amplitude
VECTOR g_Leye
: register (c4); // xyz ==
L_eye, w == trunkWobbleAmplitude
This results in the lightWood
variable being bound to hardware constant register c2, the darkWood variable being bound to hardware constant register
c3
and the g_Leye variable being bound to hardware
constant register c4.
This is not strictly necessary but can be nice when
an application uses a set of constants over and over
and wishes to minimize resetting constants between shader/effect/technique
changes.
|