Archived

This topic is now archived and is closed to further replies.

vertex shaders vs Fixed Function questions

This topic is 5654 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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??

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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?

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites