OpenShadingLanguage 1.00 # Compiled by oslc 1.3.3 shader GAO2VRay param color ColorIn 1 1 1 %read{1,5} %write{2147483647,-1} param color ColorHit 0 0 0 %read{8,8} %write{2147483647,-1} param int UseTexture 0 %meta{string,widget,"checkBox"} %read{6,9} %write{2147483647,-1} param string TxColorIn "undefined" %read{7,7} %write{2147483647,-1} param string TxColorHit "undefined" %read{10,10} %write{2147483647,-1} param int mode 0 %meta{string,widget,"mapper"} %meta{string,options,"DirectAO:0|Wear:1|Both:2"} %read{38,57} %write{2147483647,-1} param int InvertEffect 0 %meta{string,widget,"checkBox"} %read{77,77} %write{2147483647,-1} param float AO_AngleDeg 85 %meta{string,widget,"number"} %meta{float,min,0} %meta{float,max,90} %read{15,15} %write{2147483647,-1} %derivs param float maxDistance 100 %read{37,63} %write{2147483647,-1} param float OverSampling 4 %read{19,70} %write{2147483647,-1} param float AOgamma 1.2 %read{75,75} %write{2147483647,-1} param float BoostExposure 2 %read{88,88} %write{2147483647,-1} oparam closure color CoulOut %read{89,89} %write{1,88} global point P %read{23,60} %write{2147483647,-1} %derivs global normal N %read{26,26} %write{2147483647,-1} %derivs global float u %read{7,10} %write{2147483647,-1} %derivs global float v %read{7,10} %write{2147483647,-1} %derivs global closure color Ci %read{2147483647,-1} %write{89,89} local int RTdiffuse %read{3,3} %write{2,2} local closure color ___352_NullClosure %read{2147483647,-1} %write{4,4} local color ___353_ColorInUse %read{81,81} %write{5,7} local color ___353_ColorHitUse %read{83,83} %write{8,10} local float ___353_MixOut %read{18,85} %write{11,79} local float ___353_mixage %read{18,74} %write{12,74} local float ___353_AO_Angle %read{27,33} %write{15,15} %derivs local int ___353_Loopi %read{18,74} %write{16,74} %derivs local float ___353_LoopShift %read{18,74} %write{17,74} %derivs local vector ___357_VectorAO %read{18,74} %write{18,74} %derivs local vector ___358_bruitvector %read{18,74} %write{18,74} %derivs local float ___357_Dist %read{18,74} %write{18,74} local vector ___357_DirTrace %read{18,74} %write{18,74} %derivs local float ___357_MaxDistTrace %read{18,74} %write{18,74} local float ___359_DistDirect %read{18,74} %write{18,74} local float ___359_DistInv %read{18,74} %write{18,74} local int ___359_DoTrace %read{18,74} %write{18,74} local int ___364_DoTrace %read{18,74} %write{18,74} local closure color ___353_closureIn %read{84,84} %write{81,81} local closure color ___353_closureHit %read{86,86} %write{83,83} temp closure color $tmp1 %read{1,1} %write{0,0} const string $const1 "emission" %read{0,82} %write{2147483647,-1} const string $const2 "diffuse" %read{2,2} %write{2147483647,-1} const float $const3 0 %read{4,66} %write{2147483647,-1} const string $const4 "radians" %read{13,13} %write{2147483647,-1} const float $const5 3.1415927 %read{14,14} %write{2147483647,-1} const float $const6 180 %read{14,14} %write{2147483647,-1} temp float $tmp2 %read{15,15} %write{14,14} %derivs const int $const7 0 %read{16,16} %write{2147483647,-1} const float $const8 0.00069999998 %read{17,17} %write{2147483647,-1} temp int $tmp3 %read{18,74} %write{18,74} const float $const9 0.001 %read{20,20} %write{2147483647,-1} temp vector $tmp4 %read{25,25} %write{24,24} %derivs const string $const10 "perlin" %read{24,32} %write{2147483647,-1} const float $const11 10000 %read{22,30} %write{2147483647,-1} temp float $tmp5 %read{23,23} %write{22,22} %derivs temp float $tmp6 %read{22,22} %write{21,21} %derivs temp point $tmp7 %read{24,24} %write{23,23} %derivs temp vector $tmp8 %read{26,26} %write{25,25} %derivs temp int $tmp9 %read{28,28} %write{27,27} temp vector $tmp10 %read{33,33} %write{32,32} %derivs temp float $tmp11 %read{31,31} %write{30,30} %derivs temp float $tmp12 %read{30,30} %write{29,29} %derivs temp vector $tmp13 %read{32,32} %write{31,31} %derivs const float $const12 1 %read{35,85} %write{2147483647,-1} const int $const13 2 %read{38,38} %write{2147483647,-1} temp int $tmp14 %read{39,39} %write{38,38} const string $const14 "maxdist" %read{40,60} %write{2147483647,-1} temp vector $tmp15 %read{45,45} %write{44,44} %derivs temp float $tmp16 %read{52,52} %write{50,50} const string $const15 "clamp" %read{51,64} %write{2147483647,-1} temp float $tmp17 %read{53,53} %write{52,52} temp float $tmp18 %read{55,55} %write{54,54} temp float $tmp19 %read{56,56} %write{55,55} const int $const16 1 %read{57,77} %write{2147483647,-1} temp int $tmp20 %read{58,58} %write{57,57} temp float $tmp21 %read{65,65} %write{63,63} temp float $tmp22 %read{66,66} %write{65,65} temp float $tmp23 %read{68,68} %write{67,67} temp float $tmp24 %read{69,69} %write{68,68} temp float $tmp25 %read{71,71} %write{70,70} temp float $tmp26 %read{72,72} %write{71,71} temp int $tmp27 %read{2147483647,-1} %write{73,73} temp float $tmp28 %read{76,76} %write{75,75} temp int $tmp29 %read{78,78} %write{77,77} temp closure color $tmp30 %read{81,81} %write{80,80} temp closure color $tmp31 %read{83,83} %write{82,82} temp closure color $tmp32 %read{87,87} %write{84,84} temp float $tmp33 %read{86,86} %write{85,85} temp closure color $tmp34 %read{87,87} %write{86,86} temp closure color $tmp35 %read{88,88} %write{87,87} code CoulOut # D:\\OSL\\VRAYscripts\\GAO2Vray.osl:80 # ) closure $tmp1 $const1 %filename{"D:\\OSL\\VRAYscripts\\GAO2Vray.osl"} %line{80} %argrw{"wr"} mul CoulOut $tmp1 ColorIn %argrw{"wrr"} code ___main___ # D:\\OSL\\VRAYscripts\\GAO2Vray.osl:85 # raytype RTdiffuse $const2 %filename{"D:\\OSL\\VRAYscripts\\GAO2Vray.osl"} %line{85} %argrw{"wr"} # D:\\OSL\\VRAYscripts\\GAO2Vray.osl:87 # { if RTdiffuse 5 90 %line{87} %argrw{"r"} # D:\\OSL\\VRAYscripts\\GAO2Vray.osl:89 # // CoulOut = 0.0 ; assign ___352_NullClosure $const3 %line{89} %argrw{"wr"} # D:\\OSL\\VRAYscripts\\GAO2Vray.osl:95 # if ( UseTexture ) assign ___353_ColorInUse ColorIn %line{95} %argrw{"wr"} # D:\\OSL\\VRAYscripts\\GAO2Vray.osl:96 # { if UseTexture 8 8 %line{96} %argrw{"r"} # D:\\OSL\\VRAYscripts\\GAO2Vray.osl:98 # } texture ___353_ColorInUse TxColorIn u v %line{98} %argrw{"wrrr"} %argderivs{2,3} # D:\\OSL\\VRAYscripts\\GAO2Vray.osl:101 # if ( UseTexture ) assign ___353_ColorHitUse ColorHit %line{101} %argrw{"wr"} # D:\\OSL\\VRAYscripts\\GAO2Vray.osl:102 # { if UseTexture 11 11 %line{102} %argrw{"r"} # D:\\OSL\\VRAYscripts\\GAO2Vray.osl:104 # } texture ___353_ColorHitUse TxColorHit u v %line{104} %argrw{"wrrr"} %argderivs{2,3} # D:\\OSL\\VRAYscripts\\GAO2Vray.osl:107 # float mixage = 0.0 ; assign ___353_MixOut $const3 %line{107} %argrw{"wr"} # D:\\OSL\\VRAYscripts\\GAO2Vray.osl:108 # assign ___353_mixage $const3 %line{108} %argrw{"wr"} # D:\\OSL\\VRAYscripts\\GAO2Vray.osl:111 # functioncall $const4 16 %line{111} %argrw{"r"} # C:/Program Files\\Chaos Group\\V-Ray\\3dsmax 2014 for x64\\opensl\\stdosl.h:88 # float radians (float x) { return x*(M_PI/180.0); } div $tmp2 $const5 $const6 %filename{"C:/Program Files\\Chaos Group\\V-Ray\\3dsmax 2014 for x64\\opensl\\stdosl.h"} %line{88} %argrw{"wrr"} mul ___353_AO_Angle AO_AngleDeg $tmp2 %argrw{"wrr"} # D:\\OSL\\VRAYscripts\\GAO2Vray.osl:115 # This shader is a general purpose Ambient Occlusion assign ___353_Loopi $const7 %filename{"D:\\OSL\\VRAYscripts\\GAO2Vray.osl"} %line{115} %argrw{"wr"} # D:\\OSL\\VRAYscripts\\GAO2Vray.osl:116 # assign ___353_LoopShift $const8 %line{116} %argrw{"wr"} # D:\\OSL\\VRAYscripts\\GAO2Vray.osl:118 # for $tmp3 19 20 73 75 %line{118} %argrw{"r"} lt $tmp3 ___353_Loopi OverSampling %argrw{"wrr"} # D:\\OSL\\VRAYscripts\\GAO2Vray.osl:121 # add ___353_LoopShift ___353_LoopShift $const9 %line{121} %argrw{"wrr"} # D:\\OSL\\VRAYscripts\\GAO2Vray.osl:125 # assign $tmp6 ___353_Loopi %line{125} %argrw{"wr"} add $tmp5 $const11 $tmp6 %argrw{"wrr"} mul $tmp7 P $tmp5 %argrw{"wrr"} noise $tmp4 $const10 $tmp7 %argrw{"wrr"} mul $tmp8 ___353_LoopShift $tmp4 %argrw{"wrr"} add ___357_VectorAO N $tmp8 %argrw{"wrr"} # D:\\OSL\\VRAYscripts\\GAO2Vray.osl:126 # Oversampling : finer AO, but render time increment linearly. neq $tmp9 ___353_AO_Angle $const3 %line{126} %argrw{"wrr"} if $tmp9 35 35 %argrw{"r"} # D:\\OSL\\VRAYscripts\\GAO2Vray.osl:128 # AOgamma give a linear effect (1.0) or a more 'lighting' effect (2.2, for example) assign $tmp12 ___353_Loopi %line{128} %argrw{"wr"} add $tmp11 $const11 $tmp12 %argrw{"wrr"} mul $tmp13 ___357_VectorAO $tmp11 %argrw{"wrr"} noise $tmp10 $const10 $tmp13 %argrw{"wrr"} mul ___358_bruitvector ___353_AO_Angle $tmp10 %argrw{"wrr"} # D:\\OSL\\VRAYscripts\\GAO2Vray.osl:129 # add ___357_VectorAO ___357_VectorAO ___358_bruitvector %line{129} %argrw{"wrr"} # D:\\OSL\\VRAYscripts\\GAO2Vray.osl:134 # * If you use this shader, please credit it and me. Thank you. assign ___357_Dist $const12 %line{134} %argrw{"wr"} # D:\\OSL\\VRAYscripts\\GAO2Vray.osl:135 # * assign ___357_DirTrace ___357_VectorAO %line{135} %argrw{"wr"} # D:\\OSL\\VRAYscripts\\GAO2Vray.osl:136 # * Enjoy ! assign ___357_MaxDistTrace maxDistance %line{136} %argrw{"wr"} # D:\\OSL\\VRAYscripts\\GAO2Vray.osl:140 # eq $tmp14 mode $const13 %line{140} %argrw{"wrr"} if $tmp14 57 73 %argrw{"r"} # D:\\OSL\\VRAYscripts\\GAO2Vray.osl:146 # [[ string description = "GAO2 Advanced Ambient Occlusion" ]] ( trace ___359_DoTrace P ___357_DirTrace $const14 ___357_MaxDistTrace %line{146} %argrw{"wrrrr"} %argderivs{1,2} # D:\\OSL\\VRAYscripts\\GAO2Vray.osl:148 # color ColorHit = color(0.0 , 0.0 , 0.0 ) , if ___359_DoTrace 43 44 %line{148} %argrw{"r"} # D:\\OSL\\VRAYscripts\\GAO2Vray.osl:153 # int mode = 0 [[ string widget = "mapper", assign ___359_DistDirect $const3 %line{153} %argrw{"wr"} # D:\\OSL\\VRAYscripts\\GAO2Vray.osl:157 # float AO_AngleDeg = 85 assign ___359_DistDirect maxDistance %line{157} %argrw{"wr"} # D:\\OSL\\VRAYscripts\\GAO2Vray.osl:161 # float OverSampling = 4.0 , neg $tmp15 ___357_DirTrace %line{161} %argrw{"wr"} trace ___359_DoTrace P $tmp15 $const14 ___357_MaxDistTrace %argrw{"wrrrr"} %argderivs{1,2} # D:\\OSL\\VRAYscripts\\GAO2Vray.osl:163 # float BoostExposure = 2.0 , if ___359_DoTrace 48 49 %line{163} %argrw{"r"} # D:\\OSL\\VRAYscripts\\GAO2Vray.osl:168 # ) assign ___359_DistInv $const3 %line{168} %argrw{"wr"} # D:\\OSL\\VRAYscripts\\GAO2Vray.osl:172 # int RTdiffuse = raytype ("diffuse") ; assign ___359_DistInv maxDistance %line{172} %argrw{"wr"} # D:\\OSL\\VRAYscripts\\GAO2Vray.osl:176 # closure color NullClosure = 0.0 ; min ___357_Dist ___359_DistInv ___359_DistDirect %line{176} %argrw{"wrr"} # D:\\OSL\\VRAYscripts\\GAO2Vray.osl:178 # // closureOut = NullClosure ; div $tmp16 ___357_Dist maxDistance %line{178} %argrw{"wrr"} functioncall $const15 54 %argrw{"r"} # C:/Program Files\\Chaos Group\\V-Ray\\3dsmax 2014 for x64\\opensl\\stdosl.h:144 # float clamp (float x, float minval, float maxval) { return max(min(x,maxval),minval); } min $tmp17 $tmp16 $const12 %filename{"C:/Program Files\\Chaos Group\\V-Ray\\3dsmax 2014 for x64\\opensl\\stdosl.h"} %line{144} %argrw{"wrr"} max ___353_mixage $tmp17 $const3 %argrw{"wrr"} # D:\\OSL\\VRAYscripts\\GAO2Vray.osl:181 # div $tmp18 $const12 OverSampling %filename{"D:\\OSL\\VRAYscripts\\GAO2Vray.osl"} %line{181} %argrw{"wrr"} mul $tmp19 ___353_mixage $tmp18 %argrw{"wrr"} add ___353_MixOut ___353_MixOut $tmp19 %argrw{"wrr"} # D:\\OSL\\VRAYscripts\\GAO2Vray.osl:187 # * eq $tmp20 mode $const16 %line{187} %argrw{"wrr"} if $tmp20 60 60 %argrw{"r"} # D:\\OSL\\VRAYscripts\\GAO2Vray.osl:189 # * neg ___357_DirTrace ___357_DirTrace %line{189} %argrw{"wr"} # D:\\OSL\\VRAYscripts\\GAO2Vray.osl:193 # * trace ___364_DoTrace P ___357_DirTrace $const14 ___357_MaxDistTrace %line{193} %argrw{"wrrrr"} %argderivs{1,2} # D:\\OSL\\VRAYscripts\\GAO2Vray.osl:196 # if ___364_DoTrace 70 73 %line{196} %argrw{"r"} # D:\\OSL\\VRAYscripts\\GAO2Vray.osl:203 # color ColorIn = color(1.0,1.0,1.0) , assign ___357_Dist $const3 %line{203} %argrw{"wr"} # D:\\OSL\\VRAYscripts\\GAO2Vray.osl:205 # int UseTexture = 0 [[ string widget = "checkBox" ]] , div $tmp21 ___357_Dist maxDistance %line{205} %argrw{"wrr"} functioncall $const15 67 %argrw{"r"} # C:/Program Files\\Chaos Group\\V-Ray\\3dsmax 2014 for x64\\opensl\\stdosl.h:144 # float clamp (float x, float minval, float maxval) { return max(min(x,maxval),minval); } min $tmp22 $tmp21 $const12 %filename{"C:/Program Files\\Chaos Group\\V-Ray\\3dsmax 2014 for x64\\opensl\\stdosl.h"} %line{144} %argrw{"wrr"} max ___353_mixage $tmp22 $const3 %argrw{"wrr"} # D:\\OSL\\VRAYscripts\\GAO2Vray.osl:208 # div $tmp23 $const12 OverSampling %filename{"D:\\OSL\\VRAYscripts\\GAO2Vray.osl"} %line{208} %argrw{"wrr"} mul $tmp24 ___353_mixage $tmp23 %argrw{"wrr"} add ___353_MixOut ___353_MixOut $tmp24 %argrw{"wrr"} # D:\\OSL\\VRAYscripts\\GAO2Vray.osl:214 # [[ string widget = "number", div $tmp25 $const12 OverSampling %line{214} %argrw{"wrr"} mul $tmp26 $const12 $tmp25 %argrw{"wrr"} add ___353_MixOut ___353_MixOut $tmp26 %argrw{"wrr"} # D:\\OSL\\VRAYscripts\\GAO2Vray.osl:118 # { assign $tmp27 ___353_Loopi %line{118} %argrw{"wr"} add ___353_Loopi ___353_Loopi $const16 %argrw{"wrr"} # D:\\OSL\\VRAYscripts\\GAO2Vray.osl:223 # div $tmp28 $const12 AOgamma %line{223} %argrw{"wrr"} pow ___353_MixOut ___353_MixOut $tmp28 %argrw{"wrr"} # D:\\OSL\\VRAYscripts\\GAO2Vray.osl:226 # { eq $tmp29 InvertEffect $const16 %line{226} %argrw{"wrr"} if $tmp29 80 80 %argrw{"r"} # D:\\OSL\\VRAYscripts\\GAO2Vray.osl:228 # } sub ___353_MixOut $const12 ___353_MixOut %line{228} %argrw{"wrr"} # D:\\OSL\\VRAYscripts\\GAO2Vray.osl:231 # closure color closureHit = ColorHitUse * emission() ; closure $tmp30 $const1 %line{231} %argrw{"wr"} mul ___353_closureIn $tmp30 ___353_ColorInUse %argrw{"wrr"} # D:\\OSL\\VRAYscripts\\GAO2Vray.osl:232 # closure $tmp31 $const1 %line{232} %argrw{"wr"} mul ___353_closureHit $tmp31 ___353_ColorHitUse %argrw{"wrr"} # D:\\OSL\\VRAYscripts\\GAO2Vray.osl:236 # Ci = CoulOut ; mul $tmp32 ___353_closureIn ___353_MixOut %line{236} %argrw{"wrr"} sub $tmp33 $const12 ___353_MixOut %argrw{"wrr"} mul $tmp34 ___353_closureHit $tmp33 %argrw{"wrr"} add $tmp35 $tmp32 $tmp34 %argrw{"wrr"} mul CoulOut $tmp35 BoostExposure %argrw{"wrr"} # D:\\OSL\\VRAYscripts\\GAO2Vray.osl:237 # assign Ci CoulOut %line{237} %argrw{"wr"} end