Skip to content

renderer: implement mapOverBrightBits in GLSL #1035

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from

Conversation

illwieckz
Copy link
Member

Implement mapOverBrightBits in GLSL.

This is required for deluxe mapping since we need to do the computation on lights without blended attenuation.

This will also be required when using lightmaps in non-linear colorspace as the computation would have to be done on lights after they are linearized.

Copy link
Member

@slipher slipher left a comment

Choose a reason for hiding this comment

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

Can you say which changes to the GLSL correspond to lightmaps, light grids, and vertex lighting?

@illwieckz illwieckz marked this pull request as draft January 27, 2024 23:23
@illwieckz
Copy link
Member Author

I think I will postpone that work for after 0.55 is released, with other things like sRGB. Such work may uncover some bugs or require more redesign in other place and may be the entrance of a rabbit hole 😄️.

@illwieckz
Copy link
Member Author

Can you say which changes to the GLSL correspond to lightmaps, light grids, and vertex lighting?

I may have to re-introduce R_ColorShiftLightingBytes for vertex lighting as there is no knowledge in GLSL if the color is a vertex color or something else. This branch was based on old branch I wrote years ago, at a time we did not have vertex lighting yet.

All the code in GLSL in this branch is about both lightmap and gridlight. PR #1032 made possible to write a single mapOverBrightBits function call for non-ambient light in lightMapping GLSL for both light maps and light grid (light maps don't have ambient light).

@illwieckz
Copy link
Member Author

This implementation has no future.

The design of the optimal code for us is deeply tied to our linear/sRGB implementation, so it will be part of #1034:

@illwieckz illwieckz closed this Feb 12, 2024
maxComponent = max(maxComponent, color.g);
maxComponent = max(maxComponent, color.b);
maxComponent = 1.0 / maxComponent;
color *= maxComponent;
Copy link
Member Author

Choose a reason for hiding this comment

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

This was actually repoducing a bug (light being clamped and then wrong)…

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