次の方法で共有


What Is a Programmable Effect?

A programmable effect is a general purpose rendering effect designed for Windows and Xbox 360 (not Windows Phone). A programmable effect is created from vertex and pixel shaders written in the High-Level Shading Language (HLSL) and is completely customizable.

A vertex shader initializes the per-vertex processing of the graphics pipeline and a pixel shader initializes the per-pixel processing of the pipeline. Combining a vertex shader and a pixel shader in a programmable effect gives you tremendous flexibility over the way the pipeline processes your data. Use a programmable effect in a game designed for the Reach or HiDef profile.

Here is an idea of the steps involved with getting a programmable effect up and running.

  • Design the shaders by using HLSL. An effect usually contains one vertex and one pixel shader.
  • Create a technique that invokes the shaders; a technique determines which shaders are used. The technique and the shaders are usually stored in an effect (.fx) file.
  • Create an effect object in your game by using the Effect class. This usually means loading the effect file with the Content Pipeline which is illustrated in Creating a Custom Effect.
  • Initialize the effect parameters. This usually includes parameters for matrix transformations and one or more textures but could include any other custom parameters you have added to the effect. For an example, see Creating a Custom Effect with Texturing.
  • Render the effect by applying the effect to the device and rendering the scene. This is also illustrated in Creating a Custom Effect.

There are many examples that use custom effects in the education catalog on the .

See Also

What Is a Configurable Effect?