vertex shaders vs Fixed Function questions

Started by
4 comments, last by Merick 21 years, 9 months ago
ok ..... i understand what shaders are (wont pretend i know how to use them or program them yet lol) but what im still trying to understand... is ... what d3ddevice function calls no longer have any meaning when using shaders? .... for example.... i think... if you''re using a vertex shader... calls to SetLight are pointless.. because thats only to set the lights when using a fixed function vertex shader right? or can SetLight still be used?? If so ... does this automatically set some vertex shader constants?? what about SetMaterial?? ... or SetTransform? Can these still be used with a custom vertex shader?? if so, what constant registers will they fill their information with?? If not, what functions can''t be used with custom vertex shaders??
-----BEGIN PGP SIGNATURE-----iQA/AwUBOwgpXBtK1gxlCl8XEQIZDACeOhJi6KLEz+rHAI4PiXt9Nw/qFswAoPigEJoSGWopzBZ6V2H1zLECKT8T=CImp-----END PGP SIGNATURE-----
Advertisement
In a shader, the DX lights don''t have any effect. All lighting effects are controlled by the shader. The same is true for transforms.

Other settings do have an effect, including some of the texture stage states and render states. The documentation talks about which states affect shaders and which do not.
Author, "Real Time Rendering Tricks and Techniques in DirectX", "Focus on Curves and Surfaces", A third book on advanced lighting and materials
I assume you mean the DirectX documentation, but what section is it under?? .... When looking at IDirect3DDevice::SetLight for example, all the documentation says is "Assigns a set of lighting properties for this device." talks about the parameters a bit, and its return values, but says nothing about this functions behavior when using a custom vertex shader.
-----BEGIN PGP SIGNATURE-----iQA/AwUBOwgpXBtK1gxlCl8XEQIZDACeOhJi6KLEz+rHAI4PiXt9Nw/qFswAoPigEJoSGWopzBZ6V2H1zLECKT8T=CImp-----END PGP SIGNATURE-----
Look at the "Texture Considerations" section for texture stage states that affect pixel shaders. I''m not sure if there is one section that lists which render states apply, but most of the lighting and related states do not.

Others, such as alpha blending, shading, etc. are still "active" when using vertex shaders.
Author, "Real Time Rendering Tricks and Techniques in DirectX", "Focus on Curves and Surfaces", A third book on advanced lighting and materials
wow.... ok .... that answers my questions about pixel shaders.... but what about vertex shaders?? if i have a custom vertex shader... what functionality does it replace?
-----BEGIN PGP SIGNATURE-----iQA/AwUBOwgpXBtK1gxlCl8XEQIZDACeOhJi6KLEz+rHAI4PiXt9Nw/qFswAoPigEJoSGWopzBZ6V2H1zLECKT8T=CImp-----END PGP SIGNATURE-----
A vertex shader replaces the transformation and lighting part of the pipeline. It doesn''t replace clipping, triangle setup, primitive assembly etc.

Take a look at the diagrams etc in the DirectX documentation:

DirectX 8.1 (C++) ->
DirectX Graphics ->
Programmers Guide ->
Using Direct3D ->
Vertex Data ->
Programmable Vertex and Pixel Processing

DirectX 8.1 (C++) ->
DirectX Graphics ->
Programmers Guide ->
Getting Started with Direct3D ->
Direct3D Architecture


Vertex shaders don''t affect the fixed function pipeline at all, and vice versa. Also the fixed function is NOT implemented using shaders.

--
Simon O''Connor
Creative Asylum Ltd
www.creative-asylum.com

Simon O'Connor | Technical Director (Newcastle) Lockwood Publishing | LinkedIn | Personal site

This topic is closed to new replies.

Advertisement