Last active
August 29, 2015 14:01
-
-
Save draconiansolo/3f06be34f66245c1bcfb to your computer and use it in GitHub Desktop.
Dodgy zdepth to defocus expression
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
set cut_paste_input [stack 0] | |
version 8.0 v6 | |
push $cut_paste_input | |
Group { | |
name ZDeefucoos_Depth_to_Direct | |
help "So confuse?\nThis transforms your depth (in meters) into a beautiful defocus map that can be used with the direct mode in Zdefocus and such.\nThe value of the circle of confusion is sensor dependent but seems to always be somewhat around 0.025." | |
tile_color 0xff5e00ff | |
label "of Doom" | |
selected true | |
xpos 6248 | |
ypos 9152 | |
addUserKnob {20 User} | |
addUserKnob {7 focusDistance l "Focus Distance"} | |
focusDistance {{curve R k x1014 27 s9.999999747e-05 t-1 v1.573653698 x1028 3.3 s0 x1052 5 s0}} | |
addUserKnob {41 f l "Focal Length" T MergeExpression2.f} | |
addUserKnob {41 N l f-Number T MergeExpression2.N} | |
addUserKnob {41 c l "Circle of Confusion" T MergeExpression2.c} | |
} | |
Constant { | |
inputs 0 | |
color {{parent.focusDistance}} | |
name Constant4 | |
xpos 440 | |
ypos 345 | |
} | |
Input { | |
inputs 0 | |
name Depth | |
xpos 561 | |
ypos 86 | |
} | |
Clamp { | |
minimum_enable false | |
maximum {{parent.MergeExpression2.h}} | |
name Clamp2 | |
selected true | |
xpos 561 | |
ypos 272 | |
} | |
MergeExpression { | |
inputs 2 | |
temp_name0 s | |
temp_expr0 Ar | |
temp_name1 bl | |
temp_expr1 abs((f/N)*((Br-s)/(s+abs(Br-s)))) | |
temp_name2 blur | |
temp_expr2 "isnan(bl)?1:bl " | |
expr0 blur | |
expr1 blur | |
expr2 blur | |
expr3 blur | |
name MergeExpression2 | |
xpos 561 | |
ypos 368 | |
addUserKnob {20 User} | |
addUserKnob {7 f l "Focal Length"} | |
f 40 | |
addUserKnob {7 N l f-Number} | |
N 4 | |
addUserKnob {7 c l "Circle of Confusion"} | |
c 0.025 | |
addUserKnob {7 h l Hyperfocal} | |
h {{pow(f,2)/(N*c)}} | |
} | |
Output { | |
name Output1 | |
xpos 561 | |
ypos 468 | |
} | |
end_group |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment