Jacobob14 Posted May 6, 2015 Share Posted May 6, 2015 as it could change the alpha of a shader so that does not leave very dark image ? /* Author: 50p Version: v1.0 Description: This shader allows you to mask a texture with a mask texture (black and white). */ texture ScreenTexture; sampler implicitInputTexture = sampler_state { Texture = ; }; texture MaskTexture; sampler implicitMaskTexture = sampler_state { Texture = ; }; float4 MaskTextureMain( float2 uv : TEXCOORD0 ) : COLOR0 { float4 sampledTexture = tex2D( implicitInputTexture, uv ); float4 maskSampled = tex2D( implicitMaskTexture, uv ); sampledTexture.a = (maskSampled.r + maskSampled.g + maskSampled.b) / 3.0f; return sampledTexture; } technique Technique1 { pass Pass1 { AlphaBlendEnable = true; SrcBlend = SrcAlpha; DestBlend = InvSrcAlpha; PixelShader = compile ps_2_0 MaskTextureMain(); } } Link to comment
Ren_712 Posted May 6, 2015 Share Posted May 6, 2015 If i understood correctly - you want to change the alpha of the ScreenTexture. You might edit the MaskTexture, or you can setShaderValue( myShader, "gAlphaMult", alphaValue) -- ( 0 - 1). Are you using 50p's mask class ? Or just this shader ? /* Author: 50p Version: v1.0 Description: This shader allows you to mask a texture with a mask texture (black and white). */ float gAlphaMult = 1; texture ScreenTexture; sampler implicitInputTexture = sampler_state { Texture = ; }; texture MaskTexture; sampler implicitMaskTexture = sampler_state { Texture = ; }; float4 MaskTextureMain( float2 uv : TEXCOORD0 ) : COLOR0 { float4 sampledTexture = tex2D( implicitInputTexture, uv ); float4 maskSampled = tex2D( implicitMaskTexture, uv ); sampledTexture.a = (maskSampled.r + maskSampled.g + maskSampled.b) / 3.0f; sampledTexture.a *= gAlphaMult; return sampledTexture; } technique Technique1 { pass Pass1 { AlphaBlendEnable = true; SrcBlend = SrcAlpha; DestBlend = InvSrcAlpha; PixelShader = compile ps_2_0 MaskTextureMain(); } } Link to comment
Jacobob14 Posted May 6, 2015 Author Share Posted May 6, 2015 as could be done to put alpha only the mask and the texture has another alpha? 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