Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adds a Color Correct node #1086

Merged
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions libraries/stdlib/stdlib_defs.mtlx
Original file line number Diff line number Diff line change
Expand Up @@ -2901,6 +2901,35 @@
<input name="lumacoeffs" type="color3" value="0.2722287, 0.6740818, 0.0536895" enum="acescg, rec709, rec2020, rec2100" enumvalues="0.2722287,0.6740818,0.0536895, 0.2126,0.7152,0.0722, 0.2627,0.6780,0.0593, 0.2627,0.6780,0.0593" />
<output name="out" type="color4" defaultinput="in" />
</nodedef>

<!--
Node: <colorcorrect> Supplemental Node
Combines various adjustment nodes into one, artist-friendly color correction node.
-->
<nodedef name="ND_colorcorrect_color3" node="colorcorrect" nodegroup="adjustment">
<input name="in" type="color3" uiname="Input Color" value="1, 1, 1" />
<input name="hue" type="float" uiname="Hue" uisoftmin="0.0" uisoftmax="1.0" value="0" />
<input name="saturation" type="float" uiname="Saturation" uisoftmin="0.0" uisoftmax="1.0" value="1" />
<input name="gamma" type="float" uiname="Gamma" uisoftmin="0.0" uisoftmax="3.0" value="1" />
<input name="lift" type="float" uiname="Lift" uisoftmin="0.0" uisoftmax="1.0" value="0" />
jstone-lucasfilm marked this conversation as resolved.
Show resolved Hide resolved
<input name="gain" type="float" uiname="Gain" uisoftmin="0.0" uisoftmax="1.0" doc="Multiplier increases lighter color values, leaving black values unchanged." value="1" />
<input name="contrast" type="float" uiname="Contrast" uisoftmin="0.0" uisoftmax="1.0" doc="Linearly increase or decrease the color contrast." value="1" />
<input name="contrastpivot" type="float" uiname="Contrast Pivot" uisoftmin="0.0" uisoftmax="1.0" doc="Pivot value around which contrast applies. This value will not change as contrast is adjusted." value="0.5" />
<input name="exposure" type="float" uiname="Exposure" uisoftmin="-1.0" uisoftmax="1.0" doc="Multplier which increases or decreases color brightness by 2^value." value="0" />
<output name="out" type="color3" />
</nodedef>
<nodedef name="ND_colorcorrect_color4" node="colorcorrect" nodegroup="adjustment">
<input name="in" type="color4" uiname="Input Color" value="1, 1, 1, 0" />
<input name="hue" type="float" uiname="Hue" uisoftmin="0.0" uisoftmax="1.0" value="0" />
<input name="saturation" type="float" uiname="Saturation" uisoftmin="0.0" uisoftmax="1.0" value="1" />
<input name="gamma" type="float" uiname="Gamma" uisoftmin="0.0" uisoftmax="3.0" value="1" />
<input name="lift" type="float" uiname="Lift" uisoftmin="0.0" uisoftmax="1.0" value="0" />
<input name="gain" type="float" uiname="Gain" uisoftmin="0.0" uisoftmax="1.0" doc="Multiplier increases lighter color values, leaving black values unchanged." value="1" />
<input name="contrast" type="float" uiname="Contrast" uisoftmin="0.0" uisoftmax="1.0" doc="Linearly increase or decrease the color contrast." value="1" />
<input name="contrastpivot" type="float" uiname="Contrast Pivot" uisoftmin="0.0" uisoftmax="1.0" doc="Pivot value around which contrast applies. This value will not change as contrast is adjusted." value="0.5" />
<input name="exposure" type="float" uiname="Exposure" uisoftmin="-1.0" uisoftmax="1.0" doc="Multplier which increases or decreases color brightness by 2^value." value="0" />
<output name="out" type="color4" />
</nodedef>

<!-- ======================================================================== -->
<!-- Compositing nodes -->
Expand Down
91 changes: 91 additions & 0 deletions libraries/stdlib/stdlib_ng.mtlx
Original file line number Diff line number Diff line change
Expand Up @@ -1887,6 +1887,97 @@
</mix>
<output name="out" type="color4" nodename="N_mix_color4" />
</nodegraph>

<!--
Node: <colorcorrect> Supplemental Node
Combines various adjustment nodes into one, artist-friendly color correction node.
-->
<nodegraph name="NG_colorcorrect_color3" nodedef="ND_colorcorrect_color3">
<multiply name="N_exposure" type="color3">
<input name="in1" type="color3" nodename="N_contrast" />
<input name="in2" type="float" nodename="N_exposurepwr" />
</multiply>
<output name="out" type="color3" nodename="N_exposure" />
<contrast name="N_contrast" type="color3">
<input name="in" type="color3" nodename="N_gain" />
<input name="amount" type="float" interfacename="contrast" />
<input name="pivot" type="float" interfacename="contrastpivot" />
</contrast>
<power name="N_exposurepwr" type="float">
<input name="in2" type="float" interfacename="exposure" />
<input name="in1" type="float" value="2" />
</power>
<multiply name="N_gain" type="color3">
<input name="in1" type="color3" nodename="N_liftadd" />
<input name="in2" type="float" interfacename="gain" />
</multiply>
<add name="N_liftadd" type="color3">
<input name="in1" type="color3" nodename="N_liftmult" />
<input name="in2" type="float" interfacename="lift" />
</add>
<multiply name="N_liftmult" type="color3">
<input name="in1" type="color3" nodename="N_gamma" />
<input name="in2" type="float" nodename="N_liftsubtract" />
</multiply>
<range name="N_gamma" type="color3">
<input name="in" type="color3" nodename="N_saturation" />
<input name="gamma" type="float" interfacename="gamma" />
<input name="inlow" type="float" value="0" />
<input name="inhigh" type="float" value="1" />
<input name="outlow" type="float" value="0" />
<input name="outhigh" type="float" value="1" />
<input name="doclamp" type="boolean" value="false" />
</range>
<subtract name="N_liftsubtract" type="float">
<input name="in2" type="float" interfacename="lift"/>
<input name="in1" type="float" value="1" />
</subtract>
<saturate name="N_saturation" type="color3">
<input name="in" type="color3" nodename="N_hsvadjust" />
<input name="amount" type="float" interfacename="saturation"/>
<input name="lumacoeffs" type="color3" />
</saturate>
<hsvadjust name="N_hsvadjust" type="color3">
<input name="in" type="color3" interfacename="in" />
<input name="amount" type="vector3" nodename="N_parm2hue" />
</hsvadjust>
<combine3 name="N_parm2hue" type="vector3">
<input name="in1" type="float" interfacename="hue" />
<input name="in2" type="float" value="1" />
<input name="in3" type="float" value="1" />
</combine3>
</nodegraph>
<nodegraph name="NG_colorcorrect_color4" nodedef="ND_colorcorrect_color4">
<output name="out" type="color4" nodename="N_combine_with_alpha" />
<separate4 name="N_split_color4" type="multioutput">
<input name="in" type="color4" interfacename="in" />
</separate4>
<combine3 name="N_combine_color" type="color3">
<input name="in1" type="float" nodename="N_split_color4" output="outr" />
<input name="in2" type="float" nodename="N_split_color4" output="outg" />
<input name="in3" type="float" nodename="N_split_color4" output="outb" />
</combine3>
<colorcorrect name="N_colorcorrect" type="color3">
<input name="in" type="color3" nodename="N_combine_color" />
<input name="hue" type="float" interfacename="hue" />
<input name="saturation" type="float" interfacename="saturation" />
<input name="gamma" type="float" interfacename="gamma" />
<input name="lift" type="float" interfacename="lift" />
<input name="gain" type="float" interfacename="gain" />
<input name="contrast" type="float" interfacename="contrast" />
<input name="contrastpivot" type="float" interfacename="contrastpivot" />
<input name="exposure" type="float" interfacename="exposure" />
</colorcorrect>
<separate3 name="N_split_color" type="multioutput">
<input name="in" type="color3" nodename="N_colorcorrect" />
</separate3>
<combine4 name="N_combine_with_alpha" type="color4">
<input name="in1" type="float" nodename="N_split_color" output="outr" />
<input name="in2" type="float" nodename="N_split_color" output="outg" />
<input name="in3" type="float" nodename="N_split_color" output="outb" />
<input name="in4" type="float" nodename="N_split_color4" output="outa" />
</combine4>
</nodegraph>

<!-- ======================================================================== -->
<!-- Compositing nodes -->
Expand Down