Jump to content

  • Log In with Google      Sign In   
  • Create Account

Interested in a FREE copy of HTML5 game maker Construct 2?

We'll be giving away three Personal Edition licences in next Tuesday's GDNet Direct email newsletter!

Sign up from the right-hand sidebar on our homepage and read Tuesday's newsletter for details!


We're also offering banner ads on our site from just $5! 1. Details HERE. 2. GDNet+ Subscriptions HERE. 3. Ad upload HERE.


Glow Not Working


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
2 replies to this topic

#1 Vincent_M   Members   -  Reputation: 701

Like
0Likes
Like

Posted 26 February 2013 - 07:39 AM

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)

Attached Thumbnails

  • Screen Shot 2013-02-26 at 5.16.42 AM.png

Edited by Vincent_M, 26 February 2013 - 08:47 AM.


Sponsor:

#2 Hodgman   Moderators   -  Reputation: 30910

Like
0Likes
Like

Posted 26 February 2013 - 08:06 AM

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%.

#3 Vincent_M   Members   -  Reputation: 701

Like
0Likes
Like

Posted 26 February 2013 - 09:09 AM

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)






Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS