ioquake / ioq3

The ioquake3 community effort to continue supporting/developing id's Quake III Arena
https://ioquake3.org/
GNU General Public License v2.0
2.38k stars 527 forks source link

OpenGL2: Dlight behavior close to surface #626

Open WHS-Phoenix opened 10 months ago

WHS-Phoenix commented 10 months ago

With cl_renderer OpenGL2 and r_dlightmode 1 or higher, dynamic lights close to or at a surface cause the light to draw extremely dim, while lighting adjacent surfaces. Examples:

Dlight in flight open air:

shot0022

Dlight impacting wall (floor lights, wall lights badly):

shot0021

Dlight impacting floor (wall lights, floor lights badly):

shot0020

Comparison to Quake 2 (Kex Engine):

Dlight in flight open air:

20231130215906_1

Dlight impacting wall:

20231130215859_1

Dlight impacting floor:

20231130215902_1

WHS-Phoenix commented 9 months ago

Update on this behavior:

In the Quake3e engine, this is a result of a specularity program being run on the dynamic lights.

r_dlightSpecPower "8" yields this when shooting the wall (the light intensity is diminished on the wall surface when the source is near the wall plane).

shot-20231229-203429

r_dlightSpecPower "1" yields the desired result:

shot-20231229-203406

In the Quake3e engine this is controlled by ARB_BuildDlightFP in tr_arb.c, specifically this line:

if ( r_dlightSpecColor->value > 0 )
    strcat( program, va( "PARAM specRGB = %1.2f; \n", r_dlightSpecColor->value ) );

I cannot find an analogue within the IOQuake3 source but the behavior looks to be similar.