Fixed Function Example: A Reflective Textured Sphere

This example shows you how to use multi-texturing, fixed function shading, and texture coordinate generation realtime shaders to create a reflective textured sphere.

1. In any viewport’s Views menu, choose Realtime Shaders > DirectX9. This allows you to view the realtime shader effect you’re about to create.

2. Choose Get > Primitive > Sphere from any toolbar.

3. With the sphere selected, choose Get > Material > Phong from the Render toolbar.

4. Press 7 to open the object’s render tree.

5. Select and delete the Phong node.

Draw the object

6. From the render tree menu, choose Nodes > RealTime > DirectX > More... to select a DX Draw node from the browser window.

7. Connect the DX Draw node to the Material node’s Realtime port.

 

Shade the object

8. From the render tree menu, choose Nodes > RealTime > DirectX > More... to select a DX Shade node from the browser window.

9. Connect the DX Shade node to the DX Draw node’s previous port.

 

10. Double-click the DX Shade node to open its property editor and adjust the properties in the Colors section as needed (see Fixed Function DirectX Shading).

Texture the object

11. From the render tree menu, choose Nodes > RealTime > DirectX > More... to select a DX Texture node from the browser window.

12. Connect the DX Texture node to the DX Shade node’s previous port.

 

13. Double-click the DX Texture node to open its property editor and adjust the properties as follows:

- Set the target to 0 because you want to apply this texture right after the object has been shaded.

- Choose a texture image to use and a texture projection for it.

 

Add a reflection map

14. From the render tree menu, choose Nodes > RealTime > DirectX > More... to select a DX Texture Transform node from a browser window.

15. Connect the DX Texture Transform node to the DX Texture node’s previous port.

16. From the render tree menu, choose Nodes > RealTime > DirectX > More... to select a DX Texture node from a browser window.

17. Connect the new DX Texture node to the DX Texture Transform node’s previous port.

The render tree should now look something like this:

 

18. Double-click the new DX Texture node to open its property editor and adjust the properties as follows:

- Set the target to 1 because you want to apply this texture after the one you already set.

- Choose a texture image to use as the reflection map.

You don’t need to set a texture projection since the texture coordinates will be generated by the DX Texture Transform node.

 

19. Double-click the DX Texture Transform node to open its property editor and adjust the properties as follows:

- Set the target to 1 to generate texture coordinates for the reflection map, which is also set in target 1.

- Set the Type of texture coordinates to Reflection vector in camera space.

- Set the number of Components to 2D to generate U and V coordinates.

- Now you can see that the texture needs some adjustment. Set the Scaling and Translation X and Y values to 0.5.

 

And presto! You have a reflective textured material.



Autodesk Softimage v.7.5