Jump to content
  • Advertisement
Sign in to follow this  
HarrisonPloeg

Blending Problem

This topic is 4094 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
Advertisement
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!