Jump to content
  • Advertisement
Sign in to follow this  
danromeo

No Water Transparency....why?

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

Hiya. Why isn't my water transparent? Sorry, the more I read about alpha blending on the web the confuseder I get. Basically I am enabling alpha blending/testing, then creating a water color in the pixel shader, and setting the alpha channel of my water color to 1 to make it transparent. All of the other settings are strictly by rote...it's what all of the web articles say to do, with none of them giving any clear reason as to WHY. Thanks void DrawWater() { .... GraphicsDevice.RenderState.AlphaBlendEnable = true; GraphicsDevice.RenderState.AlphaTestEnable = true; GraphicsDevice.RenderState.BlendFunction = BlendFunction.Add; GraphicsDevice.RenderState.SourceBlend=Blend.SourceAlpha; GraphicsDevice.RenderState.DestinationBlend=Blend.InverseSourceAlpha; .... } WPixelToFrame WaterPixelShaderFunction(WaterVertexShaderOutput input) : COLOR0 { .... //create a color based on position, reflection, blah blah blah Output.Color = lerp(combinedColor, dullColor, 0.2f); Output.Color.rgb += specular; Output.Color.a=1.0f; return Output; }

Share this post


Link to post
Share on other sites
Advertisement
For the blend settings you're using an alpha of 1.0 means "fully opaque" and 0.0 means "fully transparent". Set it to something in between, like 0.5.

Also please use the "source" or "code" tags if you're going to post source code.

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.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!