Skip to content

Instantly share code, notes, and snippets.

@drewgillievfx
Created May 10, 2020 17:06
Show Gist options
  • Save drewgillievfx/f29393adad884f0dde1c5034db3f911d to your computer and use it in GitHub Desktop.
Save drewgillievfx/f29393adad884f0dde1c5034db3f911d to your computer and use it in GitHub Desktop.
# Layer 1
#node "facing"
#res = Pobj;
#res = cvoronoi(Pobj * #floatInput1)*2-1;
#res = norm(res);
cosangle = dot(Vn, Nn);
#facingRatio = pow(cosangle, #floatInput1);
facingRatio = cosangle < 0 ? -(pow(-cosangle, floatInput1)): (pow(cosangle, floatInput1));
facingRatio = smoothstep(facingRatio, floatInput2, 1);
facingRatio = abs(facingRatio);
facingRatio = clamp(facingRatio, 0, 1);
res = (1-facingRatio) * colorInput1 + colorInput2 * facingRatio;
res
######################################################################
# Layer 2
b1_freq = floatInput1; # 1,200
b1_slope =floatInput2; # -20,20
b1_sharp = floatInput3; # 1,4.00
b1_n_amp = floatInput4; # 0,1.00
b1_n_freq =28.023; # 1,100.00
Pn = P * b1_n_freq;
uNew = u + noise(Pn) * b1_n_amp;
vNew = v + noise(Pn) * b1_n_amp;
b1 = abs(sin(PI*b1_freq*(uNew +(b1_slope* vNew))));
b1 = (b1_sharp != 1 && b1_sharp > 0) ? b1^(1/b1_sharp) : b1;
b1 = b1->clamp(0,1);
b1
######################################################################
# Layer 3
#velvet splotches
size =floatInput1;#.005,1;
jitter =floatInput2;#.1,5
gain =floatInput3;#.1,5
Strength=floatInput4;
Cnew=fit(voronoi(P*(1.005 - size),3,jitter,1,4,4,gain),.4,1,0,1);
Cnew
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment