Coupla Basic Shader Questions

Started by
2 comments, last by InvalidPointer 14 years, 5 months ago
Hey. Does the use of a shader override render states, such as BlendFunction and AlphaEnable? If I'm using a pixel shader to color every pixel of a draw call, with no texture, is there a way to tell certain pixels not to draw at all, or do I have to assign some color value to every single pixel? THANKS!
Advertisement
AFAIK it shouldn't effect render states such as blending. I had a pixel shader attached while using alpha blending and it worked fine.

As for your second question, I'm not sure how you'd do that in a pixel shader, but I'll assume it can easily be done using Alpha Testing to discard certain pixels if you have an alpha-only texture applied (D3DFMT_A8).
Yes, you can us discard to skip color that pixel.

Here is something from Dx9 SDK

discard Statement (DirectX HLSL)
Do not output the result of the current pixel.

Short answer: No, they don't; they cover two different parts of the pipeline. A good way to think about it is the shader output corresponding to a texture or something-- you can do anything with it that you could do with traditional fixed-function methodology in this aspect.
clb: At the end of 2012, the positions of jupiter, saturn, mercury, and deimos are aligned so as to cause a denormalized flush-to-zero bug when computing earth's gravitational force, slinging it to the sun.

This topic is closed to new replies.

Advertisement