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

AgX: Oscillations in sigmoid approximation #102416

Open
allenwp opened this issue Feb 4, 2025 · 0 comments · May be fixed by #102425 or #102435
Open

AgX: Oscillations in sigmoid approximation #102416

allenwp opened this issue Feb 4, 2025 · 0 comments · May be fixed by #102425 or #102435

Comments

@allenwp
Copy link
Contributor

allenwp commented Feb 4, 2025

Tested versions

Reproducible in all versions with the AgX tonemapper (4.4 beta 1 onward)

System information

Godot v4.4.beta2 - Windows 11 (build 22631) - Multi-window, 2 monitors - Vulkan (Forward+) - dedicated NVIDIA GeForce GTX 980 Ti (NVIDIA; 31.0.15.4665) - 13th Gen Intel(R) Core(TM) i7-13700K (24 threads)

Issue description

The intended AgX tone mapping curve has the following properties:

  • Linear inputs of 0, 0.18, and white should result in linear outputs of 0, 0.18, and 1.0 respectively.
  • The curve between 0 and 0.18 should be a smooth concave curve
  • The curve between 0.18 and white should be a smooth convex curve

Because the AgX implementation was created using a simple polynomial regression, oscillations can be seen in the output:

AgX Godot AgX Approximation
Image Image
Image Image

This issue was not clearly visible with most of the test images, as many of those images were photos. Video games may use art styles composed of simple shapes and colours, which demonstrate this issue more clearly. The approximation creates banding on value transitions and decreases the saturation of colours:

AgX Godot AgX Approximation
Image Image
Image Image

Additionally, not much performance benefit is gained by using the polynomial approximation, compared to optimizing the original curve maths, because the approximation is applied in normalized log2 space.

For comparison, the ACES approximation by Stephen Hill is applied in linear space and does not use a simple polynomial regression—this is immensely higher performance and results in a tone mapping curve that has no oscillations.

Steps to reproduce

Compile Godot using one of the exact AgX implementations found here and compare with Godot 4.4 beta 2.

Minimal reproduction project (MRP)

oscillations.zip

@github-project-automation github-project-automation bot moved this to For team assessment in Rendering Issue Triage Feb 4, 2025
@AThousandShips AThousandShips added this to the 4.4 milestone Feb 4, 2025
allenwp added a commit to allenwp/godot that referenced this issue Feb 4, 2025
Fixes godotengine#101558 and godotengine#102416
Also limits white parameter from being set lower than 0.01 in the editor.
allenwp added a commit to allenwp/godot that referenced this issue Feb 4, 2025
@clayjohn clayjohn moved this from Unassessed to Not Critical in 4.x Release Blockers Feb 4, 2025
allenwp added a commit to allenwp/godot that referenced this issue Feb 4, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Not Critical
Status: For team assessment
2 participants