Enable deluxe mapping and half-Lambert lighting for BSP + grid lighting#1920
Enable deluxe mapping and half-Lambert lighting for BSP + grid lighting#1920slipher wants to merge 4 commits intoDaemonEngine:for-0.56.0/syncfrom
Conversation
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) |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
For now this only does anything when using the debugging option
r_lightMode 2. Could be useful for #1919 later.