Hi.
I got this distance blur 2D filter,done by MARTINSH (THANKS!), but the problem is that when i activate it game brightness increases. I have no idea what wrong with it.
Here.
uniform sampler2D bgl_RenderedTexture;
uniform sampler2D bgl_DepthTexture;
uniform float bgl_RenderedTextureWidth;
uniform float bgl_RenderedTextureHeight;
#define PI 3.14159265
float width = bgl_RenderedTextureWidth; //texture width
float height = bgl_RenderedTextureHeight; //texture height
//------------------------------------------
//general stuff
/*
make sure that these two values are the same for your camera, otherwise distances will be wrong.
*/
float znear = 0.05; //camera clipping start
float zfar = 3000.0; //camera clipping end
//user variables
int samples = 2; //blur sample count
float blurstart = 450.0; //blur starting distance in Blender units
float range = 5.0; //blur fading distance in Blender units
float maxblur = 1.0; //maximum radius of blur
bool noise = false; //use noise instead of pattern dithering?
float namount = 0.0002; //sample dithering amount
//------------------------------------------
vec2 rand(in vec2 coord) //generating noise/pattern texture for dithering
{
float noiseX = ((fract(1.0-coord.s*(width/2.0))*0.25)+(fract(coord.t*(height/2.0))*0.75))*2.0-1.0;
float noiseY = ((fract(1.0-coord.s*(width/2.0))*0.75)+(fract(coord.t*(height/2.0))*0.25))*2.0-1.0;
if (noise)
{
noiseX = clamp(fract(sin(dot(coord ,vec2(12.9898,78.233))) * 43758.5453),0.0,1.0)*2.0-1.0;
noiseY = clamp(fract(sin(dot(coord ,vec2(12.9898,78.233)*2.0)) * 43758.5453),0.0,1.0)*2.0-1.0;
}
return vec2(noiseX,noiseY);
}
void main()
{
vec3 col = vec3(0.0);
float zdepth = texture2D(bgl_DepthTexture,gl_TexCoord[0].xy).x;
float depth = -zfar * znear / (zdepth * (zfar - znear) - zfar);
float blur = (depth-blurstart)/range*0.5;
blur = clamp(blur*maxblur,0.0,maxblur);
vec2 noise = rand(gl_TexCoord[0].xy)*namount*blur;
float w = (1.0/width)*blur+noise.x;
float h = (1.0/height)*blur+noise.y;
float ss = 3.6/sqrt(float(samples));
float dz = 2.0/float(samples);
float l = 0.0;
float z = 1.0 - dz/2.0;
float s = 1.0;
for (int k = 0; k <= samples; k += 1)
{
float r = sqrt(1.0-z);
vec2 wh = vec2(cos(l)*r, sin(l)*r);
col += texture2D(bgl_RenderedTexture,gl_TexCoord[0].xy+vec2(wh.x*w, wh.y*h)).rgb;
z -= dz;
l += ss/r;
}
gl_FragColor.rgb = col/float(samples);
gl_FragColor.a = 1.0;
}
ive had the same problem ocuring with other 2d filthers its the little button called shadeless (a shity problem) also the problem is when the (wire) in the materials menu is selected