Jump to content
  • Advertisement
Sign in to follow this  
noodleBowl

OpenGL Super Cool Effects

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

I was wondering if anyone could point me to a good starting point or give me a detailed explanation as I'm not really sure where to start. I'm working on a 2D focused game engine which targets OpenGL 3.3+ and I'm wondering how do I do effects?

 

When I mean effects I'm talking things that glow, fire, power auras, etc

 

 

The glowing auras, bullets, anything in this picture

[attachment=24803:geometrywars.jpg]

 

The blue glow of the pylon crystals, the green backs of the banelings, the blue zealot sword glow, the green baneling explosions

[attachment=24804:ss87-hires.jpg]

 

Share this post


Link to post
Share on other sites
Advertisement

So all those effects are done just using multiple textures and blending them all together? Thats it, nothing really special?

 

I hope this makes sense, but couldn't I just "pre" blend my special effect textures in photoshop and render them as normal? Why even use the GPU to do this for me?

 

glBlendFunc(GL_ONE, GL_ONE) usually does it smile.png

 

Could you explain the difference between this and what I have below? I don't truly understand the glBendFunc command. I just know that what I have below allows me to blend textures that use a Alpha channel. Would this work for what I want to do?

glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
 

Share this post


Link to post
Share on other sites

 

So all those effects are done just using multiple textures and blending them all together? Thats it, nothing really special?

 

I hope this makes sense, but couldn't I just "pre" blend my special effect textures in photoshop and render them as normal? Why even use the GPU to do this for me?

 

glBlendFunc(GL_ONE, GL_ONE) usually does it smile.png

 

Could you explain the difference between this and what I have below? I don't truly understand the glBendFunc command. I just know that what I have below allows me to blend textures that use a Alpha channel. Would this work for what I want to do?

glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
 

 

You would have to render the polygons once for each "layer" using glBlendFunc() to set the blend mode.

 

glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);

says that you use the alpha from the source texture to specify the alpha, and the inverse of the alpha of the source texture to specify the alpha of the pixel before the texture was painted. This won't look like bloom and will look more like painted glass.

 

glBlendFunc(GL_ONE, GL_ONE) says keep the original pixel and add the source texture directly to it. This will saturate the pixel and make it look bloomy.

You can stretch the polygon for the bloom layer to make the bloom grow beyond the original shape.

 

Another more complicated and better looking method is to render everything to a texture, with things that glow more brighter and things that dont glow completley dark.

Then render a normal pass with everything normal, then render the texture you made earlier on a square covering the screen exactly and stretch it to make it bigger.

To make the glow bloom, render this square with the texture from last frame while you are making the current frames glow texture.

(All of these glowy and blurry effects are called "screen space" effects because they actually happen when some square is covering the screen and some shader usually handles the blurry stuff and not in 3D space, but you have been able to do this stuff with the fixed pipeline).

Edited by Gl2eenDl2agon

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!