Skip to content

Light grid-related cleanup#1898

Open
slipher wants to merge 7 commits intoDaemonEngine:masterfrom
slipher:grid-cleanup
Open

Light grid-related cleanup#1898
slipher wants to merge 7 commits intoDaemonEngine:masterfrom
slipher:grid-cleanup

Conversation

@slipher
Copy link
Member

@slipher slipher commented Feb 16, 2026

A few light grid-related cleanups/optimizations that do not change the functionality.

Also fix reversed naming of lat/long and fix wrong comments.
In one step of light grid processing, values were converted from sRGB to
linear and stored in bytes. This unnecessarily loses precision during
the calculation.
Set the alpha byte to 255 so the image uploading code will choose an RGB
format.
Don't create the light grid direction image if deluxe mapping is
disabled.
... to avoid having to offset by 128 every time it is accessed.
Sometimes color values were slightly greater than 1; this led to
an incorrect float color -> byte color conversion. Fix it by
clamping the colors in Tess_AddTetrahedron.
@slipher
Copy link
Member Author

slipher commented Feb 17, 2026

Added some more commits. I fixed a funny bug with r_showLightGrid. Due to this visualization, I thought for a long time that it is possible for the ambient and the directed light colors to be different. In fact, they are always the same color, just with different brightness levels. (There are distinct colors in the BSP, but in Daemon's post-processing they are just averaged...) But due to buggy float-to-byte color conversion, r_showLightGrid sometimes rendered different colors, e.g. blue directed and red ambient.

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.

1 participant