I'm making a 2D game that ends up being too dark on some laptops, so I figured I'd use a shader so people could brighten it up if need be. Unfortunately, once I got it in there nothing would fade in or out, they'd just pop in and out.
Here's my FX file
float intensity;sampler TextureSampler : register(s0);float4 Glow(float2 texCoord:TEXCOORD0):COLOR0{ float4 Color; Color = tex2D(TextureSampler, texCoord.xy); Color.rgb *= intensity; return Color;}technique Technique1{ pass Glow { PixelShader=compile ps_2_0 Glow(); }}
Even after commenting out the Color.rgb *= intensity;
line it still removes all fading effects.
I'm using the sprite batch to draw, and I begin and end it a few times because I use different BlendStates
brightnessShader.Parameters["intensity"].SetValue(brightness);spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend, null, null, null, brightnessShader, Matrix.CreateScale(scale));...spriteBatch.End();spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.Additive, null, null, null, brightnessShader, Matrix.CreateScale(scale));....spriteBatch.End();spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend, null, null, null, brightnessShader, Matrix.CreateScale(scale));...spriteBatch.End();
I'm using XNA 4.0.