Jump to content
  • Advertisement
Sign in to follow this  
JavaCoolDude

OpenGL New Demo: Glow

This topic is 4868 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

As posted on my webpage: This demo written in OpenGL is based on an article I read a while ago in my GPU GEMS book and which is also available on the gamasutra site, check it out here. To create the glow effect, basically every 3D model in the scene is assigned a set of two textures; a regular RGB image encoding the diffuse color and a LUMINANCE one specifying the glow areas. A better approach would be to code the luminance values into the alpha channel of the diffuse image; that way we get to use a single texture instead of two. I chose to stick with the first approach since it gives me the possibilty of modifying the glow path without separating the RGB and ALPHA values into separate textures before combining them again (I only have Paint on my computer, sigh!!!) During the first pass a GLSL fragment shader retrieves the diffuse color bound to texture unit 0 and then multiplies it by the luminance value stored in the second texture. The result is copied into a 256*256 texture that we call the glow source. Originally I intended to use FBOs to accomplish the rendering to texture but since we're dealing with relatively small targets, I decided to stick with glCopyTexSubImage2D. Now depending on the amount of glow that we aim for, another shader (or ARB program, the user can modify the Blur.xml file in the data folder to switch from one to the other) takes the glow source and blurs it N times in two separate steps: a horizontal pass to bleed the source color along the x axis followed by a vertical pass that distributes the color in the y axis direction. In both steps the resulting color is multiplied by 1.15 to accentuate the glow effect. After each pass, the result is stored into a secondary texture; this is our blur target. Finally, the scene is drawn with diffuse textures only before turning on additive blending and drawing a full screen quad with the blur target bound to it. One drawback of this technique is the aliasing effects betraying the small size of the blur and glow targets. Later I will try to provide support for non DX9.0 hardware since the blur could be accomplished without shaders. Demo binaries. Demo source and build files. Engine source. [Edited by - JavaCoolDude on May 27, 2005 4:19:06 PM]

Share this post


Link to post
Share on other sites
Advertisement
Thats pretty neat.

What do you intend to do with all these neat effects you are creating?

Share this post


Link to post
Share on other sites
I'm shooting to get some of those effects into the NVIDIA SDK.
I'm flying to their headquarters in CA tomorrow for a job interview.
Wish me luck, I feel pretty nervous about the whole thing.

/wuss out [crying]

[razz]

Share this post


Link to post
Share on other sites
Thank you all for your support; it means a lot to me [inlove]
Aight, let me get 4 hours of sleep before I head out for the Airport.

Share this post


Link to post
Share on other sites
Your stuff amazes me. I know a lot of people seemed to be making this kind stuff (atleast commerically), but you work it all out and then release it to the public. My hat goes off to you, sir. *round of applause*

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!