OpenShadingLanguage 1.01
# Compiled by oslc 1.6.2
surface carpet
param	float	Kd	0.60000002		%read{92,92} %write{2147483647,-1}
param	float	Ka	0.1		%read{74,74} %write{2147483647,-1}
param	float	scuff	1		%read{9,14} %write{2147483647,-1} %derivs
param	float	nap	1		%read{46,49} %write{2147483647,-1}
global	point	P	%read{13,79} %write{2147483647,-1} %derivs
global	vector	I	%read{3,3} %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{95,95} %write{95,95}
global	color	opacity	%read{71,71} %write{2147483647,-1}
global	vector	L	%read{85,85} %write{2147483647,-1}
global	color	Cl	%read{83,83} %write{2147483647,-1}
local	color	___278_C	%read{77,91} %write{76,90}
local	float	___279___nondiffuse	%read{77,90} %write{77,90}
local	normal	Nf	%read{78,86} %write{6,7}
local	point	PP	%read{15,38} %write{14,15} %derivs
local	float	pixelsize	%read{18,65} %write{17,62}
local	float	twice	%read{22,22} %write{18,18}
local	float	pixscale	%read{20,38} %write{20,29}
local	float	weight	%read{35,37} %write{33,36}
local	float	turbulence	%read{20,44} %write{19,43}
local	float	napfreq	%read{52,65} %write{49,49}
local	float	speckle	%read{54,72} %write{48,70}
local	float	mottling	%read{20,71} %write{11,45}
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,80} %write{2147483647,-1}
temp	int	$tmp3	%read{5,5} %write{4,4}
temp	int	$tmp4	%read{10,10} %write{9,9}
const	int	$const3	1		%read{11,63} %write{2147483647,-1}
temp	point	$tmp5	%read{14,14} %write{13,13} %derivs
const	string	$const4	"shader"		%read{13,60} %write{2147483647,-1}
const	string	$const5	"transform"		%read{12,59} %write{2147483647,-1}
const	string	$const6	"common"		%read{13,60} %write{2147483647,-1}
const	float	$const8	2		%read{15,29} %write{2147483647,-1}
temp	float	$tmp6	%read{17,17} %write{16,16}
temp	int	$tmp7	%read{20,29} %write{20,29}
temp	float	$tmp8	%read{27,27} %write{26,26}
temp	float	$tmp9	%read{25,25} %write{24,24}
temp	point	$tmp10	%read{24,24} %write{23,23}
const	float	$const9	0.5		%read{25,44} %write{2147483647,-1}
temp	float	$tmp11	%read{26,26} %write{25,25}
temp	float	$tmp12	%read{28,28} %write{27,27}
temp	int	$tmp13	%read{31,31} %write{30,30}
temp	float	$tmp14	%read{33,33} %write{32,32}
const	float	$const10	1		%read{33,82} %write{2147483647,-1}
const	float	$const11	0		%read{36,84} %write{2147483647,-1}
const	string	$const12	"clamp"		%read{34,34} %write{2147483647,-1}
temp	float	$tmp15	%read{36,36} %write{35,35}
temp	float	$tmp16	%read{42,42} %write{37,37}
temp	float	$tmp17	%read{42,42} %write{41,41}
temp	float	$tmp18	%read{40,40} %write{39,39}
temp	point	$tmp19	%read{39,39} %write{38,38}
temp	float	$tmp20	%read{41,41} %write{40,40}
temp	float	$tmp21	%read{43,43} %write{42,42}
temp	float	$tmp22	%read{45,45} %write{44,44}
temp	int	$tmp23	%read{47,47} %write{46,46}
const	float	$const14	100		%read{49,49} %write{2147483647,-1}
temp	point	$tmp24	%read{52,52} %write{51,51}
temp	point	$tmp25	%read{53,53} %write{52,52}
const	float	$const15	0.25		%read{55,55} %write{2147483647,-1}
temp	int	$tmp26	%read{56,56} %write{55,55}
const	float	$const16	0.2		%read{57,57} %write{2147483647,-1}
temp	float	$tmp27	%read{62,62} %write{61,61}
temp	point	$tmp28	%read{61,61} %write{60,60} %derivs
temp	int	$tmp29	%read{64,64} %write{63,63}
temp	float	$tmp30	%read{67,67} %write{66,66}
temp	float	$tmp31	%read{66,66} %write{65,65}
temp	float	$tmp32	%read{69,69} %write{67,67}
temp	float	$tmp33	%read{69,69} %write{68,68}
temp	float	$tmp34	%read{70,70} %write{69,69}
temp	color	$tmp35	%read{72,72} %write{71,71}
temp	color	$tmp36	%read{77,94} %write{72,90}
temp	color	$tmp37	%read{74,74} %write{73,73}
temp	color	$tmp38	%read{77,93} %write{74,90}
temp	color	$tmp39	%read{92,92} %write{91,91}
const	string	$const17	"diffuse"		%read{75,75} %write{2147483647,-1}
const	float	$const18	1.5707964		%read{78,79} %write{2147483647,-1}
temp	int	$tmp40	%read{77,90} %write{77,90}
temp	int	$tmp41	%read{2147483647,-1} %write{81,81}
const	string	$const19	"light"		%read{81,81} %write{2147483647,-1}
const	string	$const20	"__nondiffuse"		%read{81,81} %write{2147483647,-1}
temp	float	$tmp42	%read{83,83} %write{82,82}
temp	color	$tmp43	%read{89,89} %write{83,83}
temp	color	$tmp44	%read{89,89} %write{88,88}
temp	color	$tmp45	%read{88,88} %write{84,84}
temp	float	$tmp46	%read{87,87} %write{86,86}
temp	vector	$tmp47	%read{86,86} %write{85,85}
temp	color	$tmp48	%read{88,88} %write{87,87}
temp	color	$tmp49	%read{77,90} %write{77,90}
temp	color	$tmp50	%read{93,93} %write{92,92}
temp	color	$tmp51	%read{94,94} %write{93,93}
temp	color	$tmp52	%read{95,95} %write{94,94}
code ___main___
# D:\\xrt.git\\src\\osl\\shaders\\carpet.osl:20
# 
	normalize	$tmp1 N 	%filename{"D:\\xrt.git\\src\\osl\\shaders\\carpet.osl"} %line{20} %argrw{"wr"}
	functioncall	$const1 9 	%argrw{"r"}
# D:/xrt.git\\build\\vc10\\Win32\\Release\\shaders\\stdosl.h:196
# float dot (vector a, vector b) BUILTIN;
	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\\carpet.osl:24
# 	else {
	eq		$tmp4 scuff $const2 	%filename{"D:\\xrt.git\\src\\osl\\shaders\\carpet.osl"} %line{24} %argrw{"wrr"}
	if		$tmp4 12 46 	%argrw{"r"}
	assign		mottling $const3 	%argrw{"wr"}
# D:\\xrt.git\\src\\osl\\shaders\\carpet.osl:27
# 		PP = PP/2;	/* frequency adjustment (S-shaped curve) */
	functioncall	$const5 14 	%line{27} %argrw{"r"}
# D:/xrt.git\\build\\vc10\\Win32\\Release\\shaders\\stdosl.h:249
#         // OPT: the following recomputes some of the above values, but it 
	transform	$tmp5 $const6 $const4 P 	%filename{"D:/xrt.git\\build\\vc10\\Win32\\Release\\shaders\\stdosl.h"} %line{249} %argrw{"wrrr"}
# D:\\xrt.git\\src\\osl\\shaders\\carpet.osl:27
# 		PP = PP/2;	/* frequency adjustment (S-shaped curve) */
	mul		PP $tmp5 scuff 	%filename{"D:\\xrt.git\\src\\osl\\shaders\\carpet.osl"} %line{27} %argrw{"wrr"}
# D:\\xrt.git\\src\\osl\\shaders\\carpet.osl:28
# 		pixelsize = sqrt(area(PP)); twice = 2 * pixelsize;
	div		PP PP $const8 	%line{28} %argrw{"wrr"}
# D:\\xrt.git\\src\\osl\\shaders\\carpet.osl:29
# 	    /* create some turbulence */
	area		$tmp6 PP 	%line{29} %argrw{"wr"} %argderivs{1}
	sqrt		pixelsize $tmp6 	%argrw{"wr"}
	mul		twice $const8 pixelsize 	%argrw{"wrr"}
# D:\\xrt.git\\src\\osl\\shaders\\carpet.osl:31
# 		for (pixscale = 1; pixscale > twice; pixscale /= 2) {
	assign		turbulence $const2 	%line{31} %argrw{"wr"}
# D:\\xrt.git\\src\\osl\\shaders\\carpet.osl:32
# 			turbulence += pixscale * abs(noise(PP/pixscale)-0.5);
	for		$tmp7 22 23 29 30 	%line{32} %argrw{"r"}
	assign		pixscale $const3 	%argrw{"wr"}
	gt		$tmp7 pixscale twice 	%argrw{"wrr"}
# D:\\xrt.git\\src\\osl\\shaders\\carpet.osl:33
# 		}
	div		$tmp10 PP pixscale 	%line{33} %argrw{"wrr"}
	noise		$tmp9 $tmp10 	%argrw{"wr"}
	sub		$tmp11 $tmp9 $const9 	%argrw{"wrr"}
	abs		$tmp8 $tmp11 	%argrw{"wr"}
	mul		$tmp12 pixscale $tmp8 	%argrw{"wrr"}
	add		turbulence turbulence $tmp12 	%argrw{"wrr"}
# D:\\xrt.git\\src\\osl\\shaders\\carpet.osl:32
# 			turbulence += pixscale * abs(noise(PP/pixscale)-0.5);
	div		pixscale pixscale $const8 	%line{32} %argrw{"wrr"}
# D:\\xrt.git\\src\\osl\\shaders\\carpet.osl:36
# 			weight = (pixscale / pixelsize) - 1;
	gt		$tmp13 pixscale pixelsize 	%line{36} %argrw{"wrr"}
	if		$tmp13 44 44 	%argrw{"r"}
# D:\\xrt.git\\src\\osl\\shaders\\carpet.osl:37
# 			weight = clamp(weight, 0, 1);
	div		$tmp14 pixscale pixelsize 	%line{37} %argrw{"wrr"}
	sub		weight $tmp14 $const10 	%argrw{"wrr"}
# D:\\xrt.git\\src\\osl\\shaders\\carpet.osl:38
# 			turbulence += weight * pixscale * abs(noise(PP/pixscale)-0.5);
	functioncall	$const12 37 	%line{38} %argrw{"r"}
# D:/xrt.git\\build\\vc10\\Win32\\Release\\shaders\\stdosl.h:144
# color  log (color a,  float b) { return log(a)/log(b); }
	min		$tmp15 weight $const10 	%filename{"D:/xrt.git\\build\\vc10\\Win32\\Release\\shaders\\stdosl.h"} %line{144} %argrw{"wrr"}
	max		weight $tmp15 $const11 	%argrw{"wrr"}
# D:\\xrt.git\\src\\osl\\shaders\\carpet.osl:39
# 		}
	mul		$tmp16 weight pixscale 	%filename{"D:\\xrt.git\\src\\osl\\shaders\\carpet.osl"} %line{39} %argrw{"wrr"}
	div		$tmp19 PP pixscale 	%argrw{"wrr"}
	noise		$tmp18 $tmp19 	%argrw{"wr"}
	sub		$tmp20 $tmp18 $const9 	%argrw{"wrr"}
	abs		$tmp17 $tmp20 	%argrw{"wr"}
	mul		$tmp21 $tmp16 $tmp17 	%argrw{"wrr"}
	add		turbulence turbulence $tmp21 	%argrw{"wrr"}
# D:\\xrt.git\\src\\osl\\shaders\\carpet.osl:42
# 	}
	add		$tmp22 turbulence $const9 	%line{42} %argrw{"wrr"}
	min		mottling $tmp22 $const10 	%argrw{"wrr"}
# D:\\xrt.git\\src\\osl\\shaders\\carpet.osl:46
# 	else {
	eq		$tmp23 nap $const2 	%line{46} %argrw{"wrr"}
	if		$tmp23 49 71 	%argrw{"r"}
	assign		speckle $const3 	%argrw{"wr"}
# D:\\xrt.git\\src\\osl\\shaders\\carpet.osl:49
# 		speckle = noise(transform("shader",P)/napfreq);
	div		napfreq nap $const14 	%line{49} %argrw{"wrr"}
# D:\\xrt.git\\src\\osl\\shaders\\carpet.osl:50
# 		speckle = speckle * speckle;
	functioncall	$const5 52 	%line{50} %argrw{"r"}
# D:/xrt.git\\build\\vc10\\Win32\\Release\\shaders\\stdosl.h:249
# vector refract (vector I, vector N, float eta) {
	transform	$tmp24 $const6 $const4 P 	%filename{"D:/xrt.git\\build\\vc10\\Win32\\Release\\shaders\\stdosl.h"} %line{249} %argrw{"wrrr"}
# D:\\xrt.git\\src\\osl\\shaders\\carpet.osl:50
# 		speckle = speckle * speckle;
	div		$tmp25 $tmp24 napfreq 	%filename{"D:\\xrt.git\\src\\osl\\shaders\\carpet.osl"} %line{50} %argrw{"wrr"}
	noise		speckle $tmp25 	%argrw{"wr"}
# D:\\xrt.git\\src\\osl\\shaders\\carpet.osl:51
# 	    /* two-level speckles */
	mul		speckle speckle speckle 	%line{51} %argrw{"wrr"}
# D:\\xrt.git\\src\\osl\\shaders\\carpet.osl:53
# 	    /* smooth out speckles as they get smaller */
	le		$tmp26 speckle $const15 	%line{53} %argrw{"wrr"}
	if		$tmp26 58 59 	%argrw{"r"}
	assign		speckle $const16 	%argrw{"wr"}
	assign		speckle $const3 	%argrw{"wr"}
# D:\\xrt.git\\src\\osl\\shaders\\carpet.osl:55
# 		if (speckle<1) speckle = (1-smoothstep(0,1,napfreq/pixelsize))
	functioncall	$const5 61 	%line{55} %argrw{"r"}
# D:/xrt.git\\build\\vc10\\Win32\\Release\\shaders\\stdosl.h:249
# vector faceforward (vector N, vector I)
	transform	$tmp28 $const6 $const4 P 	%filename{"D:/xrt.git\\build\\vc10\\Win32\\Release\\shaders\\stdosl.h"} %line{249} %argrw{"wrrr"}
# D:\\xrt.git\\src\\osl\\shaders\\carpet.osl:55
# 		if (speckle<1) speckle = (1-smoothstep(0,1,napfreq/pixelsize))
	area		$tmp27 $tmp28 	%filename{"D:\\xrt.git\\src\\osl\\shaders\\carpet.osl"} %line{55} %argrw{"wr"} %argderivs{1}
	sqrt		pixelsize $tmp27 	%argrw{"wr"}
# D:\\xrt.git\\src\\osl\\shaders\\carpet.osl:56
# 					*(1-speckle) + speckle;
	lt		$tmp29 speckle $const3 	%line{56} %argrw{"wrr"}
	if		$tmp29 71 71 	%argrw{"r"}
	div		$tmp31 napfreq pixelsize 	%argrw{"wrr"}
	smoothstep	$tmp30 $const11 $const10 $tmp31 	%argrw{"wrrr"}
	sub		$tmp32 $const10 $tmp30 	%argrw{"wrr"}
# D:\\xrt.git\\src\\osl\\shaders\\carpet.osl:57
# 	}
	sub		$tmp33 $const10 speckle 	%line{57} %argrw{"wrr"}
	mul		$tmp34 $tmp32 $tmp33 	%argrw{"wrr"}
	add		speckle $tmp34 speckle 	%argrw{"wrr"}
# D:\\xrt.git\\src\\osl\\shaders\\carpet.osl:61
# }
	mul		$tmp35 opacity mottling 	%line{61} %argrw{"wrr"}
	mul		$tmp36 $tmp35 speckle 	%argrw{"wrr"}
	ambient		$tmp37 	%argrw{"w"}
	mul		$tmp38 Ka $tmp37 	%argrw{"wrr"}
	functioncall	$const17 92 	%argrw{"r"}
# D:/xrt.git\\build\\vc10\\Win32\\Release\\shaders\\stdosl.h:501
# }
	assign		___278_C $const2 	%filename{"D:/xrt.git\\build\\vc10\\Win32\\Release\\shaders\\stdosl.h"} %line{501} %argrw{"wr"}
# D:/xrt.git\\build\\vc10\\Win32\\Release\\shaders\\stdosl.h:503
# 
	for		$tmp40 79 80 91 91 	%line{503} %argrw{"r"}
# D:/xrt.git\\build\\vc10\\Win32\\Release\\shaders\\stdosl.h:507
# // Displacement functions
	lights_begin	P Nf $const18 	%line{507} %argrw{"rrr"}
	lights		$tmp40 P Nf $const18 	%argrw{"wrrr"} %argderivs{1}
# D:/xrt.git\\build\\vc10\\Win32\\Release\\shaders\\stdosl.h:504
# 		float __nondiffuse = 0;
	assign		___279___nondiffuse $const2 	%line{504} %argrw{"wr"}
# D:/xrt.git\\build\\vc10\\Win32\\Release\\shaders\\stdosl.h:505
# 		getmessage ("light", "__nondiffuse", __nondiffuse);
	getmessage	$tmp41 $const19 $const20 ___279___nondiffuse 	%line{505} %argrw{"wrrw"}
# D:/xrt.git\\build\\vc10\\Win32\\Release\\shaders\\stdosl.h:506
# 		C += Cl * (1-__nondiffuse) * max (0, dot (N, normalize (L)));
	sub		$tmp42 $const10 ___279___nondiffuse 	%line{506} %argrw{"wrr"}
	mul		$tmp43 Cl $tmp42 	%argrw{"wrr"}
	assign		$tmp45 $const11 	%argrw{"wr"}
	normalize	$tmp47 L 	%argrw{"wr"}
	dot		$tmp46 Nf $tmp47 	%argrw{"wrr"}
	assign		$tmp48 $tmp46 	%argrw{"wr"}
	max		$tmp44 $tmp45 $tmp48 	%argrw{"wrr"}
	mul		$tmp49 $tmp43 $tmp44 	%argrw{"wrr"}
	add		___278_C ___278_C $tmp49 	%argrw{"wrr"}
# D:/xrt.git\\build\\vc10\\Win32\\Release\\shaders\\stdosl.h:508
# 	return C;
	assign		$tmp39 ___278_C 	%line{508} %argrw{"wr"}
# D:\\xrt.git\\src\\osl\\shaders\\carpet.osl:61
# }
	mul		$tmp50 Kd $tmp39 	%filename{"D:\\xrt.git\\src\\osl\\shaders\\carpet.osl"} %line{61} %argrw{"wrr"}
	add		$tmp51 $tmp38 $tmp50 	%argrw{"wrr"}
	mul		$tmp52 $tmp36 $tmp51 	%argrw{"wrr"}
	mul		C C $tmp52 	%argrw{"wrr"}
	end
