Effects

DirectX8

Microsoft DirectX 8.1 (C++)

Effects

Microsoft® Direct3D® provides a rich feature set for creating complex and visually realistic three-dimensional (3-D) scenes. Effect files help you write an application that uses all the rendering capabilities for the hardware on which it runs. Effects are a collection of different rendering techniques that can fit onto a variety of hardware devices.

For example, to create a realistic rippled pond of water that reflects light as shown in the following image, you begin with the first technique that renders the water, adds specular highlights, adds caustic textures, and applies light to the water in a single pass. If your hardware cannot render this technique in a single pass, a second technique might render the water, add specular highlights or caustic textures, but not apply light to the water.

Before you use a technique, you can validate it using Direct3D to see if it is supported by the current hardware configuration.

Effects are defined in an effect file. An effect file consists of one or more techniques. Each technique consists of one or more passes. These files are text based and can be changed without recompiling the source application. This enables you to program games that make optimum use of video card functionality. Effect files also make it easy to upgrade an existing game to run on newer video cards as additional features are developed.

The following topics discuss effects and how you can use them in your application.

Exercises*

*From the DirectX Meltdown 2001 conference, Programmable Shader workshop.

  • Exercise 1 - Fixed Function Diffuse Lighting and Vertex Shader Diffuse Lighting.
  • Exercise 2 - Vertex Shader Diffuse Lighting. Light the model, taking both diffuse material and a diffuse light source into consideration.
  • Exercise 3 - Transforms. Transform the vertex normal into world space to take light source movement into consideration.
  • Exercise 4 - Texturing. Set up texture to pass onto FF PS Modulate between the texture and diffuse color arguments.
  • Exercise 5 - Vertex Shader Specular Lighting.
  • Exercise 6 - Standard Texture Effect.
  • Exercise 7 - Multi-Texturing with Shaders.
  • Exercise 8 - Texturing with Lights.
  • Exercise 9 - Dot 3 Bump Mapping, Dot 3 Specular Bump Mapping, and Table Lookup Specular Bump Mapping.
  • Exercise 10 - Anisotropic Bump Mapping.
  • Exercise 11 - Area Lighting, Area and Diffuse Lighting.

For more information about effect files, see Effect File Format.