Flares over lightsources

Thilo Schulz arny at ats.s.bawue.de
Mon Apr 17 17:47:49 EDT 2006


Hello,

I've been working on flares over the last few days and got them to be 
rendered. IMHO, they add alot of realism to the scene.
A patch is available here:
http://thilo.kickchat.com/efport-progress/patches/q3-flarefix.diff

Here are a few screenshots of my work:
http://thilo.kickchat.com/bilder/screenshots/q3dm19-noflares.png
http://thilo.kickchat.com/bilder/screenshots/q3dm19-flares.png

This if from my EF project:
http://thilo.kickchat.com/efport-progress/screenshots/noflares.png
http://thilo.kickchat.com/efport-progress/screenshots/flares.png

I am mostly using already existing code there just improving on it.
It was originally planned that flares have about the same size proportionally 
to the screen width with increasing distance, just the intensity changes 
proportionally to 1/r^2. I have implemented that behaviour so some 
of the annoying bugs that were in previous q3test releases are history.

However, I was not able to get rid of all bugs. All flares are "added" from 
the RB_RenderDrawSurfList loop.
When looking directly at a flare, in most cases the flare is the last thing 
added from that loop (it is not added yet by RB_EndSurface, it only registers 
the flare in the list in tr_flare.c).
If I use certain weapons or look at the flares from a certain view angle on 
some maps flares suddenly change their intensity, and it hasn't got anything 
to do with my intensity computing functions but the order in which 
RB_EndSurface is called and what kind surfaces are drawn after the flare has 
been registered.

Have a look at these screenshots:
http://thilo.kickchat.com/bilder/screenshots/flarebug-normal.png
http://thilo.kickchat.com/bilder/screenshots/flarebug-toodark.png

These two screenshots show the same flare from the same angle but with a 
different weapon in the hand. The brightness of the flare suddenly changes.
The map is q3tourney2.

It may have to do something with the modelView matrix in "backEnd.or"
or some left-over values in the tess structure.
Changing the modelView matrix or values in tess changed the bug behaviour 
considerably, so setting these things to the right values would probably fix 
the bug.

In RB_RenderFlares there are these calls:

qglPushMatrix();
qglLoadIdentity();
qglMatrixMode( GL_PROJECTION );
qglPushMatrix();
qglLoadIdentity();
qglOrtho( backEnd.viewParms.viewportX, backEnd.viewParms.viewportX + 
backEnd.viewParms.viewportWidth, backEnd.viewParms.viewportY, 
backEnd.viewParms.viewportY + backEnd.viewParms.viewportHeight, -99999, 
99999 );

Still, the RB_RenderFlare function makes use of the RB_BeginSurface and 
RB_EndSurface functions. With a different matrix mode, I don't know whether 
the backEnd.or data previously used for the 3d stuff is appropriate for this 
one at all. Maybe someone with more insight to OpenGL could help.

-- 
Thilo Schulz
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <http://icculus.org/pipermail/quake3/attachments/20060417/08c2f1c5/attachment.pgp>


More information about the quake3 mailing list