Jump to content

  • Log In with Google      Sign In   
  • Create Account

14 years ago on June 15th Gamedev.net was first launched! We want to thank all of you for being part of our community and hope the best years are ahead of us. Happy birthday Gamedev.net!

#ActualYours3!f

Posted 02 December 2012 - 05:23 PM

Thank you for the replies!
Your solutions make sense.
I'm actually implementing a kind of simple glow shader. I want to perform a blur with a specific color and then draw the original scene on top of it.
What can I do if I want to have a background image behind the glow? Do you use alpha channels in the FBO's textures?
I'm planning to do the following:
- Draw background to screen
- Draw part of the scene that should have the glow to Tex#1 with alpha channel.
- Blur Tex#1. (using the 2 pass method you explained)
- Draw Tex#1 to screen. (Background will still be visible because it has an alpha channel)
- Draw full scene to screen.

I'm not really sure if this is a good solution. Any comments are appreciated.


I think there are many options, among those one would be masking with the alpha channel:
draw scene with glow parameter in alpha channel (ie alpha = 0 if no glow, alpha = 1 if glow)
blur the scene, and multiply each sample with the original (middle) sample's alpha.
so if the given pixel should glow ==> 1 * (sample #1 + sample #2 + ... + sample #n) = some color
if the given pixel should not glow ==> 0 * (sample #1 + sample #2 + ... + sample #n) = 0
output = original + blurred

or using stencil masking:
draw scene with setting the stencil bit where it needs to glow.
do the blurring with stencil testing enabled.

#2Yours3!f

Posted 02 December 2012 - 05:19 PM

Thank you for the replies!
Your solutions make sense.
I'm actually implementing a kind of simple glow shader. I want to perform a blur with a specific color and then draw the original scene on top of it.
What can I do if I want to have a background image behind the glow? Do you use alpha channels in the FBO's textures?
I'm planning to do the following:
- Draw background to screen
- Draw part of the scene that should have the glow to Tex#1 with alpha channel.
- Blur Tex#1. (using the 2 pass method you explained)
- Draw Tex#1 to screen. (Background will still be visible because it has an alpha channel)
- Draw full scene to screen.

I'm not really sure if this is a good solution. Any comments are appreciated.


I think there are many options, among those one would be masking with the alpha channel:
draw scene with glow parameter in alpha channel (ie alpha = 0 if no glow, alpha = 1 if glow)
blur the scene testing for the alpha channel (see above)
output = original + blurred

or using stencil masking:
draw scene with setting the stencil bit where it needs to glow.
do the same thing as above with stencil testing enabled.

#1Yours3!f

Posted 02 December 2012 - 05:19 PM

Thank you for the replies!
Your solutions make sense.
I'm actually implementing a kind of simple glow shader. I want to perform a blur with a specific color and then draw the original scene on top of it.
What can I do if I want to have a background image behind the glow? Do you use alpha channels in the FBO's textures?
I'm planning to do the following:
- Draw background to screen
- Draw part of the scene that should have the glow to Tex#1 with alpha channel.
- Blur Tex#1. (using the 2 pass method you explained)
- Draw Tex#1 to screen. (Background will still be visible because it has an alpha channel)
- Draw full scene to screen.

I'm not really sure if this is a good solution. Any comments are appreciated.


I think there are many options, among those one would be masking with the alpha channel:
draw scene with glow parameter in alpha channel (ie alpha = 0 if no glow, alpha = 1 if glow)
blur the scene testing for the alpha channel (see above)
output = original + blurred

using stencil masking:
draw scene with setting the stencil bit where it needs to glow.
do the same thing as above with stencil testing enabled.

PARTNERS