Well I learned something new today, because I didn't actually know that the
grade node did this. The grade node is not telling the whole truth about
the expression in its info.
I laid out pretty much the same thing (I don't have access to Nuke 8, so I
set up virtually the same thing as yours but using an expression node), and
I discovered that the Grade node doesn't do a straight pow() function for
the gamma above 1 or below 0. It does what you'd expect from 0 to 1, but
above 1, it's not a power curve, but a flat line, with the slope of
whatever the gamma exponent is.
Below is what I was playing with in nuke. It has the expression node which
does the same as your blinkscript did, and the grade node you had, as well
as an expression node that visualizes the color curve (just view it, you'll
see what I mean. View the "GammaCurve" node, and then connect that to the
other nodes to see what's going on), and finally an expression node that
includes the corrected expression, which uses different expressions for
above 1 and below 0.
set cut_paste_input [stack 0]
version 7.0 v9
push $cut_paste_input
Ramp {
p0 {0 0}
p1 {2048 0}
color {100 100 100 1}
name Ramp2
selected true
xpos -73
ypos -78
}
Grade {
blackpoint 0.25
black_clamp false
name Grade2
selected true
xpos -73
ypos -40
}
set N3b094970 [stack 0]
Expression {
temp_name0 A
temp_expr0
Grade6.multiply*(Grade6.white-Grade6.black)/(Grade6.whitepoint-Grade6.blackpoint)
temp_name1 B
temp_expr1 Grade6.add+Grade6.lift-A*Grade6.blackpoint
temp_name2 exp
temp_expr2 1/Grade6.gamma
expr0 r<0?A*r+B:r>1?(r-1)*exp+1:pow(A*r+B,exp)
expr1 r<0?A*r+B:r>1?(r-1)*exp+1:pow(A*r+B,exp)
expr2 r<0?A*r+B:r>1?(r-1)*exp+1:pow(A*r+B,exp)
name CorrectedGradeExpression
selected true
xpos 152
ypos 24
}
push $N3b094970
Expression {
temp_name0 A
temp_expr0
Grade6.multiply*(Grade6.white-Grade6.black)/(Grade6.whitepoint-Grade6.blackpoint)
temp_name1 B
temp_expr1 Grade6.add+Grade6.lift-A*Grade6.blackpoint
temp_name2 exp
temp_expr2 1/Grade6.gamma
expr0 pow(A*r+B,exp)
expr1 pow(A*g+B,exp)
expr2 pow(A*b+B,exp)
name UncorrectedGradeExpression
selected true
xpos 20
ypos 23
}
set N3b115410 [stack 0]
Expression {
expr0 floor(r*20)==y-20?1:0
expr1 floor(g*20)==y-20?1:0
expr2 floor(b*20)==y-20?1:0
name GammaCurve
label "Illustrates gamma curve"
selected true
xpos 90
ypos 153
}
push $N3b115410
push $N3b094970
Grade {
gamma 2.3
black_clamp false
name Grade6
selected true
xpos -202
ypos 22
}
Difference {
inputs 2
output rgba.red
name Difference1
selected true
xpos -101
ypos 166
}
On Sat, Jan 10, 2015 at 6:04 AM, Mads Lund <[email protected]> wrote:
> Hey Guys.
>
> I find it super convenient that some of the node actually explains how
> they operate, so that you can re-create them in your expressions and blink
> scripts.
> However the equation descriped in the Gradenode does not match the actuall
> output of the node
>
> A = multiply*(gain-lift)/(whitepoint-blackpoint)
>
> B = offset + lift - A*blackpoint
>
> output = pow(A*input+B,1/gamma)
>
>
> Here is a little comparison:
>
>
>
> set cut_paste_input [stack 0]
>
> version 8.0 v4
>
> push $cut_paste_input
>
> Ramp {
>
> p0 {0 408}
>
> p1 {1924 426}
>
> color 10000
>
> name Ramp2
>
> selected true
>
> xpos -2
>
> ypos 379
>
> }
>
> set Ne890edf0 [stack 0]
>
> BlinkScript {
>
> ProgramGroup 1
>
> KernelDescription "1 \"Grade\" iterate componentWise
> 3aed9d965918ead671ab9383439b4816a7772727775caa4b995181fa06c4c03e 2 \"src\"
> Read Point \"dst\" Write Point 0"
>
> kernelSource "kernel Grade : ImageComputationKernel<eComponentWise>\n\{\n
> Image<eRead, eAccessPoint, eEdgeClamped> src;\n Image<eWrite> dst;\n
> void process() \{\n float4 Colors = src();\n float input =
> Colors.x;\n float blackpoint = 0.0f;\n float whitepoint = 1.0f;\n
> float lift = 0.0f;\n float gain = 0.01f;\n float multiply = 1.0f;\n
> float offset = 0.0f;\n float gamma = 2.0f;\n float A =
> multiply*(gain-lift)/(whitepoint-blackpoint);\n float B = offset + lift
> - A*blackpoint;\n float output = pow(A*input+B,1/gamma);\n dst() =
> output;\n \}\n\};"
>
> rebuild ""
>
> name BlinkScript1
>
> selected true
>
> xpos -86
>
> ypos 423
>
> }
>
> push $Ne890edf0
>
> Grade {
>
> white 0.01
>
> gamma 2
>
> black_clamp false
>
> enable_mix_luminance false
>
> name Grade6
>
> selected true
>
> xpos 78
>
> ypos 431
>
> }
>
> Difference {
>
> inputs 2
>
> output rgba.red
>
> name Difference1
>
> selected true
>
> xpos -12
>
> ypos 494
>
> }
>
>
>
> Am i missing something, and or do you guys know what is missing?
>
>
> _______________________________________________
> Nuke-users mailing list
> [email protected], http://forums.thefoundry.co.uk/
> http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-users
>
--
Joe Laude
_______________________________________________
Nuke-users mailing list
[email protected], http://forums.thefoundry.co.uk/
http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-users