OpenShadingLanguage 1.01
# Compiled by oslc 1.6.2
surface clay	%meta{string,help,"Clay material"} 
param	float	Ka	1		%meta{string,help,"Ambient scaling"} %meta{float,min,0} %meta{float,max,1}  %read{11,11} %write{2147483647,-1}
param	float	Kd	0.69999999		%meta{string,help,"Diffuse scaling"} %meta{float,min,0} %meta{float,max,1}  %read{61,61} %write{2147483647,-1}
param	float	roughness	0.1		%meta{string,help,"Surface roughness"} %meta{float,min,0} %meta{float,UImax,1}  %read{15,15} %write{2147483647,-1}
global	point	P	%read{31,32} %write{2147483647,-1} %derivs
global	vector	I	%read{3,12} %write{2147483647,-1}
global	normal	N	%read{0,0} %write{2147483647,-1}
global	normal	Ng	%read{3,3} %write{2147483647,-1}
global	color	C	%read{63,64} %write{63,64}
global	color	opacity	%read{64,64} %write{2147483647,-1}
global	vector	L	%read{37,37} %write{2147483647,-1}
global	color	Cl	%read{47,47} %write{2147483647,-1}
local	float	___295_sigma2	%read{16,21} %write{15,15}
local	float	___295_A	%read{57,57} %write{19,19}
local	float	___295_B	%read{52,52} %write{22,22}
local	float	___295_theta_r	%read{44,45} %write{24,24}
local	vector	___295_V_perp_N	%read{42,42} %write{28,28}
local	color	___295_C	%read{30,60} %write{29,59}
local	float	___296_nondiff	%read{30,59} %write{30,59}
local	vector	___297_LN	%read{30,59} %write{30,59}
local	float	___297_cos_theta_i	%read{30,59} %write{30,59}
local	float	___297_cos_phi_diff	%read{30,59} %write{30,59}
local	float	___297_theta_i	%read{30,59} %write{30,59}
local	float	___297_alpha	%read{30,59} %write{30,59}
local	float	___297_beta	%read{30,59} %write{30,59}
local	normal	Nf	%read{23,39} %write{6,7}
temp	normal	$tmp1	%read{6,7} %write{0,0}
const	string	$const1	"faceforward"		%read{1,2} %write{2147483647,-1}
temp	float	$tmp2	%read{4,4} %write{3,3}
const	int	$const2	0		%read{4,33} %write{2147483647,-1}
temp	int	$tmp3	%read{5,5} %write{4,4}
const	string	$const3	"MaterialClay"		%read{9,9} %write{2147483647,-1}
temp	color	$tmp4	%read{11,11} %write{10,10}
temp	color	$tmp5	%read{30,62} %write{11,59}
temp	color	$tmp6	%read{61,61} %write{60,60}
temp	vector	$tmp7	%read{13,13} %write{12,12}
temp	vector	$tmp8	%read{23,27} %write{13,13}
const	string	$const4	"LocIllumOrenNayar"		%read{14,14} %write{2147483647,-1}
const	int	$const5	1		%read{35,35} %write{2147483647,-1}
const	float	$const6	0.5		%read{16,16} %write{2147483647,-1}
temp	float	$tmp9	%read{18,18} %write{16,16}
const	float	$const7	0.33000001		%read{17,17} %write{2147483647,-1}
temp	float	$tmp10	%read{18,18} %write{17,17}
temp	float	$tmp11	%read{19,19} %write{18,18}
const	float	$const8	1		%read{19,46} %write{2147483647,-1}
const	float	$const9	0.44999999		%read{20,20} %write{2147483647,-1}
temp	float	$tmp12	%read{22,22} %write{20,20}
const	float	$const10	0.090000004		%read{21,21} %write{2147483647,-1}
temp	float	$tmp13	%read{22,22} %write{21,21}
temp	float	$tmp14	%read{24,24} %write{23,23}
temp	float	$tmp15	%read{26,26} %write{25,25}
temp	normal	$tmp16	%read{27,27} %write{26,26}
temp	vector	$tmp17	%read{28,28} %write{27,27}
const	float	$const11	1.5707964		%read{31,32} %write{2147483647,-1}
temp	int	$tmp18	%read{30,59} %write{30,59}
temp	int	$tmp19	%read{2147483647,-1} %write{34,34}
const	string	$const12	"light"		%read{34,34} %write{2147483647,-1}
const	string	$const13	"__nondiffuse"		%read{34,34} %write{2147483647,-1}
temp	int	$tmp20	%read{36,36} %write{35,35}
temp	vector	$tmp21	%read{42,42} %write{41,41}
temp	normal	$tmp22	%read{40,40} %write{39,39}
temp	vector	$tmp23	%read{41,41} %write{40,40}
temp	float	$tmp24	%read{47,47} %write{46,46}
temp	color	$tmp25	%read{48,48} %write{47,47}
temp	color	$tmp26	%read{58,58} %write{48,48}
temp	color	$tmp27	%read{52,52} %write{51,51}
const	float	$const14	0		%read{49,49} %write{2147483647,-1}
temp	color	$tmp28	%read{51,51} %write{49,49}
temp	color	$tmp29	%read{51,51} %write{50,50}
temp	color	$tmp30	%read{54,54} %write{52,52}
temp	float	$tmp31	%read{54,54} %write{53,53}
temp	color	$tmp32	%read{56,56} %write{54,54}
temp	float	$tmp33	%read{56,56} %write{55,55}
temp	color	$tmp34	%read{57,57} %write{56,56}
temp	color	$tmp35	%read{58,58} %write{57,57}
temp	color	$tmp36	%read{30,59} %write{30,59}
temp	color	$tmp37	%read{62,62} %write{61,61}
temp	color	$tmp38	%read{63,63} %write{62,62}
code ___main___
# D:\\xrt.git\\src\\osl\\shaders\\clay.osl:61
#     C = MaterialClay (Nf, C, Ka, Kd, roughness);
	normalize	$tmp1 N 	%filename{"D:\\xrt.git\\src\\osl\\shaders\\clay.osl"} %line{61} %argrw{"wr"}
	functioncall	$const1 9 	%argrw{"r"}
# D:/xrt.git\\build\\vc10\\Win32\\Release\\shaders\\stdosl.h:196
# float  mod (float  a, float  b) { return a - b*floor(a/b); }
	functioncall	$const1 9 	%filename{"D:/xrt.git\\build\\vc10\\Win32\\Release\\shaders\\stdosl.h"} %line{196} %argrw{"r"}
# D:/xrt.git\\build\\vc10\\Win32\\Release\\shaders\\stdosl.h:192
#     return (dot(I,Nref) > 0) ? -N : N;
	dot		$tmp2 I Ng 	%line{192} %argrw{"wrr"}
	gt		$tmp3 $tmp2 $const2 	%argrw{"wrr"}
	if		$tmp3 7 8 	%argrw{"r"}
	neg		Nf $tmp1 	%argrw{"wr"}
	assign		Nf $tmp1 	%argrw{"wr"}
	return
# D:\\xrt.git\\src\\osl\\shaders\\clay.osl:62
# 
	functioncall	$const3 64 	%filename{"D:\\xrt.git\\src\\osl\\shaders\\clay.osl"} %line{62} %argrw{"r"}
# D:/xrt.git\\src\\osl\\shaders\\material.h:131
# {
	ambient		$tmp4 	%filename{"D:/xrt.git\\src\\osl\\shaders\\material.h"} %line{131} %argrw{"w"}
	mul		$tmp5 Ka $tmp4 	%argrw{"wrr"}
# D:/xrt.git\\src\\osl\\shaders\\material.h:132
#     return basecolor * (Ka*ambient() + Kd*diffuse(Nf) +
	normalize	$tmp7 I 	%line{132} %argrw{"wr"}
	neg		$tmp8 $tmp7 	%argrw{"wr"}
	functioncall	$const4 61 	%argrw{"r"}
# D:/xrt.git\\src\\osl\\shaders\\material.h:98
#     float sigma2 = roughness * roughness;
	mul		___295_sigma2 roughness roughness 	%line{98} %argrw{"wrr"}
# D:/xrt.git\\src\\osl\\shaders\\material.h:99
#     float A = 1 - 0.5 * sigma2 / (sigma2 + 0.33);
	mul		$tmp9 $const6 ___295_sigma2 	%line{99} %argrw{"wrr"}
	add		$tmp10 ___295_sigma2 $const7 	%argrw{"wrr"}
	div		$tmp11 $tmp9 $tmp10 	%argrw{"wrr"}
	sub		___295_A $const8 $tmp11 	%argrw{"wrr"}
# D:/xrt.git\\src\\osl\\shaders\\material.h:100
#     float B = 0.45 * sigma2 / (sigma2 + 0.09);
	mul		$tmp12 $const9 ___295_sigma2 	%line{100} %argrw{"wrr"}
	add		$tmp13 ___295_sigma2 $const10 	%argrw{"wrr"}
	div		___295_B $tmp12 $tmp13 	%argrw{"wrr"}
# D:/xrt.git\\src\\osl\\shaders\\material.h:102
#     float  theta_r = acos (dot (V, N));        // Angle between V and N
	dot		$tmp14 $tmp8 Nf 	%line{102} %argrw{"wrr"}
	acos		___295_theta_r $tmp14 	%argrw{"wr"}
# D:/xrt.git\\src\\osl\\shaders\\material.h:103
#     vector V_perp_N = normalize(V-N*dot(V,N)); // Part of V perpendicular to N
	dot		$tmp15 $tmp8 Nf 	%line{103} %argrw{"wrr"}
	mul		$tmp16 Nf $tmp15 	%argrw{"wrr"}
	sub		$tmp17 $tmp8 $tmp16 	%argrw{"wrr"}
	normalize	___295_V_perp_N $tmp17 	%argrw{"wr"}
# D:/xrt.git\\src\\osl\\shaders\\material.h:106
#     color C = 0;
	assign		___295_C $const2 	%line{106} %argrw{"wr"}
# D:/xrt.git\\src\\osl\\shaders\\material.h:107
#     lights (P, N, M_PI_2) {
	for		$tmp18 32 33 60 60 	%line{107} %argrw{"r"}
# D:/xrt.git\\src\\osl\\shaders\\material.h:120
#     }
	lights_begin	P Nf $const11 	%line{120} %argrw{"rrr"}
	lights		$tmp18 P Nf $const11 	%argrw{"wrrr"} %argderivs{1}
# D:/xrt.git\\src\\osl\\shaders\\material.h:108
# 	float nondiff = 0;
	assign		___296_nondiff $const2 	%line{108} %argrw{"wr"}
# D:/xrt.git\\src\\osl\\shaders\\material.h:109
# 	getmessage ("light", "__nondiffuse", nondiff);
	getmessage	$tmp19 $const12 $const13 ___296_nondiff 	%line{109} %argrw{"wrrw"}
# D:/xrt.git\\src\\osl\\shaders\\material.h:110
# 	if (nondiff < 1) {
	lt		$tmp20 ___296_nondiff $const5 	%line{110} %argrw{"wrr"}
	if		$tmp20 60 60 	%argrw{"r"}
# D:/xrt.git\\src\\osl\\shaders\\material.h:111
# 	    vector LN = normalize(L);
	normalize	___297_LN L 	%line{111} %argrw{"wr"}
# D:/xrt.git\\src\\osl\\shaders\\material.h:112
# 	    float cos_theta_i = dot(LN, N);
	dot		___297_cos_theta_i ___297_LN Nf 	%line{112} %argrw{"wrr"}
# D:/xrt.git\\src\\osl\\shaders\\material.h:113
# 	    float cos_phi_diff = dot (V_perp_N, normalize(LN - N*cos_theta_i));
	mul		$tmp22 Nf ___297_cos_theta_i 	%line{113} %argrw{"wrr"}
	sub		$tmp23 ___297_LN $tmp22 	%argrw{"wrr"}
	normalize	$tmp21 $tmp23 	%argrw{"wr"}
	dot		___297_cos_phi_diff ___295_V_perp_N $tmp21 	%argrw{"wrr"}
# D:/xrt.git\\src\\osl\\shaders\\material.h:114
# 	    float theta_i = acos (cos_theta_i);
	acos		___297_theta_i ___297_cos_theta_i 	%line{114} %argrw{"wr"}
# D:/xrt.git\\src\\osl\\shaders\\material.h:115
# 	    float alpha = max (theta_i, theta_r);
	max		___297_alpha ___297_theta_i ___295_theta_r 	%line{115} %argrw{"wrr"}
# D:/xrt.git\\src\\osl\\shaders\\material.h:116
# 	    float beta = min (theta_i, theta_r);
	min		___297_beta ___297_theta_i ___295_theta_r 	%line{116} %argrw{"wrr"}
# D:/xrt.git\\src\\osl\\shaders\\material.h:117
# 	    C += (1-nondiff) * Cl * cos_theta_i * 
	sub		$tmp24 $const8 ___296_nondiff 	%line{117} %argrw{"wrr"}
	mul		$tmp25 $tmp24 Cl 	%argrw{"wrr"}
	mul		$tmp26 $tmp25 ___297_cos_theta_i 	%argrw{"wrr"}
# D:/xrt.git\\src\\osl\\shaders\\material.h:118
# 		(A + B * max(0,cos_phi_diff) * sin(alpha) * tan(beta));
	assign		$tmp28 $const14 	%line{118} %argrw{"wr"}
	assign		$tmp29 ___297_cos_phi_diff 	%argrw{"wr"}
	max		$tmp27 $tmp28 $tmp29 	%argrw{"wrr"}
	mul		$tmp30 ___295_B $tmp27 	%argrw{"wrr"}
	sin		$tmp31 ___297_alpha 	%argrw{"wr"}
	mul		$tmp32 $tmp30 $tmp31 	%argrw{"wrr"}
	tan		$tmp33 ___297_beta 	%argrw{"wr"}
	mul		$tmp34 $tmp32 $tmp33 	%argrw{"wrr"}
	add		$tmp35 ___295_A $tmp34 	%argrw{"wrr"}
	mul		$tmp36 $tmp26 $tmp35 	%argrw{"wrr"}
	add		___295_C ___295_C $tmp36 	%argrw{"wrr"}
# D:/xrt.git\\src\\osl\\shaders\\material.h:121
#     return C;
	assign		$tmp6 ___295_C 	%line{121} %argrw{"wr"}
# D:/xrt.git\\src\\osl\\shaders\\material.h:132
# 			Kd*LocIllumOrenNayar(Nf,-normalize(I),roughness));
	mul		$tmp37 Kd $tmp6 	%line{132} %argrw{"wrr"}
	add		$tmp38 $tmp5 $tmp37 	%argrw{"wrr"}
	mul		C C $tmp38 	%argrw{"wrr"}
# D:\\xrt.git\\src\\osl\\shaders\\clay.osl:65
# }
	mul		C C opacity 	%filename{"D:\\xrt.git\\src\\osl\\shaders\\clay.osl"} %line{65} %argrw{"wrr"}
	end
