So I posted yesterday about some help with a shader. I figured that one out (at least getting it to compile). But I wasn't satisfied. There was a white "overlay" that I couldn't figure out how to get rid of. So I hit Google, and found another example. I got it to compile and apply in-game, but there's a problem. There is a totally white oval around the crosshair that follows it wherever you look. I have no idea what is causing this. Could someone that knows about HLSL shaders take a look at the shader and determine what is causing that white oval? I like the effect -- it still applies -- but there is that damned oval. Here's the sorta-working shader:
Code:
static const bool description < string help = "Makes bright lights bleed their light into their surroundings."; > = true;
iface float BloomIntensity
< string help = "Controls the intensity of the bloom texture."; >
= 1.30;
iface float OriginalIntensity
< string help = "Controls the intensity of the original scene texture."; >
= 1.00;
iface float BloomSaturation
< string help = "Saturation amount on bloom."; >
= 1.00;
iface float OriginalSaturation
< string help = "Saturation amount on original scene."; >
= 1.00;
sampler BloomSampler : register(s0);
texture2D obge_LastRendertarget0_EFFECTPASS;
sampler2D ColorMapSampler = sampler_state {
texture = <obge_LastRendertarget0_EFFECTPASS>;
AddressU = CLAMP;
AddressV = CLAMP;
MINFILTER = LINEAR;
MAGFILTER = LINEAR;
MIPFILTER = LINEAR;
};
struct VSOUT {
float4 vertPos : POSITION;
float2 UVCoord : TEXCOORD0;
};
struct VSIN {
float4 vertPos : POSITION0;
float2 UVCoord : TEXCOORD0;
};
VSOUT DummyVS(VSIN IN) {
VSOUT OUT = (VSOUT)0.0f; // initialize to zero, avoid complaints.
OUT.vertPos = IN.vertPos;
OUT.UVCoord = IN.UVCoord;
return (OUT);
}
float4 AdjustSaturation(float4 Color, float Saturation) {
float Grey = dot(Color.rgb, float3(0.3, 0.59, 0.11));
return lerp(Grey, Color, Saturation);
}
float4 BloomShader(float2 Tex : TEXCOORD0) : COLOR0 {
float4 bloomColor = tex2D(BloomSampler, Tex);
float4 originalColor = tex2D(ColorMapSampler, Tex);
bloomColor = AdjustSaturation(bloomColor, BloomSaturation) * BloomIntensity;
originalColor = AdjustSaturation(originalColor, OriginalSaturation) * OriginalIntensity;
originalColor *= (1 - saturate(bloomColor));
return originalColor + bloomColor;
}
technique main <
int group = EFFECTGROUP_POST;
int fxclass = EFFECTCLASS_COLOR;
>
{
pass p0 {
VertexShader = compile vs_1_1 DummyVS();
PixelShader = compile ps_2_0 BloomShader();
}
}
Anyone who helps gets a million dollars
