Jump to content
  • Advertisement
Sign in to follow this  
Qbound

How to set the AlphaRef in the shader?

This topic is 4082 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

Hi, i am want to set the AlphaRef in my shader upon the distance from my camera. In the vertexShader i do the following. fBlend = 1.0f - (fBlendFaktor * length( vEyePosW - posW ) the vEyePos is the Position from the view/cam the posW is the position of the Quad now i got the the distance from the viewer in fBlend in the range 0.0f -> 1.0f My old shader blends the quads with alphablending. But now i want to do the blending with the alphatest and therefore i need to set the Rendersetting AlphaRef in my shader. How do i set this setting out of my VertexShader? Or do i have to set this setting outside of the shader? Thanks for your help.... Qbound

Share this post


Link to post
Share on other sites
Advertisement
You can set the alpha reference with the AlphaRef state in a pass. I don't think you can change it very easily though.

What you could do is keep it at some constant value like .5 or something, and modulate the alpha value you output in your pixel shader, rather than changing the alpha reference value.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!