Results 1 to 3 of 3

Thread: Light Flares

  1. #1
    Legendary Member NecroDOME's Avatar
    Join Date
    Mar 2004
    Location
    The Netherlands, Eindhoven
    Posts
    1,059

    Light Flares

    I there,

    When im rendering me scene, i want to add flars on the point where a light is. The flare needs to be visible only when the light point is visible.
    I could do a collision check on the geometry beteen the camera point and the light point, but i think it will be slow with a complex scene and a lot of lights...

    Mayby I could get a point in the backbuffer end with that information draw the flare ??
    NecroSOFT - End of line -

  2. #2

    Light Flares

    http://developer.nvidia.com/docs/IO/...d_Features.ppt
    This requires Occlusion queries support for your vid card. GF3 and up suport it; Radeon 8500 and up (IIRC).

    There is another method (without occlusion queries and back buffer locking) ->
    3) An alternative is to render just the Z buffer of the scene around where
    the test point is to a small texture, then render your test point as a white
    dot (say 2x2). You then stretch that texture and modulate with the flare.
    IIRC there's a full paper and/or sample code describing the technique on
    either the nVidia or ATI site.


    Simon O'Connor
    Creative Asylum Limited
    www.creative-asylum.com

    If your hardware has reasonably flexible render to texture, you can do this kind of effects quite easily, without using any
    readbacks.

    Render a poly with Z test disabled over the area you are interested in sampling into either destination alpha, or an offscreen
    buffer using the screen Z buffer. Set the alpha to 0.

    Render the same poly with Z test enabled at the Z of the sun/light. Set the alpha to 255 (or 1.0, according to API .

    You should now have an alpha mask of the visible areas. Using a bilinear filter you can progressively shrink this down to a single
    pixel (thus getting an average coverage value), and then use the resulting pixel as a texture to render into the alpha component of
    your flare texture. Or you can do as Chris mentions, and blur it outwards to create the illusion of shafts of light, though you'd
    probably want to layer up a few sprites tested at different Z's to give it some depth.

    Pretty simple effect if your hardware can do it, but extremely effective

    Jason G Doig
    There are only 10 types of people in this world; those who understand binary and those who don't.

  3. #3
    Legendary Member NecroDOME's Avatar
    Join Date
    Mar 2004
    Location
    The Netherlands, Eindhoven
    Posts
    1,059

    Light Flares

    Cool.... ill try it tomorrow

    thnxz
    NecroSOFT - End of line -

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
  •