Add ACES-based color management (MIXER COLORSPACE) to the OpenGL mixer#1758
Open
C-alcaide wants to merge 1 commit into
Open
Add ACES-based color management (MIXER COLORSPACE) to the OpenGL mixer#1758C-alcaide wants to merge 1 commit into
C-alcaide wants to merge 1 commit into
Conversation
Adds a per-layer ACES-based color management stage to the OpenGL image mixer, exposed via a new MIXER COLORSPACE AMCP command. Converts a layer between transfer functions (EOTFs/OETFs) and color gamuts, applies an exposure adjustment, and optionally runs a tone-mapping operator, all in linear light on the GPU. The grading path is gated behind a color_grading shader uniform that defaults to off, so the existing shader output is unchanged when the command is not used. - core::color_grade struct added to image_transform (exposure tween + equality wiring in frame_transform.cpp) - transform combination handled in accelerator/ogl/util/transforms.cpp - shader.frag: EOTF/OETF/tone-map helpers + gated color-management block - image_kernel.cpp: gamut matrices and uniform setup - AMCPCommandsImpl.cpp: MIXER COLORSPACE command, parsers, registration
C-alcaide
marked this pull request as ready for review
June 21, 2026 11:08
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Disclamer: AI powered PR. Since we're just applying industry standards and color science it should be pretty straightforward. This will be helpful in situations where the files don't have color space metdata or it's wrong (unreal engine exporting prores files does this, for example). This is also vital for HDR pipelines, since now we have full control of the files EOTFs and OETFs. I started this work some months ago and I think it's now refined enough to join the official project if you deem it appropiate.
There are equivalent vulkan mixer shaders that I could merge as well, but I think it's better to focus on the current state of the server for now.
Summary
This PR adds a per-layer ACES-based color management stage to the OpenGL image mixer, exposed through a new
MIXER COLORSPACEAMCP command. It lets an operator convert a layer between transfer functions (EOTFs/OETFs) and color gamuts, apply an exposure adjustment, and optionally run a tone-mapping operator — all in linear light on the GPU.This is the first in a planned series of small PRs upstreaming color-grading features. It is intentionally self-contained: no channel configuration, no automatic HDR/SDR conversion, no new render-graph plumbing. When
MIXER COLORSPACEis not used, the shader path is unchanged (the grading block is gated behind acolor_gradinguniform that defaults to off).What it does
For each layer with color management enabled, the fragment shader runs this pipeline in order:
AMCP usage
input_transfer/output_transfer:LINEAR,SRGB,REC709,PQ,HLG,LOGC3,SLOG3input_gamut/output_gamut:BT709,BT2020,DCIP3,ACES_AP0,ACES_AP1(aliasACESCG),ARRI_WG3,SGAMUT3_CINEtonemapping:NONE,REINHARD,ACES_FILMIC,ACES_RRT,ACES_RRT_709,ACES_RRT_P3,ACES_RRT_2020_PQexposure: linear multiplier (default1.0)output_transferdefaults toSRGBwhen omitted; gamuts/tonemapping default to their first value.Calling
COLORSPACEwith no arguments queries the current state.COLORSPACE NONEdisables grading for the layer.Examples
Implementation notes
core::color_gradestruct added toimage_transform(transform-tweened exposure; equality + tween wiring inframe_transform.cpp).accelerator/ogl/util/transforms.cpp(a child layer's grade overrides the inherited one when enabled).shader.frag: EOTF/OETF/tone-map helpers plus one contiguous color-management block inmain(), all gated behindcolor_grading.image_kernel.cppsets the uniforms and the gamut matrices. Display peak luminance for the HLG OOTF path is currently fixed at 1000 nits.MIXER COLORSPACEinAMCPCommandsImpl.cpp.Testing
casparcg.exelinks with no warnings from the changed files.color_gradingis off.Full operator documentation will be added to the wiki.