lens flare effect

Started by
23 comments, last by trigger 22 years, 2 months ago
ok,

i got this 3d space to 2d screen coordinat thingie done. now i just need to find a good way to fade the lensflare effect smoothly up/down when the lightsource aka mainflare disapears.. maybe the professionals under us can help with their experience

best regeards
trigger

Edited by - trigger on January 30, 2002 2:41:30 PM
http://trigger.xenyon.net/
Advertisement
quote:Original post by freshya

If you simulate a lens flare, the eye is tricked into thinking the sun is brighter than it actually is.



Um.... I don''t know about that. Lens flares are just that, lens flares, they occur because of imperfections in the lens.

Fade out is what tricks the eye (brain really) into thinking that you are looking directly at a bright light source.

D.V.

Carpe Diem
D.V.Carpe Diem
its simple really..

have your lens flare effect be a state machine.

so the first frame that your sun is "visible" your
lensflare code is actually running through its "fade in"
state. so if your in the "fade in" state and the sun
disappears you drop into the "fade out" state. if
your sun is visible when the "fade in" is complete you drop into
the "lens flare on" state. etc.etc.


quote:
Um.... I don''t know about that. Lens flares are just that, lens flares, they occur because of imperfections in the lens.


When the eye sees a lens flare, your brain says "gee, that looks like every photo I''ve ever seen of a bright light. Therefore, it probably is a bright light."
In DX8 there is a way to render a primitive, and get returned if any z-buffer tests were returning true.
Its not supported by many cards, but it support is there, use it.
I dont know if there is an opengl-extension which does the same.

If you can query the card by direct support, do it.
It you cant, just use the raytracing.

1) Octree speeds things up extremely
2) if octree node isnt empty, use bounding-sphere to determine visibility
3) if bounding sphere hits ray, do the plane-tests

** if you want to fire more than one ray, to determine "how much" of the light is visible (-> fade the flare in and out at object edges) you can use a "shadow-cache".
just remember the surface that gave the last successful shadow, and test this one first.

** you dont need to know the exact location of the intersection, you just need to know if it is "before the light" or "behind the light". that should be faster to calculate.

** one second-last thing on "dont query the z-buffer without explicit support": there are cards out there that dont use a z-buffer or w-buffer for the whole scene. by reading the z-buffer you force them to generate a z-buffer for the entire screen(!) which is usually very slow. kyro/kyroII are good examples for this.

** one last thing on this: DX8 only supports one (!) lockable (and therefor readable) z-buffer format, ???D16_LOCKABLE, and SDK says this one can be very slow on some hardware. further youre limited to 16bit depth-buffer.


--- foobar
We push more polygons before breakfast than most people do in a day
--- foobarWe push more polygons before breakfast than most people do in a day

This topic is closed to new replies.

Advertisement