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

Add support for white parameter to AgX tonemapper (Mk. 2) #102425

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

allenwp
Copy link
Contributor

@allenwp allenwp commented Feb 4, 2025

Not cherry-pickable to 4.3, as AgX is only in 4.4.

Also limits white parameter from being set lower than 0.01 in the editor.

Draft State

I am intentionally leaving this PR in a draft state because I expect that the performance characteristics are not be suitable for merging this into Godot. Additionally, documentation must be further updated in this PR if it was to be merged.

Usage

In addition to resolving issues with using AgX with the Mobile renderer, the white parameter can be used to give higher contrast by decreasing white. This approach is higher quality than using the Environment's contrast adjustment and does not significantly affect the brightness of the scene like the previous incorrect approach.

16.0 white (Forward+) 2.0 white (Forward+)
image image

Consistent rendering between Mobile and Forward+

Because the Mobile renderer only provides values to the tonemapper up to 2.0, you can achieve a similar appearance with AgX between the Mobile and Forward+ renderers by setting the white paramter to 2.0 or less. This makes it easier to use AgX on a cross-platform game that must use the Mobile renderer on some platforms, but uses the Forward+ renderer on others.

Limitations

The white parameter does not function below values of 1.172, so this parameter is clipped to this minimum in EnvironmentStorage.

Performance

Using the visual profiler, Calinou's tonemapping test scene, ~4K window, and an NVIDIA 980 Ti on Windows 11, I recorded the following performance stats:

AgX (this PR): 1.35 ms
Tony McMapface: 1.29 ms
AgX (exact, hardcoded white): 1.22 ms
AgX (Godot 4.4 beta 2): 1.19 ms
ACES: 1.07 ms
Filmic: 1.0 ms
Rienhard: 0.93 ms
Linear: 0.82 ms

Fixes godotengine#101558 and godotengine#102416
Also limits white parameter from being set lower than 0.01 in the editor.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

AgX: Oscillations in sigmoid approximation AgX has low dynamic range output with Mobile renderer
2 participants