Sign in to follow this  

No Water Transparency....why?

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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this