Sign in to follow this  

Blending Problem

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

In my game I am trying to draw some clouds, but all I get is a white square. I am using alpha blending, here is the Effect file: uniform extern float4x4 gWVP; uniform extern texture gTex; uniform extern float4x4 gWorldInverseTranspose; uniform extern float4 gDiffuseMtrl; uniform extern float4 gDiffuseLight; uniform extern float3 gLightVecW; sampler TexS = sampler_state { Texture = <gTex>; MinFilter = Linear; MagFilter = Linear; MipFilter = Linear; }; struct OutputVS { float4 posH : POSITION0; float4 color : COLOR0; float2 tex0 : TEXCOORD0; }; OutputVS cloudVS(float3 posL : POSITION0, float4 c : COLOR0, float3 normalL : NORMAL0, float2 tex0 : TEXCOORD0) { OutputVS outVS = (OutputVS)0; float3 normalW = mul(float4(normalL, 0.0f), gWorldInverseTranspose).xyz; normalW = normalize(normalW); float s = max(dot(gLightVecW, normalW), 0.0f); outVS.color.rgb = s*(gDiffuseMtrl*gDiffuseLight).rgb; outVS.color.a = gDiffuseMtrl.a; outVS.posH = mul(float4(posL, 1.0f), gWVP); outVS.tex0 = tex0; return outVS; } float4 cloudPS(float4 c : COLOR0, float2 tex0 : TEXCOORD0) : COLOR { float4 texColor = tex2D(TexS, tex0); return float4(c.rgb, texColor.a); } technique cloudTech { pass P0 { vertexShader = compile vs_2_0 cloudVS(); pixelShader = compile ps_2_0 cloudPS(); FillMode = Solid; CullMode = None; AlphaBlendEnable = true; SrcBlend = SrcColor; DestBlend = DestColor; BlendOp = Add; SeparateAlphaBlendEnable = true; SrcBlendAlpha = SrcAlpha; DestBlendAlpha = InvSrcAlpha; BlendOpAlpha = Add; } }

Share this post


Link to post
Share on other sites

This topic is 3876 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.

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