Better dynamic light falloff

 

Copyright info

All code in this tutorial is protected by the [GPL License].
All text in this tutorial is protected by the [FDL License].

 

Tutorial by: Riot

Mailto: riot@planetquake.com

Notice how Q2's dynamic lights seem to be the same brightness from center to edge? I think that sucks. Let's make them look better:

Open gl_light.c in the ref_gl project.

Go to R_AddDynamicLights.
Locate the lines:

 
 
pfBL[0] += ( frad - fdist ) * dl->color[0];
pfBL[1] += ( frad - fdist ) * dl->color[1];
pfBL[2] += ( frad - fdist ) * dl->color[2];
 
     

Change that to:

 
 
pfBL[0] += ( fminlight - fdist ) * dl->color[0];
pfBL[1] += ( fminlight - fdist ) * dl->color[1];
pfBL[2] += ( fminlight - fdist ) * dl->color[2];
 
     

yeah, that's really it. Dynamic lights are a bit harder to see now, but they sure as hell look better.
Much better. Have fun.

 

 

Tutorial Originally found at: