set cut_paste_input [stack 0]
push $cut_paste_input
Group {
name Tonemap_PiecewiseHyperbolicSimple
label "Piecewise Hyperbolic\nSimple"
addUserKnob {20 Tonemap}
addUserKnob {78 g l grey t "input -> output grey" n 2}
g {0.18 0.1}
addUserKnob {78 w l white t "input -> output white" n 2}
w {16 1}
addUserKnob {7 p l contrast R 0.8 2}
p 1.2
addUserKnob {78 s l scale n 2}
s {{pow(g.1,1/p)/g.0} {(s.0*pow(w.0-g.0,2)*pow(g.0*s.0-pow(w.1,1/p),2))/pow(s.0*w.0-pow(w.1,1/p),2)}}
addUserKnob {4 direction M {forward inverse}}
addUserKnob {26 "" +STARTLINE}
addUserKnob {26 plot_label l " " T "desmos plot"}
}
Input {
inputs 0
name Input
xpos -40
ypos 20
}
set Naca4bf0 [stack 0]
Expression {
temp_name0 h0
temp_expr0 g.0-sqrt(s.1/s.0)
temp_name1 h1
temp_expr1 s.0*g.0+sqrt(s.0*s.1)
expr0 r>g.1?h0-s.1/(pow(r,1/p)-h1):pow(r,1/p)/s.0
expr1 g>g.1?h0-s.1/(pow(g,1/p)-h1):pow(g,1/p)/s.0
expr2 b>g.1?h0-s.1/(pow(b,1/p)-h1):pow(b,1/p)/s.0
name InvCompress
selected true
xpos 70
ypos 81
}
push $Naca4bf0
Expression {
temp_name0 h0
temp_expr0 g.0-sqrt(s.1/s.0)
temp_name1 h1
temp_expr1 s.0*g.0+sqrt(s.0*s.1)
expr0 r>g.0?pow(h1-s.1/(r-h0),p):pow(s.0*r,p)
expr1 g>g.0?pow(h1-s.1/(g-h0),p):pow(s.0*g,p)
expr2 b>g.0?pow(h1-s.1/(b-h0),p):pow(s.0*b,p)
expr3 h1
name Compress
xpos -150
ypos 81
}
Switch {
inputs 2
which {{parent.direction}}
name SwitchDirection
xpos -40
ypos 141
}
Output {
name Output
xpos -40
ypos 200
}
end_group