Results 1 to 6 of 6

Thread: creating a halo

  1. #1
    Senior Member Regular Contributor
    Join Date
    Feb 2001
    Posts
    108

    creating a halo

    i think this is a bit of a non-trivial problem:

    iīve got a scene with several objects that represent light sources, like headlights etc. these are not actually openGL light sources, i just bright cubes or whatever. what i want to do is lay a halo effect on each of these *light sources*: you see this in various games, like you would have a star-shaped flare emitted by a carīs brake lights, streetlights, etc.. can also be seen in the N64 game "Perfect Dark" quite frequently
    basically, i only need to draw a semi-transparent bitmap overlaid on each lightsource. the problem is, how do i determine where the sources (and IF) they are actually drawn? i must only draw the halo if a lightsource is visible otherwise it looks wrong.
    basically, itīs the same problem as with a lens flare, you want to know when to draw the flare because the light source is visible, and when to omit it.

    iīve got one approach, but am not sure whether this might work:
    * set a certain value in the stencil buffer if a lightsource is drawn
    * set another value if anything else is drawn
    * finally, check where there are "source" values in the stencil buffer and draw the halos there.
    this might be very slow since i need to directly access the stencil buffer that way.

    has anyone some experience with haloing / lens flares, or knows a good net resource?

    regards

    eik

  2. #2
    Senior Member OpenGL Guru zed's Avatar
    Join Date
    Nov 2010
    Posts
    2,466

    Re: creating a halo

    this is what i do. run a linesegment from the camera to the light source + check to see if any polygons block its path.

  3. #3
    Senior Member Regular Contributor
    Join Date
    Feb 2001
    Posts
    108

    Re: creating a halo

    hmmm taht means youīd write your own raycaster wouldnīt you? how do you check for intersection with blocking polygons, isnīt that quite some huge overhead?

  4. #4
    Senior Member OpenGL Guru zed's Avatar
    Join Date
    Nov 2010
    Posts
    2,466

    Re: creating a halo

    not much overhead at all i just run it through my scenegraph which will return all the nodes that the ray goes through then i check if the ray collides with any of the polygons in those nodes. yes it does take a while to set up BUT u need to do this anyway if u wanna have collision detection in your program. BTW once its setup it goes quick.

  5. #5
    Senior Member Regular Contributor
    Join Date
    Mar 2001
    Posts
    184

    Re: creating a halo

    BSP/PVS would be another alternative. while implementing an efficient tree could be time consuming, the fruits of your labor will be well worth the effort. using BSP/PVS, utilities like line-of-sight come in handy and can be executed quickly. essentially, you check for visibility between the node where the light is and the node where the camera is. i'm working on a BSP/PVS with Constructive Solid Geometry. once i get a demo finished i'll post it. good lick

    b

  6. #6
    Senior Member Regular Contributor
    Join Date
    Mar 2001
    Posts
    184

    Re: creating a halo

    lick = luck

    ...how embarrassing...

    b

Similar Threads

  1. Halo..Help
    By in forum OpenGL: User Software
    Replies: 1
    Last Post: 03-03-2004, 01:46 PM
  2. Halo..Help
    By in forum OpenGL: User Software
    Replies: 0
    Last Post: 03-03-2004, 07:40 AM
  3. HALO help
    By d0nfry in forum OpenGL: User Software
    Replies: 3
    Last Post: 02-03-2004, 05:42 PM
  4. Halo's Sun
    By soconne in forum OpenGL: Advanced Coding
    Replies: 8
    Last Post: 10-29-2003, 12:33 AM
  5. Sun & halo
    By Freelancer in forum OpenGL: Advanced Coding
    Replies: 4
    Last Post: 10-28-2003, 07:53 AM

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