Skip to content

Enable deluxe mapping and half-Lambert lighting for BSP + grid lighting#1920

Draft
slipher wants to merge 4 commits intoDaemonEngine:for-0.56.0/syncfrom
slipher:gridlightbsp
Draft

Enable deluxe mapping and half-Lambert lighting for BSP + grid lighting#1920
slipher wants to merge 4 commits intoDaemonEngine:for-0.56.0/syncfrom
slipher:gridlightbsp

Conversation

@slipher
Copy link
Member

@slipher slipher commented Mar 3, 2026

For now this only does anything when using the debugging option r_lightMode 2. Could be useful for #1919 later.

slipher added 4 commits March 3, 2026 00:07
For checking if a macro can't be used without another macro, we can
just use HasConflictingMacros(). No need to have separate functions
to check flags that must be on and flags that must be off.

The one override of MissesRequiredMacros wasn't even using it for the
right thing (a global GL config setting instead of a macro).
Increased macro permutations isn't much of a concern any more since
we don't build unused ones by default.
Half-Lambert lighting makes goes well with the light grid:
the single light direction is a crude approximation, so it makes
sense to soften the directionality.

For now this only changes anything for the `r_lightMode 2` debug
option, but it may be useful for implementing grid lighting for
BSP entities later.
float NdotL = dot( normal, lightDir );

#if !defined(USE_BSP_SURFACE) && defined(r_halfLambertLighting)
#if defined(USE_GRID_LIGHTING) && defined(r_halfLambertLighting)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The !defined(USE_BSP_SURFACE) was because half lambert lighting is supposedly only meaningful on models, it wasn't a convoluted way to select grid lighting.

Is it intentional to use half lambert lighting on BSP surfaces as well? Maybe it makes sense because maybe models need half lambert because they are lit with the grid light to begin with.

I want to be sure this is intentional.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The case where half-Lambert clearly doesn't make sense is with lightmaps, since the lightmap precomputation already considers light bouncing. With grid lighting on the other hand, it seems to me an especially good idea as a way to soften the directionality, since with the way q3map2 works it always picks a direction and attributes lots of light as directed, even if there is roughly the same amount of light from all directions. In my tests with r_lightMode 2 a lot of places that looked bad were fixed by enabling half-Lambert lighting.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants