#!version 2.2.4 displacement #!parameters: uniform float mult = 5 uniform float Nzscale = 1 uniform float Kd = .2 uniform float bubsize = 1 #!variables: varying vector Nn varying float a varying float b varying float c varying float bub varying float dist varying float shortest varying vector Po varying vector trucell varying vector surrcell varying vector nzcell varying vector offset varying vector temporary_0 varying vector temporary_1 uniform vector temporary_2 varying float temporary_3 varying float temporary_4 varying float temporary_5 uniform float temporary_6 varying vector temporary_7 varying vector temporary_8 #!Init: return #!Code: normalize ("v=v") Nn N vufloat shortest 10000 moveff dist shortest transform ("p=Sp") temporary_0 "object" P vfromf temporary_2 mult vuvector temporary_1 temporary_2 mulvv Po temporary_0 temporary_1 xcomp ("f=p") temporary_5 Po floor ("f=f") temporary_4 temporary_5 vufloat temporary_5 .5 addff temporary_3 temporary_4 temporary_5 setxcomp ("o=Vf") trucell temporary_3 ycomp ("f=p") temporary_5 Po floor ("f=f") temporary_4 temporary_5 vufloat temporary_5 .5 addff temporary_3 temporary_4 temporary_5 setycomp ("o=Vf") trucell temporary_3 zcomp ("f=p") temporary_5 Po floor ("f=f") temporary_4 temporary_5 vufloat temporary_5 .5 addff temporary_3 temporary_4 temporary_5 setzcomp ("o=Vf") trucell temporary_3 negf temporary_6 1 vufloat a temporary_6 forbegin #!Label12 #!Label13 #!Label14 #!Label12: vufloat temporary_4 1 felt temporary_3 a temporary_4 for temporary_3 negf temporary_6 1 vufloat b temporary_6 forbegin #!Label15 #!Label16 #!Label17 #!Label15: vufloat temporary_4 1 felt temporary_3 b temporary_4 for temporary_3 negf temporary_6 1 vufloat c temporary_6 forbegin #!Label18 #!Label19 #!Label20 #!Label18: vufloat temporary_4 1 felt temporary_3 c temporary_4 for temporary_3 vfromf offset a b c addvv surrcell trucell offset cellnoise ("c=p") temporary_7 surrcell vfromf temporary_2 .5 vuvector temporary_8 temporary_2 subvv temporary_1 temporary_7 temporary_8 vfromf temporary_2 Nzscale vuvector temporary_7 temporary_2 mulvv temporary_0 temporary_1 temporary_7 addvv nzcell surrcell temporary_0 distance ("f=pp") dist Po nzcell flt temporary_3 dist shortest if temporary_3 #!Label21 moveff shortest dist #!Label21: endif #!Label19: vufloat temporary_3 1 addff c c temporary_3 #!Label20: forend #!Label16: vufloat temporary_3 1 addff b b temporary_3 #!Label17: forend #!Label13: vufloat temporary_3 1 addff a a temporary_3 #!Label14: forend vufloat temporary_4 0 vufloat temporary_5 bubsize clamp ("f=fff") temporary_3 shortest temporary_4 temporary_5 vufloat temporary_4 bubsize divff bub temporary_3 temporary_4 vufloat temporary_5 3 pow ("f=ff") temporary_4 bub temporary_5 vufloat temporary_5 1 subff temporary_3 temporary_4 temporary_5 vfromf temporary_7 temporary_3 mulvv temporary_1 Nn temporary_7 vfromf temporary_2 Kd vuvector temporary_7 temporary_2 mulvv temporary_0 temporary_1 temporary_7 addvv P P temporary_0 calculatenormal ("p=p") N P return