#!version 2.2.4 displacement #!parameters: uniform float freq = 5 uniform float magnitude = .2 #!variables: varying vector overdist varying vector stepsize varying float numsteps varying vector Psh varying float i varying vector dPduN varying vector dPdvN varying vector Pou varying vector Pov varying float nz varying float nzou varying float nzov varying float chu varying float chv varying vector DdPdu varying vector DdPdv varying vector step uniform vector temporary_0 uniform float temporary_1 varying vector temporary_2 varying vector temporary_3 varying float temporary_4 varying float temporary_5 varying vector temporary_6 varying vector temporary_7 #!Init: return #!Code: vfromf temporary_0 .1 vuvector overdist temporary_0 divff temporary_1 magnitude freq vfromf temporary_0 temporary_1 vuvector stepsize temporary_0 vufloat numsteps 40 transform ("p=Sp") temporary_2 "object" P vfromf temporary_0 freq vuvector temporary_3 temporary_0 mulvv Psh temporary_2 temporary_3 vtransform ("v=Sv") temporary_2 "object" dPdu normalize ("v=v") dPduN temporary_2 vtransform ("v=Sv") temporary_2 "object" dPdv normalize ("v=v") dPdvN temporary_2 mulvv temporary_2 dPduN overdist addvv Pou Psh temporary_2 mulvv temporary_2 dPdvN overdist addvv Pov Psh temporary_2 noise ("f=p") temporary_4 Psh vufloat temporary_5 .5 subff nz temporary_4 temporary_5 noise ("f=p") temporary_4 Pou vufloat temporary_5 .5 subff nzou temporary_4 temporary_5 noise ("f=p") temporary_4 Pov vufloat temporary_5 .5 subff nzov temporary_4 temporary_5 subff chu nz nzou subff chv nz nzov movevv DdPdu dPduN movevv DdPdv dPdvN cross step DdPdu DdPdv vufloat i 1 forbegin #!Label4 #!Label5 #!Label6 #!Label4: flt temporary_4 i numsteps for temporary_4 vtransform ("v=SSv") temporary_6 "object" "current" step vfromf temporary_7 nz mulvv temporary_3 temporary_6 temporary_7 mulvv temporary_2 temporary_3 stepsize subvv P P temporary_2 vfromf temporary_6 chu mulvv temporary_3 step temporary_6 addvv temporary_2 DdPdu temporary_3 normalize ("v=v") DdPdu temporary_2 vfromf temporary_6 chv mulvv temporary_3 step temporary_6 addvv temporary_2 DdPdv temporary_3 normalize ("v=v") DdPdv temporary_2 cross step DdPdu DdPdv #!Label5: vufloat temporary_4 1 addff i i temporary_4 #!Label6: forend calculatenormal ("p=p") temporary_2 P normalize ("v=v") N temporary_2 return