Jump to content
  • Advertisement
Sign in to follow this  
Vincent_M

Glow Not Working

This topic is 2093 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

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
Advertisement
One small issue is that your blur weights only add up to 0.98, which means with every blur pass, you're darkening the image by 2%.

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:

">
 (look at 56:10)

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!