GLSL 'dirty' blur effect

Hi, I would like to make a GLSL shader effect that changes this:

http://gyazo.com/48566da88d4c7afa139815a1e025d39d
to this:
http://gyazo.com/6ad524a32c200fa2a46ef1b9d1c19164

this was done using a very very strong motion blur which makes the game unplayable (moving the mouse distorts everything)

I have followed some GLSL shader tutorials and I understand the basics of using textures etc. I just can’t figure out how to make this cool dirty, contrasted effect. I can make a blur effect, but it just makes you dizzy and doesn’t look good at all. What I am aiming for is something that is still “sharp” but at the same time has this contrast and blur effect.

Can anyone give me some ideas?

Thanks,
roland

Well, unless you know precisely what the effect is, no one’s going to be able to come up with GLSL code that does it :slight_smile:

Cas :slight_smile:

Thanks for the reply.

I have no idea what the effect is ;D I was hoping the 2 images helped. I’m not looking for code, just ideas on how I might solve the problem.

Roland

I’ll be honest - I can’t see any difference between those two pictures since they appear to be two different parts of a level. Perhaps you could come up with some better images or describe what you’re after a little more?

Sorry, heres a better set:

http://gyazo.com/b68cfb0e86d77d2b5b5fe822800ac9d3

http://gyazo.com/6ad524a32c200fa2a46ef1b9d1c19164

I want to make a post processing effect (I have rendered the scene to a texture) that converts the first to the second.
Thanks,

roland

The still images look like adjustments to brightness/contrast/saturation. I posted some GLSL code on that recently, do a search.

[quote]this was done using a very very strong motion blur which makes the game unplayable (moving the mouse distorts everything)
[/quote]
I don’t see how you expect us to know what the distortion effect looks like based on this description…

I’d say you should learn GLSL and how to achieve motion blurs. Then you can figure out the problem on your own… :slight_smile:

I know how to do motion blur. Its not the effect I want.

Heres what I mean by “distortion” that wrecks everything by using a very strong motion blur.
http://www.youtube.com/watch?v=7Fhs_SELfHc&list=UUyN3SzAPKMhGcip_Pt_jwFw&index=2&feature=plcp (only need to see the first 10 seconds)

I’m trying to get the effect without motion blur. Its not just contrast, pixels are also affected by neighbour pixel

Thanks for the contrast sample davedes! :slight_smile:

I’m most of the way there now.

Heres what the contrast looks like at the moment: http://gyazo.com/a2931bac77bae3d8f083ec1a85739e59

Now I just need to put “glow” around the edges of objects http://gyazo.com/6ad524a32c200fa2a46ef1b9d1c19164

Thanks again ;D

Isn’t this just a blur along the direction of the mouse movement or something.

Yeah. Maybe I should just forget about trying to get the blur bit, even though it makes the edges look cool the rest doesn’t look so good. I quite like just the contrast effect at the moment.

If anyone wants to use the contrast GLSL shader code, here it is:

vertex shader


void main(){
	gl_TexCoord[0] = gl_MultiTexCoord0;
	gl_Position = ftransform();
}

fragment shader


uniform sampler2D tex;

const float contrast = 1.6;
const float brightness = -0.2;

float contrastValue(float value)
{
	value = (value - 0.5) * contrast + 0.5;
	value += brightness;
	value = min(max(value, 0), 1);
	return value;
}


void main(){
	vec4 c = texture2D(tex,gl_TexCoord[0].st);
	
	c.r = contrastValue(c.r);
	c.g = contrastValue(c.g);
	c.b = contrastValue(c.b);
	gl_FragColor = c;
}

Thanks again everyone

shortened that for you


uniform sampler2D tex;

const float contrast = 1.6;
const float brightness = 0.3;
const float factor = -0.5 * contrast + brightness;

void main(){
	vec4 c = texture2D(tex,gl_TexCoord[0].st);
	gl_FragColor = clamp(c * contrast + factor, 0., 1.);;
}

Thanks :slight_smile: