Einheit-101 Posted August 31, 2017 Share Posted August 31, 2017 Hello! I have a little shader that should apply a lightmap (texture Tex;) to a world texture. However, the object gets fully transparent as soon as the shader gets applied to it. It seems the lightmap alpha channel completely overwrites the original diffuse color, which is not what i want, i only want the stuff that is not fully transparent to blend over the original texture to make it look like light. Any idea whats wrong there? texture Tex; //------------------------------------------- // Variables //------------------------------------------- sampler SamplerTex = sampler_state { Texture = (Tex); }; //------------------------------------------- // Returns light transform //------------------------------------------- float4 PSFunction(float4 TexCoord : TEXCOORD0, float4 Diffuse : COLOR0) : COLOR0 { float4 Tex = tex2D(SamplerTex, float2(TexCoord.x, TexCoord.y)); Tex.a = Tex.a *= Diffuse.a; return Tex; } technique tec0 { pass p0 { AlphaBlendEnable = TRUE; AlphaRef = 1; PixelShader = compile ps_2_0 PSFunction(); } } Link to comment
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now