Add support for white parameter to AgX tonemapper (Mk. 2) #102425
+62
−69
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.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 thewhite
paramter to2.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 of1.172
, so this parameter is clipped to this minimum inEnvironmentStorage
.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