Skip to content

Commit

Permalink
updating ref gamut compress
Browse files Browse the repository at this point in the history
  • Loading branch information
sharktacos committed Sep 12, 2021
1 parent 2ac70a5 commit 70bd4a4
Show file tree
Hide file tree
Showing 4 changed files with 150 additions and 332 deletions.
6 changes: 3 additions & 3 deletions StdX_ACES/config_ANM_OCIOv1.ocio
Original file line number Diff line number Diff line change
Expand Up @@ -50,16 +50,16 @@ displays:
- !<View> {name: Filmic Look, colorspace: Output - sRGB, look: "LMT_gamut, LMT_filmic"}
- !<View> {name: ACES - Gamut Compress, colorspace: Output - sRGB, look: LMT_gamut}

Rec.1886 / Rec.709 video:
Rec.1886 - Rec.709 video:
- !<View> {name: Neutral Look, colorspace: Rec.709 - Look Neutral}
- !<View> {name: Filmic Look, colorspace: Rec.709 - Look Filmic}
- !<View> {name: Show Look, colorspace: Rec.709 - Look Show}
- !<View> {name: ACES 1.0 SDR-video, colorspace: Output - Rec.709}
- !<View> {name: un-tone-mapped, colorspace: Un-tone-mapped - BT.1886/Rec.709 2.4}


active_displays: [sRGB monitor, sRGB - Gamut Compress, Rec.1886 / Rec.709 video]
active_views: [Neutral Look, Filmic Look, Show Look, ACES 1.0 SDR-video, ACES - Gamut Compress, un-tone-mapped, Raw, Log]
active_displays: [sRGB monitor, Rec.1886 - Rec.709 video]
active_views: [Neutral Look, Filmic Look, Show Look, ACES 1.0 SDR-video, un-tone-mapped, Raw, Log]


looks:
Expand Down
127 changes: 103 additions & 24 deletions StdX_ACES/config_ANM_OCIOv2.ocio
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@ roles:
reference: Raw
rendering: ACEScg
scene_linear: ACEScg
# Nuke 8-bit default: #
matte_paint: Output - ACES 1.0 SDR-video (sRGB)
# Nuke 16-bit log default: #
texture_paint: ACEScct


file_rules:
Expand Down Expand Up @@ -52,16 +56,16 @@ displays:
sRGB:
- !<Views> [Neutral Look, Filmic Look, Show Look, ACES 1.0 SDR-video, Un-tone-mapped, Log, Raw]

sRGB - Gamut Compress:
- !<View> {name: Neutral Look, view_transform: Neutral View, looks: LMT_gamut, display_colorspace: sRGB - Gamut Compress}
- !<View> {name: Filmic Look, view_transform: Filmic View, looks: LMT_gamut, display_colorspace: sRGB - Gamut Compress}
- !<View> {name: ACES 1.0 SDR-video, view_transform: ACES 1.0 SDR-video, looks: LMT_gamut, display_colorspace: sRGB - Gamut Compress}
- !<Views> [Un-tone-mapped, Log, Raw]
# sRGB - Gamut Compress:
# - !<View> {name: Neutral Look, view_transform: Neutral View, looks: LMT_gamut, display_colorspace: sRGB - Gamut Compress}
# - !<View> {name: Filmic Look, view_transform: Filmic View, looks: LMT_gamut, display_colorspace: sRGB - Gamut Compress}
# - !<View> {name: ACES 1.0 SDR-video, view_transform: ACES 1.0 SDR-video, looks: LMT_gamut, display_colorspace: sRGB - Gamut Compress}
# - !<Views> [Un-tone-mapped, Log, Raw]

# Gamma 2.2 / Rec.709:
# Gamma 2.2 - Rec.709:
# - !<Views> [Neutral Look, Filmic Look, Show Look, ACES 1.0 SDR-video, Un-tone-mapped, Log, Raw]

Rec.1886 / Rec.709 video:
Rec.1886 - Rec.709 video:
- !<Views> [Neutral Look, Filmic Look, Show Look, ACES 1.0 SDR-video, Un-tone-mapped, Log, Raw]


Expand Down Expand Up @@ -128,7 +132,7 @@ looks:



inactive_colorspaces: [CIE-XYZ D65]
inactive_colorspaces: [CIE-XYZ D65, sRGB - Gamut Compress, Gamut Shaper, Gamma 2.2 - Rec.709, Rec.1886 - Rec.709 video, sRGB, Inverse sRGB Output, Premiere Pro - AP0 2.4 gamma, Premiere Pro - AP0 2.2 gamma, Premiere Pro - AP0 sRGB EOTF]



Expand Down Expand Up @@ -192,7 +196,7 @@ colorspaces:

- !<ColorSpace>
name: Gamut Shaper
family: File-io/Utility
family: Input/File-io
equalitygroup: ""
bitdepth: 32f
description: |
Expand Down Expand Up @@ -251,6 +255,7 @@ colorspaces:
encoding: log
to_scene_reference: !<BuiltinTransform> {style: "ACEScc_to_ACES2065-1"}

# Extra #
- !<ColorSpace>
name: Inverse sRGB Output
family: Input/File-io
Expand Down Expand Up @@ -300,12 +305,11 @@ colorspaces:
allocation: uniform
to_scene_reference: !<ExponentWithLinearTransform> {gamma: 2.4, offset: 0.055}


# Cameras #

- !<ColorSpace>
name: ARRI LogC (v3-EI800) / AlexaWideGamut
family: Input/Camera
name: ARRI LogC (v3-EI800) - AlexaWideGamut
family: Input/Camera/ARRI
description: |
Alexa-v3-LogC-EI800 (no camera black) to ACES2065-1 (SUP v3 color science)
isdata: false
Expand All @@ -314,8 +318,8 @@ colorspaces:
to_reference: !<BuiltinTransform> {style: "ARRI_ALEXA-LOGC-EI800-AWG_to_ACES2065-1"}

- !<ColorSpace>
name: RED Log3G10 / REDWideGamutRGB
family: Input/Camera
name: RED Log3G10 - REDWideGamutRGB
family: Input/Camera/RED
description: |
RED Log3G10 / REDWideGamutRGB (no camera black)
isdata: false
Expand All @@ -324,22 +328,97 @@ colorspaces:
to_reference: !<BuiltinTransform> {style: "RED_LOG3G10-RWG_to_ACES2065-1"}

- !<ColorSpace>
name: Sony SLog3 / SGamut3
family: Input/Camera
name: Sony SLog3 - SGamut3
family: Input/Camera/Sony
description: |
Sony SLog3 / SGamut3 (no camera black)
isdata: false
# categories: [ file-io ]
encoding: log
to_reference: !<BuiltinTransform> {style: "SONY_SLOG3-SGAMUT3_to_ACES2065-1"}

- !<ColorSpace>
name: Sony SLog3 - SGamut3Cine
family: Input/Camera/Sony
equalitygroup: ""
bitdepth: 32f
description: |
Convert Sony S-Log3 S-Gamut3.Cine to ACES2065-1

ACEStransformID: urn:ampas:aces:transformId:v1.5:ACEScsc.Academy.SLog3_SGamut3Cine_to_ACES.a1.1.0
isdata: false
# categories: [file-io]
encoding: log
allocation: uniform
to_scene_reference: !<BuiltinTransform> {style: SONY_SLOG3-SGAMUT3.CINE_to_ACES2065-1}

- !<ColorSpace>
name: Sony SLog3 - Venice SGamut3
family: Input/Camera/Sony
equalitygroup: ""
bitdepth: 32f
description: |
Convert Sony S-Log3 S-Gamut3 for the Venice camera to ACES2065-1

ACEStransformID: urn:ampas:aces:transformId:v1.5:ACEScsc.Academy.SLog3_Venice_SGamut3_to_ACES.a1.1.0
isdata: false
# categories: [file-io]
encoding: log
allocation: uniform
to_scene_reference: !<BuiltinTransform> {style: SONY_SLOG3-SGAMUT3-VENICE_to_ACES2065-1}

- !<ColorSpace>
name: Sony SLog3 - Venice SGamut3Cine
family: Input/Camera/Sony
equalitygroup: ""
bitdepth: 32f
description: |
Convert Sony S-Log3 S-Gamut3.Cine for the Venice camera to ACES2065-1

ACEStransformID: urn:ampas:aces:transformId:v1.5:ACEScsc.Academy.SLog3_Venice_SGamut3Cine_to_ACES.a1.1.0
isdata: false
# categories: [file-io]
encoding: log
allocation: uniform
to_scene_reference: !<BuiltinTransform> {style: SONY_SLOG3-SGAMUT3.CINE-VENICE_to_ACES2065-1}

- !<ColorSpace>
name: Canon CLog2 CGamut
family: Input/Camera/Canon
equalitygroup: ""
bitdepth: 32f
description: |
Convert Canon Log 2 Cinema Gamut to ACES2065-1

ACEStransformID: urn:ampas:aces:transformId:v1.5:ACEScsc.Academy.CLog2_CGamut_to_ACES.a1.1.0
isdata: false
# categories: [file-io]
encoding: log
allocation: uniform
to_scene_reference: !<BuiltinTransform> {style: CANON_CLOG2-CGAMUT_to_ACES2065-1}

- !<ColorSpace>
name: Canon CLog3 CGamut
family: Input/Camera/Canon
equalitygroup: ""
bitdepth: 32f
description: |
Convert Canon Log 3 Cinema Gamut to ACES2065-1

ACEStransformID: urn:ampas:aces:transformId:v1.5:ACEScsc.Academy.CLog3_CGamut_to_ACES.a1.1.0
isdata: false
# categories: [file-io]
encoding: log
allocation: uniform
to_scene_reference: !<BuiltinTransform> {style: CANON_CLOG3-CGAMUT_to_ACES2065-1}

- !<ColorSpace>
name: Log film scan (ADX10)
family: Input/Camera
family: Input/Camera/Film
description: |
ADX10 Academy Density Encoding
isdata: false
categories: [ file-io ]
# categories: [ file-io ]
encoding: log
to_reference: !<BuiltinTransform> {style: "ADX10_to_ACES2065-1"}

Expand All @@ -352,7 +431,7 @@ colorspaces:
family: Output
description: Output Neutral Look (sRGB display)
isdata: false
categories: [ file-io ]
# categories: [ file-io ]
encoding: sdr-video
from_reference: !<DisplayViewTransform> {src: ACES2065-1, display: sRGB, view: "Neutral Look"}

Expand All @@ -361,7 +440,7 @@ colorspaces:
family: Output
description: Output Neutral Look (sRGB display)
isdata: false
categories: [ file-io ]
# categories: [ file-io ]
encoding: sdr-video
from_reference: !<DisplayViewTransform> {src: ACES2065-1, display: sRGB, view: "Filmic Look"}

Expand All @@ -370,7 +449,7 @@ colorspaces:
family: Output
description: Output ACES 1.0 SDR-video (sRGB display)
isdata: false
categories: [ file-io ]
# categories: [ file-io ]
encoding: sdr-video
from_reference: !<DisplayViewTransform> {src: ACES2065-1, display: sRGB, view: "ACES 1.0 SDR-video"}

Expand All @@ -379,7 +458,7 @@ colorspaces:
family: Output
description: Output Show Look (sRGB display)
isdata: false
categories: [ file-io ]
# categories: [ file-io ]
encoding: sdr-video
from_reference: !<DisplayViewTransform> {src: ACES2065-1, display: sRGB, view: "Show Look"}

Expand Down Expand Up @@ -423,7 +502,7 @@ display_colorspaces:
- !<RangeTransform> {min_in_value: 0., min_out_value: 0., max_in_value: 1., max_out_value: 1.}

- !<ColorSpace>
name: Gamma 2.2 / Rec.709
name: Gamma 2.2 - Rec.709
family: Output
description: |
Gamma 2.2 monitor with Rec.709 or sRGB primaries
Expand All @@ -437,7 +516,7 @@ display_colorspaces:
- !<RangeTransform> {min_in_value: 0., min_out_value: 0., max_in_value: 1., max_out_value: 1.}

- !<ColorSpace>
name: Rec.1886 / Rec.709 video
name: Rec.1886 - Rec.709 video
family: Output
description: |
Rec.709 broadcast monitor with Rec.1886 gamma (2.4)
Expand Down
44 changes: 44 additions & 0 deletions StdX_ACES/software/Nuke/ACES_ref_gamut_compress.gizmo
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
Gizmo {
name ACES_RGC_blink
label "\[value direction]"
selected true
xpos -244
ypos -112
addUserKnob {20 GamutCompress l "ACES Reference Gamut Compress (blinkscript)"}
addUserKnob {6 use_gpu l "use gpu" t "use gpu for blinkscript node" -STARTLINE}
use_gpu true
addUserKnob {4 direction M {forward inverse}}
addUserKnob {20 info_tab l Info}
addUserKnob {26 info_label l " " T "<style> a:link \{ color: #ccc \}</style>\n<font color=#ccc>\n<b>ACES 1.3 Reference Gamut Compression</b><br>\nMaps out of gamut colors back into AP1.<br><br>Input image data is expected to be ACEScg.\n<br><br>Based on:<br><a href=https://github.com/ampas/aces-dev/blob/dev/transforms/ctl/lmt/LMT.Academy.GamutCompress.ctl>https://github.com/ampas/aces-dev/blob/dev/transforms/ctl/lmt/LMT.Academy.GamutCompress.ctl</a>"}
}
Input {
inputs 0
name Input
xpos -40
ypos -10
}
AddChannels {
name AddChannels
xpos -40
ypos 40
}
BlinkScript {
recompileCount 34
ProgramGroup 1
KernelDescription "2 \"GamutCompression\" iterate pixelWise 73c19a90997539f78bd63416346b872f79d9dbc3bc18da77d6bb4c62a2df7287 2 \"src\" Read Point \"dst\" Write Point 1 \"invert\" Bool 1 AA== 1 \"invert\" 1 1 3 \"thr\" Float 3 1 AAAAAAAAAAAAAAAAAAAAAA== \"lim\" Float 3 1 AAAAAAAAAAAAAAAAAAAAAA== \"p\" Float 1 1 AAAAAA=="
kernelSource "kernel GamutCompression : public ImageComputationKernel<ePixelWise> \{\n Image<eRead, eAccessPoint, eEdgeClamped> src;\n Image<eWrite> dst;\n\n param:\n bool invert;\n\n local:\n float3 thr;\n float3 lim;\n float p;\n\n void init() \{\n // thr is the percentage of the core gamut to preserve\n thr = float3(0.815f, 0.803f, 0.88f);\n\n // lim is the max distance from the gamut boundary that will be compressed\n lim = float3(1.147f, 1.264f, 1.312f);\n\n // Aggressiveness of the compression curve\n p = 1.2f;\n \}\n\n // calculate compressed distance\n float compress(float x, float l, float t) \{\n float cx, s;\n if (x < t) \{\n cx = x;\n \} else \{\n // power(p) compression function plot https://www.desmos.com/calculator/54aytu7hek\n if (l < 1.0001) \{\n return x; // disable compression, avoid nan\n \}\n s = (l-t)/pow(pow((1.0f-t)/(l-t),-p)-1.0f,1.0f/p); // calc y=1 intersect\n if (invert == 0) \{\n cx = t+s*((x-t)/s)/(pow(1.0f+pow((x-t)/s,p),1.0f/p)); // compress\n \} else \{\n if (x > (t + s)) \{\n cx = x; // avoid singularity\n \} else \{\n cx = t+s*pow(-(pow((x-t)/s,p)/(pow((x-t)/s,p)-1.0f)),1.0f/p); // uncompress\n \}\n \}\n \}\n return cx;\n \}\n\n\n void process(int2 pos) \{\n // source pixels\n SampleType(src) rgba = src();\n float3 rgb = float3(rgba.x, rgba.y, rgba.z);\n\n // achromatic axis \n float ach = max(rgb.x, max(rgb.y, rgb.z));\n\n // distance from the achromatic axis for each color component aka inverse rgb ratios\n // distance is normalized by achromatic, so that 1.0f is at gamut boundary, avoid 0 div\n float3 dist = ach == 0 ? float3(0.0f, 0.0f, 0.0f) : (ach-rgb)/fabs(ach);\n\n // compress distance with parameterized shaper function\n float3 cdist;\n cdist = float3(\n compress(dist.x, lim.x, thr.x),\n compress(dist.y, lim.y, thr.y),\n compress(dist.z, lim.z, thr.z));\n\n // recalculate rgb from compressed distance and achromatic\n // effectively this scales each color component relative to achromatic axis by the compressed distance\n float3 crgb = ach-cdist*fabs(ach);\n\n // write to output\n dst() = float4(crgb.x, crgb.y, crgb.z, rgba.w);\n \}\n\};"
useGPUIfAvailable {{parent.use_gpu x1 0}}
rebuild ""
GamutCompression_invert {{parent.direction}}
rebuild_finalise ""
name GamutCompress
selected true
xpos -40
ypos 100
}
Output {
name Output
xpos -40
ypos 172
}
end_group
Loading

0 comments on commit 70bd4a4

Please sign in to comment.