Results 1 to 5 of 5

Thread: Glow with OpenGL

  1. #1
    Co-Founder / PGD Elder WILL's Avatar
    Join Date
    Apr 2003
    Location
    Canada
    Posts
    6,107
    Blog Entries
    25

    Glow with OpenGL

    Hey guys, I'm trying to add a nice nifty ambient effect to the lava in my game, so I was thinking of using the Tron glow effect on all the lava tiles.

    I've done some scouring on the net via Google and found this lovely article on the matter:

    Real-Time "TRON 2.0" Glow For Low-Spec Hardware

    and of course it's older cousin: Real-Time "TRON 2.0" Glow in Half-Life

    but... it's very Half-Life Engine specific. And I fear that it doesn't really cover the theory very well at all. So I'd like to get the basic concept of it before I delve into the code, just to make sure if I can make any use of this or not.

    So who knows more about this?

    EDIT:

    Ah ha! I knew it... found the article (I remember there being this one somewhere just couldn't remember where.) Real-Time Glow on Gamasutra.
    Jason McMillen
    Pascal Game Development
    Co-Founder





  2. #2

    Glow with OpenGL

    You might want to download this - http://huru.imukuppi.org/opengl/Adva...ing_OpenGL.pdf and put it in a safe place.
    <br /><br />There are a lot of people who are dead while they are still alive. I want to be alive until the day I die.<br />-= Paulo Coelho =-

  3. #3
    Co-Founder / PGD Elder WILL's Avatar
    Join Date
    Apr 2003
    Location
    Canada
    Posts
    6,107
    Blog Entries
    25

    Glow with OpenGL

    Ah... very nice. Thanks Dom!
    Jason McMillen
    Pascal Game Development
    Co-Founder





  4. #4

    Glow with OpenGL

    Since I already implemented a glow in one of my older games I'll give you a brief summary of how to do it without needing advanced stuff like shaders etc. :

    • You need separate meshes or textures for the glow renderpass. E.g. for a building where you want to have only the windows glow that special glow model would be totally black except for the windows that would be colored in the respective glow color. Either do that by setting the material or by applying a special glow texture.
    • Clear the screen black and render your scene as usual but with only the glow meshes / textures. You should disable all unnecessary rendering states like lighting, shaders, etc. but leave depth test enabled. You now have the glowing part of your scene stored in your backbuffer. Dont' swap the buffers yet!
    • Now copy the backbuffer into a texture. The size of that texture should be much smaller than the actual size of your game's window to make the glow blurry. Copying into a texture is most easily done with glCopyTexSubImage, but you can also use a pixel buffer or the newly introduced FBOs.
    • Clear all buffers you're using (color, depth, stencil, etc.) and render your normal game scene.
    • Switch into orthographic projection via glOrtho and clear the depth buffer.
    • Enable blending (additive should be best, but maybe try out).
    • Very simple blur :
      Draw a quad with your glow texture applied on top of the whole screen. Due to the fact that your glow texture is much smaller than the actual screen size the linear filtering (don't forget to enable this) will smooth out the texture.
    • Radial blur :
      As above, but draw the quad ontop of your game screen multiple times (maybe 16 times or even more often) and eachtime offset it using sinus and cosinus so the glow get's radial. This looks better but also hurts performance.

  5. #5

    Glow with OpenGL

    Another nice trick that I've learnt:

    - Draw onto your blur texture.

    - Instead of drawing the blur texture to the screen, you draw it to another texture. You draw it about 2-4 times but with a VERTICAL offset each time.

    - Draw the newly resulting texture onto your screen 2-4 times with a HORIZONTAL offset each time.

    This will give you the same effect, if not better than drawing the original 16 or more times.
    My site: DelphiTuts.com (coming soon)...

    Download Font Studio 4.21 here.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •