Skip to content

AgX: Oscillations in sigmoid approximation #102416

@allenwp

Description

@allenwp

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    Status

    Done

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions