nob_chromatic_adaptation (Compatible with IFFS 2026.2.0 and up)
This Matchbox shader performs a chromatic adaptation alongside a linear colour-space conversion, optionally utilizing the perceptual CAM16.
The core method can be chosen via [CA Method], the following ones are implemented:
[Disable]: no chromatic adaptation, instead only transforms between input & output colour-spaces, also sometimes called absolute colourimetric;
[Bradford]: the traditional Bradford Transform (Luo et al., 1998), notably with its nonlinearity in the blue intermediate channel;
[Lin. Bradford]: a linear variant of the Bradford transformation; used, among other, for most of Flame’s own internal transformation matrices;
[Lin. CAT02]: the full chromatic adaptation as described by the CAM02/CAT02, for equal source & target viewing conditions;
[CAM16]: implements the nonlinear CAM16 (extended to support negative achromatic responses symmetrically), with respect to individual source & target viewing conditions; and
[Lin. CAT16]: the full chromatic adaptation as described by the CAM16/CAT16, for equal source & target viewing conditions.
This shader’s pipeline identifies input- & output colour-spaces (assumed scene-, or display-referred linear) by their primaries & white point.
The former can be chosen as a preset in [Colour Primaries], or selected [Custom], in which case the user is to define the coordinates for red green & blue primaries via [Primaries x] & [Primaries y] in the CIE xy chromaticity space.
Note that by nature, [CIE XYZ] always uses the E white point (and the controls for which are disabled). To convert from and/or to XYZ spaces with different virtual white points, use the overrides on the [CA Override] page. This is consistent with for example Flame’s own CIE XYZ-D65 colour-space when setting the override to [HD D65].
In all other cases, choosing the white point is done by one of several methods, determined by the respective setting of [Illuminant Type]:
[Native]: automatically chooses the white point corresponding to the primaries; note that this might be ambiguous or unintended for certain cases such as P3, for which one best selects another setting;
[Standard]: provides a selection of common white points in their usual (rounded) forms:
[ACES]: (0.32168, 0.33767) in CIE xy chromaticity space, as per ACES specification,
[ICC D50]: (0.9642, 1, 0.8249) in CIE XYZ, as per the ICC profile specification,
[HD D65]: (0.3127, 0.329) in CIE xy chromaticity space,
[DCI]: (0.314, 0.351) in CIE xy chromaticity space, as per SMPTE specification, and
[E]: equal energy white (1, 1, 1) in CIE XYZ;
[Temperature]: implements the Illuminant series D white, defined by:
[Temp]: the correlated colour temperature in Kelvin,
[Tint]: orthogonal tint to the daylight locus in CIE 1976 UCS, in units thereof, and
[Temperature shift]: since the definition of this illuminant series predates the fixing of the second radiation constant c₂, and by design, this method models the exact illuminant; the original illuminants correlate to now shifted temperatures - activating this toggle mimics the traditional behavior by multiplying [Temp] with c₂/(0.01438 m×K); and
[xy Coords]: CIE xy chromaticity space coordinates of the white point.
Note: for [Native], ACES primaries default to ACES white, [CIE XYZ] to E, and all others (including [Custom]) to [HD D65].
These controls are identical for the source & target colour-space.
Further, for using a white point different from the colour-space’s innate one to adapt from and/or to, the [CA Override] page provides controls for such overrides. Those utilize the same methods and settings as the in- & output colour-space controls, except for [Native]; but additionally implement:
[Disable]: doesn’t override the white point; and
[From Colour]: provides a colour selector to set the scene white to a colour with respect to the in, or output colour-space; the selected colour is internally normalized to CIE Y=1.
These controls are identical for the source & target white point override.
When using the CAM16, the following additional controls become available in the [Viewing Conditions] column (on page 1: [Controls] for 6 a column view, and page 2: [Target+Con] otherwise):
[Force Full CA]: by default, CAM16 does a partial chromatic adaptation to the internal working E white point (and back), the exact degree of which depending on the viewing conditions; this setting allows for instead forcing to use a full adaptation, for forward & backward transformation, respectively; as well as
controls for the parametric source & target viewing conditions ([Source] & [Target]):
[S]: encodes the surround parameters, as linearly interpolated between the CAM16 values for Dark, Dim & Average corresponding to entries of -1, 0 and 1, respectively,
[L_W]: the luminance of the reference white in nits, and
[L_A]: the luminance of the adapting field in nits.
Generally, L_A×Y_W=L_W×Y_b, where Y_b is the luminance factor of the background and Y_W is the luminance factor of the reference white. This relation can be used to derive either L_W or L_A if the other and Y_b (as well as Y_W) are fixed instead.
For enhanced accuracy, intermediate matrices and values are always processed in double precision arithmetic; yet since instead of performing these computations for each pixel, an interposed data sampler is generated, the computational overhead is constant and insignificant.
If even higher accuracy is needed, [Double Precision Processing] can be enabled, at the cost of performance.
Note that this shader does not perform any image scaling or reformatting, so the operation may be incorrect if the result image format does not match the input image format.
It is recommended to leave the [Output Resolution] as [Same As Input 1] - however, for tagging the [Result] with different colour-space, [User Defined] must be chosen. Still, in such cases, the format (in pixels and aspect ratio) must match the [Front]’s.
Colour-spaces themselves are neither inferred from [Front] nor automatically tagged for [Result], the user shall take care to maintain a consistent colour-space journey either through the aforementioned Matchbox setting, or Colour Mgmt nodes.
Adaptive Degradation is supported by this shader, which if active disables double precision processing.
This shader is licensed under the terms of the MIT license.
For questions contact:
nobbl211 _at_ gmail.com
Version notes
added support for arbitrary linear colour spaces, defined by primaries and white point (with some presets)
restructured UI, splitting the colour-space- & scene-white-point controls up (the latter available as “Override”)
replaced CAM02 with CAM16 & added CAT16 (keeping the linear CAT02 too)
renamed the linear Bradford CA to - well - “Lin. Bradford”, and added the traditional non-linear Bradford method
higher precision pre-calculations (with optional full double precision pipeline)
re-wrote the description to be more … descriptive
Older versions that shader
28th of December this year, around 17:03
Downloadadded support for arbitrary linear colour spaces, defined by primaries and white point (with some presets)
restructured UI, splitting the colour-space- & scene-white-point controls up (the latter available as “Override”)
replaced CAM02 with CAM16 & added CAT16 (keeping the linear CAT02 too)
renamed the linear Bradford CA to - well - “Lin. Bradford”, and added the traditional non-linear Bradford method
higher precision pre-calculations (with optional full double precision pipeline)
re-wrote the description to be more … descriptive
Something wrong with this page or the download?
Contact the site custodians via email, if:
- This shader is obviously incomplete (missing files, not loading) etc.
- This shader violates IP rules (is pirated) or contains harmful content
- You are having problems with the shader installer (INSTALL.command) or the download.
How to get help with this particular shader
Sadly, the custodians likely will not be able to explain to you how a shader works or debug its code, or fix it for you. That is the (volountary) role of the shader author.
If the shader does not work on your system or you have questions about it - read the shader description, and try to find the email address of the shader author. Contact them for any issues – letting them know whether you are on Mac or Linux, what version of IFFS you are running etc. will likely help. Be kind and respectful. If you can't get hold of the author - you can try asking in the Logik forum at logik.tv and ask whether anyone could help you debug a particular shader not working.