-
Notifications
You must be signed in to change notification settings - Fork 61
Implement partial overbright clamping like Q3 #1557
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
Conversation
Thanks a lot! |
Some servers use this in multiple maps. |
We see some window in background are still a bit brighter on this branch. Maybe we have to re-introduce IDENTITY_LIGHTING. It was removed because with the original default values of Dæmon, there was no difference with IDENTITY (it ended up doing the same), but now we know those default values were wrong. If I understand it correctly, surfaces with IDENTITY_LIGHTING are not overbright but I may be wrong. |
I tried putting in 0.5 for CGEN_IDENTITY_LIGHTING and it does look closer, thought still not exactly the same. I'm not sure if it's right to do that though... Remember your first overbright reimplementation and all the workarounds for cancelling issues? I think Q3 also had these problems, since it worked in pretty much the same way with acting on the entire color buffer. But it seems that the solution used there was not heuristics in the renderer, but rather putting responsibility on the shaders for managing the canceling. (Of course you couldn't do that since there were already lots of assets that were made without observing the identity/identityLighting distinction.) So for example if you wanted a fullbright surface, you'd need to use identityLighting to cancel out the overbright. But our current overbright implementation works in a fundamentally different way; there is nothing that needs to be canceled. |
Yes, that's my first opinion, but I still have doubts. So you coming to the same conclusion is actually a good sign. |
Do these tiny differences even matter? We're trying to make things look better, not 100% reproduce how they looked 20 years ago. |
Probably not. Currently this map looks bad with some surfaces (windows, gymnasium floor), it's possible that with those patches it's now “good enough”. On those screenshots the windows look fine even if a bit different. I would like to see a comparison with the gymnasium floor. |
I added another cvar The windows discussed above do seem ~correct with that. Though the trees in front of them which are right behind a streetlight look brighter. This may be due to Q3's distinction between two (shockingly poorly named) vertex lighting modes Now for the gym... it still looks pretty bad with the default settings of this branch: But it looks good with I can't provide an ioq3 comparison since my dummy gamelogic doesn't implement portal entities. |
Well, that map was a quake3 map so you can load it with ioq3 directly (though, the I guess we should not overbright this texture, we may need a special heuristic for this kind. |
Where? I don't find any This is ready now, except for one part of a comment that I'm considering deleting. @illwieckz Do you still endorse any of the following?
Setting mapOverbrightBits to 0 doesn't seem like good advice as then you can't have any bright areas. And judging by more recent sRGB discussions, it sounded like the lightmap files are still 8 bits ranging 0-1, and you still have to apply overbright factors to use them. |
Map&Bot Testing does this on |
Actually, it might be using |
The The key name We have |
@slipher you can delete all that quote. |
src/engine/renderer/tr_image.cpp
Outdated
For even more information, see https://github.com/DaemonEngine/Daemon/issues/1542. | ||
*/ | ||
|
||
// TODO is there any reason to set these before a map is loaded? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// TODO is there any reason to set these before a map is loaded?
Actually, this can be moved elsewhere. Se my “bikeshedding” commit in:
Currently: 7185768
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the pointer, I added a commit consolidating those initial lighting parameter values.
I am under the impression that buildables look darker. |
Assuming the respective default settings of this branch and master, that's true when the light grid has values greater than 2.0. For example on nano, buildables/players are significantly darker (which is a good thing: on master they look as if under bright sunlight in many places, which makes no sense for the setting). In other settings such as plat23 or the Chasm alien base, light grid values are mostly less than 2 and things look the same. You can get identical results to master by using |
Any objections to merging this? |
None, can you rebase and fix merge conflict? |
I think I already rebased this for trivial merge conflicts 3 times, so I will wait until I get an approval to do it again. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM.
The lighting values continue to be multiplied by pow(2, tr.mapOverbrightBits) but the resulting values are capped at pow(2, tr.overbrightBits) which defaults to 1. This matches the original behavior of Quake 3 (in full screen mode) and Tremulous 1.1.0. The cvar r_overbrightBits has come back and has the same behavior as ioq3. Setting r_overbrightBits to 0 gives you the behavior of pre-0.55 Unvanquished. Setting r_overbrightBits to 2 gives you 0.55.x behavior. See DaemonEngine#1542 for more information.
The Quake 3 overbright implementation worked by scaling up the entire color buffer. For surfaces that were not lit by precomputed lighting you had to use cgen identityLighting to cancel out. This breaks a lot of stuff so this cvar is only for testing.
Fixes #1542. Adds
r_overbrightBits
which works similar to the one in Quake 3. With the default value of 1, there is one "clamped" bit and one "unclamped" bit of overbright. With map overbright bits = 2 and tr.overbrightBits = 1, A lightmap value of x is treated likemin(x * 4, 2)
except that if some color channel exceeded 2, all the channels are scaled down together.Comparison of map mxl-school viewpos 1983 -838 353 130 24:
r_overbrightBits 0
(like old Q3 in non-fullscreen mode, Tremfusion, most versions of Unvanquished until recently): A sickly light. Needs more brightness.r_overbrightBits 2
(like Unvanquished 0.55+): Too much! Now it's saturated.r_overbrightBits 1
(like full-screen Windows 9x Q3, ioq3 with GL2 renderer, Tremulous 1.1.0): Just right.Here's a screenshot with ioq3's GL1 renderer for comparison. Also I verified that setting
r_overbrightBits
to 0 or 2 has a similar effect in ioq3's renderers and this PR.Draft PR because:
overbrightClamping
in the worldspawn is needed. For now I deletedr_overbrightDefaultClamp
/overbrightClamping
since you can do the same clamping by settingr_overbrightBits 0
, but that doesn't offer a way for a map to force it.