godotengine / godotengine/godot

ACES tonemapper uses incorrect gamma curve

Open
#87,251 13 comments 2 reactions 0 assignees View on GitHub
discussion topic:3d topic:rendering
Dominant language
C++
Stars
117k
Forks
26.8k
PR merge metrics
PR metrics pending

Description

### Tested versions

Godot v4.2.stable
Godot v4.2.1.stable

### System information

Godot v4.2.1.stable - Windows 10.0.19045 - Vulkan (Forward+) - dedicated NVIDIA GeForce RTX 3070 (NVIDIA; 31.0.15.3742) - Intel(R) Core(TM) i5-8600K CPU @ 3.60GHz (6 Threads)

### Issue description

Scenes displayed with the ACES tonemapper show extremely dark mids, with overblown contrast and saturation in the highlights.

linear:
![image](https://github.com/godotengine/godot/assets/156802459/6012aa82-a77c-481b-b480-8b405e28e7c1)

Reinhard:
![image](https://github.com/godotengine/godot/assets/156802459/13cb784d-3c97-4148-b944-2d6236f09b62)

filmic:
![image](https://github.com/godotengine/godot/assets/156802459/af815e08-c2c0-4efb-bba6-f7dfd2f473b1)

ACES:
![image](https://github.com/godotengine/godot/assets/156802459/a28d5a5e-c17e-4f09-b7b8-7d9d347f162b)

It appears that the tonecurve is assuming an encoding gamma, while the data is in fact linear. To demonstrate, here is the screenshot in a color managed After Effects project using the ACES/rec709 display transform:

![image](https://github.com/godotengine/godot/assets/156802459/ed5067f6-1888-4283-b76f-62e1deca1513)
Still very dark (no exposure compensation), but much more realistic and manageable. This is what I would expect.

Here is the same but using After Effect's ACES/sRGB display transform:

![image](https://github.com/godotengine/godot/assets/156802459/6748dcb1-26b1-4319-9823-da9adc78ba44)
This is behaving similarly to Godot's tonemapper, accounting for the 1.8f exposure bias in Godot's tonemap code making it darker. sRGB and rec709 use the same gamut but have different gamma curves.

To emphasise, the issue is not that the scene is too dark. It's a dark scene and I would expect to have to compensate somehow when using ACES anyway. the issue is unmanageably high contrast and oversaturated colors between highlights and midtones, indicative of overcorrected gamma. Here is the scene in Godot's ACES tonemapper with brighter lights and higher exposure respectively:

![image](https://github.com/godotengine/godot/assets/156802459/789810f2-2670-41b4-9551-1025fae414ae)
![image](https://github.com/godotengine/godot/assets/156802459/f0256c0f-365f-4728-8b05-9fa8c84e91a9)
The contrast is way too high, highlights are way too blown out, high mids are way too saturated. As it stands the tonemapper is neither ACES compliant nor useable aesthetically.

### Steps to reproduce

- Apply ACES tonemapper to any 3d scene

### Minimal reproduction project (MRP)

[ACES tonemap gamma mrp.zip](https://github.com/godotengine/godot/files/13953767/ACES.tonemap.gamma.mrp.zip)

Contributor guide

Open the contributing guide

Research direction

Reproduce the ACES tonemapper behavior with the linked minimal reproduction project and compare it with the linear, Reinhard, and filmic results shown in the issue. Then trace the ACES tonemapper implementation and verify the gamma behavior against the supplied After Effects comparisons; done means mids, highlights, contrast, and saturation behave as described for an ACES display transform.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
computer-graphics
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.