Sign in to follow this  
Vincent_M

Glow Not Working

Recommended Posts

For some reason, my glow effect isn't very vibrant. Attached below is what my Hellknight's tongue looks like when having glow applied to it. What I did was create two FBOs, and rendered all glow sources to the first one. Then, I swapped FBOs, and started running a horizontal blur shader, swap FBOs again, then vertical blur. I also turned depth testing off, and turned additive blending on, but no luck.

 

Here's my fragment shader to horizontal blur:

precision lowp float;
varying vec2 v_coord;
uniform float u_blurStep;
uniform sampler2D u_renderTexture;
void main()
{
	vec4 sum = texture2D(u_renderTexture, vec2(v_coord.x, v_coord.y)) * 0.2;
	sum += texture2D(u_renderTexture, vec2(v_coord.x - 4.0 * u_blurStep, v_coord.y)) * 0.05;
	sum += texture2D(u_renderTexture, vec2(v_coord.x - 3.0 * u_blurStep, v_coord.y)) * 0.09;
	sum += texture2D(u_renderTexture, vec2(v_coord.x - 2.0 * u_blurStep, v_coord.y)) * 0.11;
	sum += texture2D(u_renderTexture, vec2(v_coord.x - u_blurStep, v_coord.y)) * 0.15;
	sum += texture2D(u_renderTexture, vec2(v_coord.x + u_blurStep, v_coord.y)) * 0.15;
	sum += texture2D(u_renderTexture, vec2(v_coord.x + 2.0 * u_blurStep, v_coord.y)) * 0.11;
	sum += texture2D(u_renderTexture, vec2(v_coord.x + 3.0 * u_blurStep, v_coord.y)) * 0.09;
	sum += texture2D(u_renderTexture, vec2(v_coord.x + 4.0 * u_blurStep, v_coord.y)) * 0.05;
	gl_FragColor = sum;
}

 

u_blurStep = (1.0 / screenWidth)

Edited by Vincent_M

Share this post


Link to post
Share on other sites

Ok, I changed the weights slightly, and updated them (I found different gaussian coefficients online), and it seems to help the issue a little. Right now, I'm even rendering at 20 passes, which is 10 horizontal and 10 vertical passes each. This is quite an expensive operation, and is seems that this article suggested that only one pass would be necessary:

 

http://http.developer.nvidia.com/GPUGems/gpugems_ch21.html

 

That article keeps popping up wherever I look. Also, this tutorial seems to perform the glow exactly as I want, but even with the source code, I am still unable to figure out what I am doing wrong:

http://www.youtube.com/watch?v=G9rXFd44VvQ  (look at 56:10)

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this