forked from AuthorityFX/afx-nuke-gizmos
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAFXSoftClip.gizmo
More file actions
94 lines (91 loc) · 2.31 KB
/
AFXSoftClip.gizmo
File metadata and controls
94 lines (91 loc) · 2.31 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
#! /usr/local/Nuke10.5v1/libnuke-10.5.1.so -nx
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
#
# Copyright (C) 2012-2017, Ryan P. Wilson
#
# Authority FX, Inc.
# www.authorityfx.com
# Algorithms from https://github.com/AuthorityFX/afx-nuke-plugins/blob/master/src/afx_soft_clip.cpp
version 10.5 v1
Gizmo {
inputs 2
addUserKnob {20 AFXSoftClip}
addUserKnob {41 clip l Clip T Ctrls.clip}
addUserKnob {41 knee l Knee T Ctrls.knee}
addUserKnob {41 metric l Metric T Ctrls.metric}
addUserKnob {41 red l Red -STARTLINE T Ctrls.red}
addUserKnob {41 green l Green -STARTLINE T Ctrls.green}
addUserKnob {41 blue l Blue -STARTLINE T Ctrls.blue}
addUserKnob {41 alpha l Alpha -STARTLINE T Ctrls.alpha}
}
Input {
inputs 0
name mask
xpos 323
ypos -292
number 1
}
Dot {
name Dot1
xpos 356
ypos -115
}
Input {
inputs 0
name Input
xpos 50
ypos -289
}
Dot {
name Dot2
xpos 83
ypos -205
}
set N1aec90f0 [stack 0]
Expression {
inputs 1+1
temp_name0 luma
temp_expr0 "0.3*r + 0.59*g + 0.11*b"
temp_name1 lightness
temp_expr1 "pow(0.2126*r + 0.7152*g + 0.0722*b, 1/3)"
temp_name2 metric
temp_expr2 "Ctrls.metric == 0 ? max(r, g, b) : Ctrls.metric == 1 ? luma : lightness"
temp_name3 scale
temp_expr3 "Ctrls.clip * pow(tanh(pow(metric / Ctrls.clip, Ctrls.knee)), 1.0 / Ctrls.knee) / max(metric, 0.000001)"
expr0 "Ctrls.red && metric > 0 ? r * scale : r"
expr1 "Ctrls.green && metric > 0 ? g * scale : g"
expr2 "Ctrls.blue && metric > 0 ? b * scale : b"
channel3 alpha
expr3 "Ctrls.alpha && a > 0 ? Ctrls.clip * pow(tanh(pow(a / Ctrls.clip, Ctrls.knee)), 1.0 / Ctrls.knee) : a"
name soft_clip1
xpos 50
ypos -119
}
Output {
name Output1
xpos 50
ypos -23
}
push $N1aec90f0
NoOp {
name Ctrls
xpos 183
ypos -209
addUserKnob {20 Controls}
addUserKnob {7 clip l Clip R 0 10}
clip 5
addUserKnob {7 knee l Knee}
knee 0.5
addUserKnob {4 metric l Metric M {Value Luminance Lightness ""}}
metric Lightness
addUserKnob {6 red l Red -STARTLINE}
red true
addUserKnob {6 green l Green -STARTLINE}
green true
addUserKnob {6 blue l Blue -STARTLINE}
blue true
addUserKnob {6 alpha l Alpha -STARTLINE}
}
end_group