#!version 2.2.4 surface #!parameters: uniform float Ka = 1 uniform float Kd = 0.7 uniform float roughness = 0.1 uniform float Km uniform float swidth = .2 uniform float pitfactor = 4.5 uniform float octaves = 5 uniform float lac = 1.91341 uniform float amp = 1.91341 uniform float jitter = 1.0 uniform float distortamp = 0.0005 #!variables: varying vector Nf varying vector Ct varying float ss varying float tt varying float angle varying float r varying float rim varying float uu varying float a varying float i varying float j varying float sc varying float asc varying float lev varying float sctr varying float tctr varying float scell varying float tcell varying float scellctr varying float tcellctr varying float pert varying float rad varying float pert2 varying float rmax varying float rmax1 varying float rmax2 varying float rrad1 varying float rrad2 varying float cellsizescale varying float ilac uniform float temporary_0 varying float temporary_1 varying float temporary_2 varying float temporary_3 varying float temporary_4 varying float temporary_5 varying float temporary_6 varying float temporary_7 varying float temporary_8 varying float temporary_9 varying vector temporary_10 varying vector temporary_11 varying vector temporary_12 uniform float amp_1 varying vector pp varying float sum varying float fw uniform float i_1 varying float temporary_13 varying float temporary_14 varying float temporary_15 varying float temporary_16 varying float temporary_17 uniform vector temporary_18 varying vector temporary_19 varying vector temporary_20 varying vector temporary_21 varying vector temporary_22 varying float sigma2 varying float A varying float B varying float theta_r varying vector V_perp_N varying vector C varying vector temporary_23 varying vector temporary_24 varying float nondiff varying vector LN varying float cos_theta_i varying float cos_phi_diff varying float theta_i varying float alpha_1 varying float beta varying vector temporary_25 #!Init: negf Km 1.2 return #!Code: vufloat pert 0 divff temporary_0 swidth 2 vufloat rmax temporary_0 vufloat rmax1 1000000 vufloat rmax2 1000000 vufloat rrad1 0 vufloat rrad2 0 divff temporary_0 1 lac vufloat ilac temporary_0 vufloat lev 0 forbegin #!Label32 #!Label33 #!Label34 #!Label32: vufloat temporary_2 octaves flt temporary_1 lev temporary_2 for temporary_1 vufloat temporary_1 lac pow ("f=ff") sc temporary_1 lev vufloat temporary_1 1 vufloat temporary_3 amp pow ("f=ff") temporary_2 temporary_3 lev divff asc temporary_1 temporary_2 mulff temporary_2 s sc vufloat temporary_3 swidth divff temporary_1 temporary_2 temporary_3 floor ("f=f") scellctr temporary_1 mulff temporary_2 t sc vufloat temporary_3 swidth divff temporary_1 temporary_2 temporary_3 floor ("f=f") tcellctr temporary_1 vufloat temporary_1 swidth divff cellsizescale temporary_1 sc vufloat rrad1 0 vufloat rrad2 0 negf temporary_0 1 vufloat i temporary_0 forbegin #!Label35 #!Label36 #!Label37 #!Label35: vufloat temporary_2 1 felt temporary_1 i temporary_2 for temporary_1 addff scell scellctr i negf temporary_0 1 vufloat j temporary_0 forbegin #!Label38 #!Label39 #!Label40 #!Label38: vufloat temporary_2 1 felt temporary_1 j temporary_2 for temporary_1 addff tcell tcellctr j vufloat temporary_5 7 mulff temporary_4 temporary_5 scell vufloat temporary_5 9.5 subff temporary_3 temporary_4 temporary_5 vufloat temporary_6 7 mulff temporary_5 temporary_6 tcell vufloat temporary_6 7.5 addff temporary_4 temporary_5 temporary_6 cellnoise ("f=ff") temporary_2 temporary_3 temporary_4 vufloat temporary_3 pitfactor flt temporary_1 temporary_2 temporary_3 if temporary_1 #!Label41 vufloat temporary_4 0.5 addff temporary_3 scell temporary_4 vufloat temporary_5 jitter vufloat temporary_8 0.5 addff temporary_7 scell temporary_8 vufloat temporary_9 0.5 addff temporary_8 tcell temporary_9 cellnoise ("f=ff") temporary_6 temporary_7 temporary_8 mulff temporary_4 temporary_5 temporary_6 addff temporary_2 temporary_3 temporary_4 mulff sctr cellsizescale temporary_2 vufloat temporary_4 0.5 addff temporary_3 tcell temporary_4 vufloat temporary_5 jitter vufloat temporary_8 3.5 addff temporary_7 scell temporary_8 vufloat temporary_9 8.5 addff temporary_8 tcell temporary_9 cellnoise ("f=ff") temporary_6 temporary_7 temporary_8 mulff temporary_4 temporary_5 temporary_6 addff temporary_2 temporary_3 temporary_4 mulff tctr cellsizescale temporary_2 subff ss s sctr subff tt t tctr mulff temporary_2 ss ss mulff temporary_3 tt tt addff r temporary_2 temporary_3 flt temporary_2 r rmax1 if temporary_2 #!Label44 mulff rad rmax ilac divff rad rad sc mulff rad rad rad moveff rmax2 rmax1 moveff rrad2 rrad1 moveff rmax1 r moveff rrad1 rad #!Label44: else #!Label43 flt temporary_3 r rmax2 if temporary_3 #!Label45 mulff rad rmax ilac divff rad rad sc mulff rad rad rad moveff rmax2 r moveff rrad2 rad #!Label45: endif #!Label43: endif #!Label41: endif #!Label39: vufloat temporary_1 1 addff j j temporary_1 #!Label40: forend #!Label36: vufloat temporary_1 1 addff i i temporary_1 #!Label37: forend fneql temporary_0 distortamp 0 vufloat temporary_1 temporary_0 if temporary_1 #!Label47 vfromf temporary_11 sc mulvv temporary_10 P temporary_11 vfromf temporary_12 sc mulvv temporary_11 P temporary_12 area ("f=p") temporary_7 temporary_11 sqrt ("f=f") temporary_6 temporary_7 vufloat temporary_7 1.0e-6 max ("f=ff") temporary_5 temporary_6 temporary_7 moveff amp_1 1 movevv pp temporary_10 vufloat sum 0 moveff fw temporary_5 moveff i_1 0 forbegin #!Label49 #!Label50 #!Label51 #!Label49: flt temporary_0 i_1 4 vufloat temporary_6 temporary_0 for temporary_6 vufloat temporary_7 amp_1 vufloat temporary_14 2 noise ("f=p") temporary_15 pp mulff temporary_13 temporary_14 temporary_15 vufloat temporary_14 1 subff temporary_9 temporary_13 temporary_14 vufloat temporary_14 1 vufloat temporary_16 0.2 vufloat temporary_17 0.75 smoothstep ("f=fff") temporary_15 temporary_16 temporary_17 fw subff temporary_13 temporary_14 temporary_15 mulff temporary_8 temporary_9 temporary_13 mulff temporary_6 temporary_7 temporary_8 addff sum sum temporary_6 mulff amp_1 amp_1 0.5 vfromf temporary_18 2 vuvector temporary_11 temporary_18 mulvv pp pp temporary_11 vufloat temporary_6 2 mulff fw fw temporary_6 #!Label50: addff i_1 i_1 1 #!Label51: forend moveff temporary_4 sum mulff temporary_3 temporary_4 asc vufloat temporary_4 distortamp mulff temporary_2 temporary_3 temporary_4 addff rrad1 rrad1 temporary_2 vfromf temporary_11 sc mulvv temporary_10 P temporary_11 vfromf temporary_12 sc mulvv temporary_11 P temporary_12 area ("f=p") temporary_7 temporary_11 sqrt ("f=f") temporary_6 temporary_7 vufloat temporary_7 1.0e-6 max ("f=ff") temporary_5 temporary_6 temporary_7 moveff amp_1 1 movevv pp temporary_10 vufloat sum 0 moveff fw temporary_5 moveff i_1 0 forbegin #!Label52 #!Label53 #!Label54 #!Label52: flt temporary_0 i_1 4 vufloat temporary_6 temporary_0 for temporary_6 vufloat temporary_7 amp_1 vufloat temporary_14 2 noise ("f=p") temporary_15 pp mulff temporary_13 temporary_14 temporary_15 vufloat temporary_14 1 subff temporary_9 temporary_13 temporary_14 vufloat temporary_14 1 vufloat temporary_16 0.2 vufloat temporary_17 0.75 smoothstep ("f=fff") temporary_15 temporary_16 temporary_17 fw subff temporary_13 temporary_14 temporary_15 mulff temporary_8 temporary_9 temporary_13 mulff temporary_6 temporary_7 temporary_8 addff sum sum temporary_6 mulff amp_1 amp_1 0.5 vfromf temporary_18 2 vuvector temporary_11 temporary_18 mulvv pp pp temporary_11 vufloat temporary_6 2 mulff fw fw temporary_6 #!Label53: addff i_1 i_1 1 #!Label54: forend moveff temporary_4 sum mulff temporary_3 temporary_4 asc vufloat temporary_4 distortamp mulff temporary_2 temporary_3 temporary_4 addff rrad2 rrad2 temporary_2 #!Label47: endif vufloat temporary_3 0 fgt temporary_2 rrad1 temporary_3 vufloat temporary_4 0 fgt temporary_3 rmax1 temporary_4 and temporary_1 temporary_2 temporary_3 if temporary_1 #!Label55 vufloat temporary_2 0 smoothstep ("f=fff") r temporary_2 rrad1 rmax1 vufloat temporary_5 2 mulff temporary_4 temporary_5 r vufloat temporary_6 3 pow ("f=ff") temporary_5 r temporary_6 subff temporary_3 temporary_4 temporary_5 mulff temporary_2 r temporary_3 vufloat temporary_5 1 subff temporary_4 temporary_5 r vufloat temporary_6 3 pow ("f=ff") temporary_5 r temporary_6 mulff temporary_3 temporary_4 temporary_5 addff r temporary_2 temporary_3 vufloat temporary_7 3.141592654 mulff temporary_6 r temporary_7 vufloat temporary_7 2 divff temporary_5 temporary_6 temporary_7 sin ("f=f") temporary_4 temporary_5 mulff temporary_3 temporary_4 asc subff temporary_2 temporary_3 asc addff pert pert temporary_2 #!Label55: endif vufloat temporary_3 0 fgt temporary_2 rrad2 temporary_3 vufloat temporary_4 0 fgt temporary_3 rmax2 temporary_4 and temporary_1 temporary_2 temporary_3 if temporary_1 #!Label57 vufloat temporary_2 0 smoothstep ("f=fff") r temporary_2 rrad2 rmax2 vufloat temporary_5 2 mulff temporary_4 temporary_5 r vufloat temporary_6 3 pow ("f=ff") temporary_5 r temporary_6 subff temporary_3 temporary_4 temporary_5 mulff temporary_2 r temporary_3 vufloat temporary_5 1 subff temporary_4 temporary_5 r vufloat temporary_6 3 pow ("f=ff") temporary_5 r temporary_6 mulff temporary_3 temporary_4 temporary_5 addff r temporary_2 temporary_3 vufloat temporary_7 3.141592654 mulff temporary_6 r temporary_7 vufloat temporary_7 2 divff temporary_5 temporary_6 temporary_7 sin ("f=f") temporary_4 temporary_5 mulff temporary_3 temporary_4 asc subff temporary_2 temporary_3 asc addff pert pert temporary_2 #!Label57: endif #!Label33: vufloat temporary_1 1 addff lev lev temporary_1 #!Label34: forend vufloat temporary_2 Km mulff temporary_1 temporary_2 pert vfromf temporary_11 temporary_1 normalize ("v=v") temporary_12 N mulvv temporary_10 temporary_11 temporary_12 addvv P P temporary_10 calculatenormal ("p=p") N P normalize ("v=v") temporary_10 N faceforward ("v=vv") Nf temporary_10 I movevv Ct Cs vufloat temporary_1 Ka vufloat temporary_2 Kd vufloat temporary_3 roughness vfromf temporary_12 temporary_1 ambient ("c=") temporary_19 mulvv temporary_11 temporary_12 temporary_19 vfromf temporary_19 temporary_2 normalize ("v=v") temporary_22 I negv temporary_21 temporary_22 mulff sigma2 temporary_3 temporary_3 vufloat temporary_4 1 vufloat temporary_7 0.5 mulff temporary_6 temporary_7 sigma2 vufloat temporary_8 0.33 addff temporary_7 sigma2 temporary_8 divff temporary_5 temporary_6 temporary_7 subff A temporary_4 temporary_5 vufloat temporary_5 0.45 mulff temporary_4 temporary_5 sigma2 vufloat temporary_6 0.09 addff temporary_5 sigma2 temporary_6 divff B temporary_4 temporary_5 dot temporary_4 temporary_21 Nf acos ("f=f") theta_r temporary_4 dot temporary_4 temporary_21 Nf vfromf temporary_24 temporary_4 mulvv temporary_23 Nf temporary_24 subvv temporary_22 temporary_21 temporary_23 normalize ("v=v") V_perp_N temporary_22 vfromf temporary_18 0 vuvector C temporary_18 divff temporary_0 3.141592654 2 vufloat temporary_4 temporary_0 illuminance P Nf temporary_4 #!Label59 #!Label60 #!Label59: vufloat nondiff 0 lightsource ("f=SF") temporary_5 "__nondiffuse" nondiff vufloat temporary_6 1 flt temporary_5 nondiff temporary_6 if temporary_5 #!Label61 normalize ("v=v") LN L dot cos_theta_i LN Nf vfromf temporary_25 cos_theta_i mulvv temporary_24 Nf temporary_25 subvv temporary_23 LN temporary_24 normalize ("v=v") temporary_22 temporary_23 dot cos_phi_diff V_perp_N temporary_22 acos ("f=f") theta_i cos_theta_i max ("f=ff") alpha_1 theta_i theta_r min ("f=ff") beta theta_i theta_r vufloat temporary_7 1 subff temporary_6 temporary_7 nondiff vfromf temporary_25 temporary_6 mulvv temporary_24 temporary_25 Cl vfromf temporary_25 cos_theta_i mulvv temporary_23 temporary_24 temporary_25 vufloat temporary_14 0 max ("f=ff") temporary_13 temporary_14 cos_phi_diff mulff temporary_9 B temporary_13 sin ("f=f") temporary_13 alpha_1 mulff temporary_8 temporary_9 temporary_13 tan ("f=f") temporary_9 beta mulff temporary_7 temporary_8 temporary_9 addff temporary_6 A temporary_7 vfromf temporary_24 temporary_6 mulvv temporary_22 temporary_23 temporary_24 addvv C C temporary_22 #!Label61: endif #!Label60: endilluminance movevv temporary_20 C mulvv temporary_12 temporary_19 temporary_20 addvv temporary_10 temporary_11 temporary_12 mulvv Ci Ct temporary_10 movevv Oi Os mulvv Ci Ci Oi return