-
-
Notifications
You must be signed in to change notification settings - Fork 97
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
High energy lights or emissive materials should approach or become white at very high levels #3214
Comments
@JFonS was looking at improving the tonemapping to handle desaturation, but he didn't see anything wrong with the current code. |
Maybe the code is not wrong but the formula is? Color math is complicated, after all 🤔 |
How do other engines handle this situation with fully saturated colors? |
According to a page in the Unreal Engine docs, no. Quoting the docs:
It would seem that lights work a bit differently. Here's a light with RGB color of 23,255,250 and the energy level of 70(these settings make emissive materials white): Sphere with emission(same color, same energy) for comparison: For lights, it would seem that other components of the color have to be a bit higher for very bright areas to become white. |
To add to what @atirut-w said, the problem seems to be 4-fold: lights aren't physically based, cameras aren't physically-based, the bloom shader isn't physically based, and the HDR isn't physically based. Parameters for these four entities are completely disjoint from one another in the current rendering pipeline. Naturally, results aren't physically accurate. To get the accurate values, a physically-based camera model should be supplied in order to get the correct luminance in which the sensor begins to get saturated. Regardless, there seems to be some sort of component-wise clamping going on in the current bloom and tonemapping shaders, because I was able to replicate the desired, accurate effect with a custom implementation, using the luminance of the pixels. Godot.Engine.-.Custom.HDR.Shader.-.main.tscn._.30_08_2021.21_39_38.mp4 |
I checked this a while ago, and IIRC we are using the same code found on this blog post: https://knarkowicz.wordpress.com/2016/01/06/aces-filmic-tone-mapping-curve/ As mentioned there, this is just an ACES approximation and it over-saturates bright colors. I tried replacing the code for the one linked in the post and, indeed, the shift to white was working as expected. I didn't open a PR for it because, as pointed out, there are many factors that come into play in the color pipeline, and I was hoping to take the time and sort most of it out. I'm not confident enough to do such changes yet, so for now I keep reading literature on the topic from time to time :) |
This one's gonna be a PITA to get merged and closed isn't it? |
See #723. It's not planned for 4.0, but it is for a future 4.x release. |
Is there a version of this for 3.x? At least implementing what @Lauson1ex did into Filmic would be great. |
@Lauson1ex I have no preference for keeping the old vs the new. If we merge for 3.x, we should add an additional option (I prefer calling it "ACES Fitted", but that is totally personal preference), but for 4.0 I think it is okay to replace completely unless any users have a strong objection. In this case because we still have the Reinhard and filmic options which look quite similar, I think it is best to just stick with the higher-quality ACES implementation. |
Probably off topic but why do people seem to prefer ACES more than Filmic? Is it because the new implementation is made for ACES or is it because ACES is more realistic(or physically accurate)? Btw, for someone like me who love realistic graphics, the new "ACES Fitted" tonemap just looks sooooo gorgeous. |
@Calinou I noticed this just now but why add this to 4.0 milestone after it's already closed(with related PRs merged)? |
For closed proposals, milestones indicate which Godot version the proposal was first implemented in. The first Godot version to implement this proposal is actually 3.4, now that godotengine/godot#52477 was merged. Therefore, I updated the milestone to |
Describe the project you are working on
(Deemed irrelevant)
Describe the problem or limitation you are having in your project
(Deemed irrelevant)
Describe the feature / enhancement and how it helps to overcome the problem or limitation
As of currently(specifically Godot 3.3.3), very bright lights and/or emissive materials in Godot retain the original emission or light color even at very high levels which can limit how realistic Godot games can look.
Light example(Filmic tonamap, default settings):
[This red light have the energy value of 70]
Emission example(Filmic tonamap, default settings):
[Same energy value for emission]
(Extra) same emission with glow enabled, also default settings + bicubic upscale:
Realistically, when something is very bright, the color will approach or even become white as this answer on Physics Stackexchange explains it. If this is to be implemented in Godot, it could make bright lights look a lot more realistic.
Describe how your proposal will work, with code, pseudo-code, mock-ups, and/or diagrams
I am not a graphics programmer, but I guess you can have Godot internally use something like R11G11B10 for colors, then clamp the values. This should make very bright colors become white after clamping.
If this enhancement will not be used often, can it be worked around with a few lines of script?
I don't think this can be implemented as a script because the need to change how the engine internally handle colors.
Is there a reason why this should be core and not an add-on in the asset library?
I also don't think addons can change how the engine handle colors.
The text was updated successfully, but these errors were encountered: