Drawing Objects with DirectX Realtime Shaders

All realtime effects require at least one, and often multiple, drawing passes to render the final effect. The output of each pass is brought together using blending, alpha testing, stencil testing, and other such drawing operations.

In the render tree, these draw operations are implemented in different ways:

• If you are building DirectX-based programmable HLSL shaders, you need to first attach a DX Draw shader to the material node of any object for which you want to create realtime shader effects. This node also handles blending, culling, depth testing, and other draw operations, as discussed immediately below in Drawing with DX Draw Nodes.

• If you are building effects with DirectX effects shaders, there is no need to connect a DX Draw shader in the render tree to perform any of these draw functions. The DXFX and DX10FX shaders can reference an FX file that combines everything needed to render a shading effect in a single place. See Effects Shaders (.fx Files).

Drawing with DX Draw Nodes

1. Select the object and open a render tree (press 7).

2. Connect a DXDraw shader to the realtime port of the of the object’s Material node.

 

3. The object now uses the DX Draw shader to draw itself in any 3D views whose display mode is set to Realtime Shaders > DirectX.

4. You can open the DX Draw shader’s property editor in which you can set its properties to control how the object is drawn.

 

5. You can set the following draw properties:

Enable Blending allows you to blend this draw pass with the background. You need to specify how you want the drawing pass to blend with the source and destination parameters. For more information about blending, see Blending with Realtime Shaders.

• The Drawing option specifies whether you want to draw the object as a Wireframe, as Points, or Solid.

• The Shading option specifies whether you want to display the object using Flat, Gouraud, or Phong shading. Most graphics cards do not support Phong.

Culling indicates whether back facing or front facing triangles should be drawn or not.

Depth Testing and Depth Write control how the incoming depth is used against the existing depth in the frame buffer.

- Depth testing controls whether the GPU should test the incoming depth with the destination depth.

- Depth writing controls whether the GPU should update the depth in the test passes.

• The Tangents options are there for legacy purposes and should not be used. If you need tangents, use you can create them by selecting an object and choosing Get > Property > Tangents from any toolbar.



Autodesk Softimage v.7.5