Setting Up an Assembly Language Pixel Shader

DirectX-based shaders can also be programmed using assembly language. In general, you should use assembly language for very short programs or for programs that require precise control over how registers are assigned, and over the instructions used in your program.

This procedure shows you how to set up a vertex shader on an object using the DXPixelShader node.

1. Open a render tree (press 7) and connect a DX Draw shader (Nodes > RealTime > DirectX > More...) to the realtime port of the object’s Material node.

 

2. The next step is to get a DX Pixel Shader node (Nodes > RealTime > DirectX > More...).

3. For this example, you should also get a DX Color (PS) shader (Nodes > RealTime > DirectX > More...) to set a constant register with the color value.

4. Connect the shaders as shown in the following image:

 

5. You can now open the DX Pixel Shader’s property editor and start typing your code. But first, take a look at the property page:

 

• The Build options allow you to do any one of the following:

- Disable the DX Program.

- Compile the program without executing it.

- Compile and execute the program.

• You can see compilation results from the script editor log window.

In the property editor shown above, the parameters were set as follows:

• A program was typed in the text box.

• The Build option was set to Compile and execute.

• The Profile was set to Pixel Shader 1.4.

Setting Pixel Shader Parameters

Now that you have your program code written, you have to set the values for the uniform parameters. You can only set constant register values with the DX Color (PS) shader node.

Texture Map Relationships

Texture shaders should be bound to target IDs according to the order in which they are executed in the pixel shader.



Autodesk Softimage v.7.5