#!version 2.2.4 surface #!parameters: uniform float spacing = .05 uniform float endsoft = 1 uniform float lengthfactor = 5 #!variables: varying float DST varying float param varying float stretch varying float firstdist varying float firsthalver varying float nexthalver varying float firstdir varying float nextdir varying float bestdir varying float bestdist varying float nextdist varying float ender varying float pinch varying float firstHconstant varying float nextHconstant varying float bestHconstant varying float dist varying float hairea varying float uniformrandom varying float downlength varying float trim varying float normaldisp varying float thickness varying vector grey varying vector NN varying vector down varying float hang varying float temporary_0 varying float temporary_1 uniform float temporary_2 uniform vector temporary_3 uniform vector temporary_4 uniform vector temporary_5 varying float temporary_6 varying float temporary_7 varying float temporary_8 varying float temporary_9 varying float temporary_10 varying vector temporary_11 varying vector temporary_12 varying vector temporary_13 varying vector temporary_14 #!Init: return #!Code: vufloat DST spacing vufloat temporary_0 1 mod ("f=ff") param u temporary_0 length ("f=v") stretch dPdu vufloat temporary_1 .5 subff temporary_0 param temporary_1 abs ("f=f") firstdist temporary_0 vufloat firsthalver 1 vufloat nexthalver 1 vufloat temporary_0 .5 subff firstdir param temporary_0 vufloat nextdist 1 moveff bestdist nextdist clamp ("f=fff") temporary_2 endsoft 0 1 vufloat temporary_0 temporary_2 mulff ender temporary_0 DST vufloat pinch 1 vufloat firstHconstant .5 vfromf temporary_3 .1 vuvector grey temporary_3 normalize ("v=v") NN N vfromf temporary_5 0 1 0 vtransform ("v=SSv") temporary_4 "world" "current" temporary_5 normalize ("v=v") temporary_3 temporary_4 vuvector down temporary_3 vufloat temporary_0 1 negf temporary_2 .9 vufloat temporary_6 temporary_2 vufloat temporary_7 0.1 dot temporary_8 NN down smoothstep ("f=fff") temporary_1 temporary_6 temporary_7 temporary_8 subff hang temporary_0 temporary_1 forbegin #!Label13 #!Label14 #!Label15 #!Label13: mulff temporary_1 firstdist stretch fgt temporary_0 temporary_1 DST for temporary_0 vufloat temporary_0 .5 mulff firsthalver firsthalver temporary_0 vufloat temporary_6 .5 mulff temporary_1 firsthalver temporary_6 sign ("f=f") temporary_6 firstdir mulff temporary_0 temporary_1 temporary_6 addff firstHconstant firstHconstant temporary_0 subff firstdist firstdist firsthalver moveff firstdir firstdist abs ("f=f") firstdist firstdist #!Label14: #!Label15: forend moveff nexthalver firsthalver moveff nextdir firstdir moveff nextHconstant firstHconstant forbegin #!Label16 #!Label17 #!Label18 #!Label16: mulff temporary_1 nexthalver stretch vufloat temporary_7 2 mulff temporary_6 DST temporary_7 fgt temporary_0 temporary_1 temporary_6 for temporary_0 vufloat temporary_0 .5 mulff nexthalver nexthalver temporary_0 vufloat temporary_6 .5 mulff temporary_1 nexthalver temporary_6 sign ("f=f") temporary_6 nextdir mulff temporary_0 temporary_1 temporary_6 addff nextHconstant nextHconstant temporary_0 abs ("f=f") temporary_0 nextdir subff nextdir temporary_0 nexthalver #!Label17: #!Label18: forend subff nextdist nexthalver firstdist moveff bestdist firstdist moveff bestdir firstdir moveff bestHconstant firstHconstant flt temporary_0 nextdist bestdist if temporary_0 #!Label19 moveff bestdist nextdist moveff bestdir nextdir moveff bestHconstant nextHconstant #!Label19: endif mulff temporary_1 nexthalver stretch addff temporary_6 DST ender flt temporary_0 temporary_1 temporary_6 if temporary_0 #!Label21 fneql temporary_6 bestdist firstdist feql temporary_7 nexthalver firsthalver or temporary_1 temporary_6 temporary_7 if temporary_1 #!Label23 mulff temporary_7 nexthalver stretch subff temporary_6 temporary_7 DST divff pinch temporary_6 ender #!Label23: endif #!Label21: endif vufloat temporary_1 0 vufloat temporary_6 .5 smoothstep ("f=fff") temporary_0 temporary_1 temporary_6 pinch vufloat temporary_1 .5 pow ("f=ff") pinch temporary_0 temporary_1 vufloat temporary_1 1000 mulff temporary_0 bestHconstant temporary_1 cellnoise ("f=f") uniformrandom temporary_0 addff temporary_1 v uniformrandom vufloat temporary_6 lengthfactor mulff temporary_0 temporary_1 temporary_6 vufloat temporary_1 1 mod ("f=ff") downlength temporary_0 temporary_1 vufloat temporary_0 1 vufloat temporary_6 0.4 vufloat temporary_7 .45 vufloat temporary_10 .5 subff temporary_9 downlength temporary_10 abs ("f=f") temporary_8 temporary_9 smoothstep ("f=fff") temporary_1 temporary_6 temporary_7 temporary_8 subff trim temporary_0 temporary_1 vufloat temporary_0 1 vufloat temporary_8 1 divff temporary_10 bestdist DST mulff temporary_9 temporary_10 stretch subff temporary_7 temporary_8 temporary_9 mulff temporary_6 temporary_7 pinch mulff temporary_1 temporary_6 trim subff dist temporary_0 temporary_1 vufloat temporary_0 1 vufloat temporary_6 0.1 vufloat temporary_7 .5 smoothstep ("f=fff") temporary_1 temporary_6 temporary_7 dist subff hairea temporary_0 temporary_1 vufloat temporary_1 1 vufloat temporary_7 2 vufloat temporary_9 0 vufloat temporary_10 .5 clamp ("f=fff") temporary_8 dist temporary_9 temporary_10 mulff temporary_6 temporary_7 temporary_8 subff temporary_0 temporary_1 temporary_6 vufloat temporary_1 .1 mulff thickness temporary_0 temporary_1 vufloat temporary_1 .5 mulff temporary_0 downlength temporary_1 addff normaldisp thickness temporary_0 vfromf temporary_13 normaldisp mulvv temporary_12 NN temporary_13 vfromf temporary_3 .5 vuvector temporary_13 temporary_3 mulvv temporary_11 temporary_12 temporary_13 addvv P P temporary_11 vfromf temporary_13 hang mulvv temporary_12 down temporary_13 vufloat temporary_6 .5 mulff temporary_1 temporary_6 downlength negf temporary_0 temporary_1 vfromf temporary_13 temporary_0 mulvv temporary_11 temporary_12 temporary_13 addvv P P temporary_11 vufloat temporary_1 1000 mulff temporary_0 bestHconstant temporary_1 cellnoise ("c=f") temporary_13 temporary_0 vfromf temporary_14 hairea mulvv temporary_12 temporary_13 temporary_14 vfromf temporary_13 downlength mulvv temporary_11 temporary_12 temporary_13 vfromf temporary_3 .5 vuvector temporary_12 temporary_3 mulvv Ci temporary_11 temporary_12 vufloat temporary_0 .5 mix ("v=vvf") Ci Ci grey temporary_0 vufloat temporary_1 1 vufloat temporary_7 0.3 vufloat temporary_8 .51 smoothstep ("f=fff") temporary_6 temporary_7 temporary_8 dist subff temporary_0 temporary_1 temporary_6 vfromf Oi temporary_0 mulvv Ci Ci Oi return