Skip to content
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

Fixes for lighting in custom maps #189

Merged
merged 3 commits into from
Feb 23, 2022

Conversation

res2k
Copy link
Contributor

@res2k res2k commented Feb 17, 2022

Background:
After a bit of a while I looked at some custom maps again, specifically some which use very few "baseq2" textures and rely on SURF_LIGHT faces for lighting quite a bit.

The issue:
Suddenly all the walls very way too bright...

Turns out the map author used textures, including the wall textures, mostly for "normal" surfaces, but sometimes for emissive surfaces!
However, the code currently handling light surfaces with materials not specified in the material system sets MATERIAL_FLAG_LIGHT if a material is encountered on an emissive surface (SURF_LIGHT) - so one occurrence of that and suddenly all uses emit light!

Attempt 1:
My first thought was to treat surfaces lacking the SURF_LIGHT as always non-emissive.
However, this breaks quite a few updated materials that add emissive layers on textures that where not used for light emission in the original game.

Attempt 2 (this PR):
This only considers the presence of SURF_LIGHT if the emissive texture was not explicitly given (ie synthesized emissive texture): no SURF_LIGHT → no emission.
Otherwise, no SURF_LIGHT means "fully emissive" (previous behavior).

@apanteleev apanteleev merged commit 48bb03b into NVIDIA:master Feb 23, 2022
@res2k res2k deleted the custom-maps-lighting branch March 3, 2022 21:26
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