Page 1 of 2 12 LastLast
Results 1 to 10 of 13

Thread: Lighting Flares... how?

  1. #1
    Guest

    Lighting Flares... how?

    I would really like to try lighting flares in my program. At the moment, I am plotting a large quad around where a light point is (after rendering everything else, disabling depth testing and enabling blending) and it looks fine, but does not disappear when the point light source goes behind an object.

    How do I do this without multiple passes? Is there a way to let opengl think that a quad only exists at a point?

  2. #2
    Senior Member OpenGL Guru
    Join Date
    Feb 2000
    Location
    Sweden
    Posts
    2,978

    Re: Lighting Flares... how?

    Well, OpenGL does not help you with this. It's about occlusion culling, something you have to do on your own. You can cast a ray from the viewpoint to the lightsource, and determine if the ray intersects any objects on it's way to the lightsource. If it does, the light is not visible and no flare should be drawn.

  3. #3
    Guest

    Re: Lighting Flares... how?

    Is there a way to do this using OpenGL routines? Surely it would know if anything lies under a specific point on the screen, casting rays from my position to every polygon is bound to be very slow.

  4. #4
    Senior Member OpenGL Pro
    Join Date
    Jun 2000
    Location
    Shreveport, LA, USA
    Posts
    1,502

    Re: Lighting Flares... how?

    Huh? You cast one ray from eye to flare. Not from eye to every polygon. And you do the intersection tests with only the polygons that could have a chance of being intersected by the ray.

  5. #5
    Guest

    Re: Lighting Flares... how?

    Hi,

    I just came back from a drunky night but maybe you could use the depth buffer.
    I don't think it is a good idea but,
    -you can put a point at the light source location.
    - you can know the z value of your light source.
    - you can know where your point light is projected in 2d space
    - you can extract value from the depth buffer...
    compare the two value if the actual value is greater (or lower i don't really know what is stored in the depth buffer) than yours point light draw your quads.

    I have never tested this, i don't know if it could work and consequently i'm very interrested by explains about this.

  6. #6
    Guest

    Re: Lighting Flares... how?

    Sorry, (it must be getting a bit late!), only one ray needed. How can you test whether it intersects a polygon? And, how do I get a value from the depth buffer?

  7. #7
    Guest

    Re: Lighting Flares... how?

    Hello? Anyone out there? Is there a way to get values from the depth buffer?

  8. #8
    Senior Member Regular Contributor
    Join Date
    Nov 2000
    Location
    Dunblane, Scotland
    Posts
    333

    Re: Lighting Flares... how?

    PHubble, glReadPixels using GL_DEPTH_BUFFER_BIT should work.
    Reality is for idiots only the best over come it!

  9. #9
    Guest

    Re: Lighting Flares... how?

    Thanks ! I think I'll try it out and see what happens...

  10. #10
    Junior Member Newbie
    Join Date
    Nov 2000
    Location
    Uddevalla, Sweden
    Posts
    21

    Re: Lighting Flares... how?

    the way most engines do it is by casting a ray from the camera to the lightsource and check for intersecting polygons. It's not very slow if you don't use a huge number of lights and use some kind of culling algoritm (bounding spheres, AABB). in raytracing you have to do it for "every pixel"*"every polygon" - slow.

Page 1 of 2 12 LastLast

Similar Threads

  1. Sun Flares
    By Bejelit in forum OpenGL: Basic Coding
    Replies: 19
    Last Post: 09-26-2011, 08:41 AM
  2. When to draw lens flares
    By starman in forum OpenGL: Basic Coding
    Replies: 6
    Last Post: 03-03-2004, 06:15 AM
  3. problem with flares and halos
    By uruloki in forum OpenGL: Advanced Coding
    Replies: 6
    Last Post: 07-02-2003, 07:12 AM
  4. Light Flares in UT
    By MichaelK in forum OpenGL: Advanced Coding
    Replies: 14
    Last Post: 10-09-2002, 11:18 AM
  5. How to draw flares?
    By KRONOS in forum OpenGL: Advanced Coding
    Replies: 2
    Last Post: 11-27-2000, 12:06 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Proudly hosted by Digital Ocean