OpenShadingLanguage 1.00
# Compiled by oslc 1.11.17
# options: -q -O2 -I/build/blender/src/blender/intern/cycles/kernel/osl/shaders -I/usr/share/OSL/shaders -o /build/blender/src/blender/build/intern/cycles/kernel/osl/shaders/node_principled_hair_bsdf.oso
shader node_principled_hair_bsdf
param	color	Color	0.0175129995 0.00576299988 0.00205900008		%read{78,82} %write{2147483647,-1}
param	float	Melanin	0.800000012		%read{28,28} %write{2147483647,-1}
param	float	MelaninRedness	1		%read{33,35} %write{2147483647,-1}
param	float	RandomColor	0		%read{26,26} %write{2147483647,-1}
param	color	Tint	1 1 1		%read{53,57} %write{2147483647,-1}
param	color	AbsorptionCoefficient	0.245530993 0.519999981 1.36500001		%read{21,21} %write{2147483647,-1}
param	normal	Normal	0 0 0		%read{91,91} %write{0,0} %initexpr
param	string	parametrization	"Absorption coefficient"		%read{19,63} %write{2147483647,-1}
param	float	Offset	0		%read{91,91} %write{3,3} %initexpr
param	float	Roughness	0.300000012		%read{17,17} %write{2147483647,-1}
param	float	RadialRoughness	0.300000012		%read{18,18} %write{2147483647,-1}
param	float	RandomRoughness	0		%read{11,11} %write{2147483647,-1}
param	float	Coat	0		%read{14,14} %write{2147483647,-1}
param	float	IOR	1.54999995		%read{91,91} %write{2147483647,-1}
param	string	AttrRandom	"geom:curve_random"		%read{8,8} %write{2147483647,-1}
param	float	Random	0		%read{5,7} %write{2147483647,-1}
oparam	closure color	BSDF			%read{2147483647,-1} %write{91,91}
global	normal	Ng	%read{0,0} %write{2147483647,-1}
local	float	___370_x	%read{42,75} %write{41,66}
local	float	___370_roughness_fac	%read{60,85} %write{51,76}
local	color	___370_sigma	%read{61,86} %write{60,85}
local	float	random_value	%read{9,24} %write{4,8}
local	float	factor_random_roughness	%read{17,18} %write{12,12}
local	float	m0_roughness	%read{91,91} %write{16,16}
local	float	roughness	%read{91,91} %write{17,17}
local	float	radial_roughness	%read{41,91} %write{18,18}
local	color	sigma	%read{91,91} %write{21,90}
local	float	___374_factor_random_color	%read{28,28} %write{27,27}
local	float	___374_melanin	%read{29,35} %write{28,32}
local	float	___374_eumelanin	%read{37,37} %write{34,34}
local	float	___374_pheomelanin	%read{38,38} %write{35,35}
local	color	___374_melanin_sigma	%read{62,62} %write{39,39}
local	color	___374_tint_sigma	%read{62,62} %write{61,61}
const	int	$const1	2		%read{57,82} %write{2147483647,-1}
const	float	$const2	2		%read{3,25} %write{2147483647,-1}
const	string	$const3	"radians"		%read{1,1} %write{2147483647,-1}
const	float	$const4	3.14159274		%read{2,2} %write{2147483647,-1}
const	float	$const5	180		%read{2,2} %write{2147483647,-1}
temp	float	$tmp1	%read{3,3} %write{2,2}
const	float	$const6	0		%read{4,88} %write{2147483647,-1}
temp	int	$tmp2	%read{6,6} %write{5,5}
temp	int	$tmp3	%read{2147483647,-1} %write{8,8}
const	float	$const7	1		%read{12,33} %write{2147483647,-1}
const	float	$const8	0.5		%read{9,24} %write{2147483647,-1}
temp	float	$tmp4	%read{10,10} %write{9,9}
temp	float	$tmp5	%read{11,11} %write{10,10}
temp	float	$tmp6	%read{12,12} %write{11,11}
temp	float	$tmp7	%read{16,16} %write{15,15}
const	string	$const9	"clamp"		%read{13,13} %write{2147483647,-1}
temp	float	$tmp8	%read{15,15} %write{14,14}
const	string	$const10	"Absorption coefficient"		%read{19,19} %write{2147483647,-1}
temp	int	$tmp9	%read{20,20} %write{19,19}
const	string	$const11	"Melanin concentration"		%read{22,22} %write{2147483647,-1}
temp	int	$tmp10	%read{23,23} %write{22,22}
temp	float	$tmp11	%read{25,25} %write{24,24}
temp	float	$tmp12	%read{26,26} %write{25,25}
temp	float	$tmp13	%read{27,27} %write{26,26}
temp	float	$tmp14	%read{32,32} %write{31,31}
temp	float	$tmp15	%read{31,31} %write{30,30}
temp	float	$tmp16	%read{30,30} %write{29,29}
const	float	$const12	9.99999975e-05		%read{30,30} %write{2147483647,-1}
temp	float	$tmp17	%read{34,34} %write{33,33}
const	string	$const13	"sigma_from_concentration"		%read{36,87} %write{2147483647,-1}
const	color	$const14	0.505999982 0.841000021 1.653		%read{37,88} %write{2147483647,-1}
temp	color	$tmp19	%read{39,39} %write{37,37}
const	color	$const15	0.342999995 0.73299998 1.92400002		%read{38,89} %write{2147483647,-1}
temp	color	$tmp21	%read{39,39} %write{38,38}
const	string	$const16	"sigma_from_reflectance"		%read{40,65} %write{2147483647,-1}
const	float	$const17	0.245000005		%read{42,67} %write{2147483647,-1}
temp	float	$tmp22	%read{43,43} %write{42,42}
const	float	$const18	5.57399988		%read{43,68} %write{2147483647,-1}
temp	float	$tmp23	%read{44,44} %write{43,43}
temp	float	$tmp24	%read{45,45} %write{44,44}
const	float	$const19	10.7299995		%read{45,70} %write{2147483647,-1}
temp	float	$tmp25	%read{46,46} %write{45,45}
temp	float	$tmp26	%read{47,47} %write{46,46}
const	float	$const20	2.53200006		%read{47,72} %write{2147483647,-1}
temp	float	$tmp27	%read{48,48} %write{47,47}
temp	float	$tmp28	%read{49,49} %write{48,48}
const	float	$const21	0.215000004		%read{49,74} %write{2147483647,-1}
temp	float	$tmp29	%read{50,50} %write{49,49}
temp	float	$tmp30	%read{51,51} %write{50,50}
const	float	$const22	5.96899986		%read{51,76} %write{2147483647,-1}
temp	color	$tmp31	%read{60,60} %write{59,59}
const	string	$const23	"log3"		%read{52,77} %write{2147483647,-1}
temp	float	$tmp32	%read{59,59} %write{54,54}
const	int	$const24	0		%read{53,78} %write{2147483647,-1}
temp	float	$tmp33	%read{54,54} %write{53,53}
temp	float	$tmp34	%read{59,59} %write{56,56}
const	int	$const25	1		%read{55,80} %write{2147483647,-1}
temp	float	$tmp35	%read{56,56} %write{55,55}
temp	float	$tmp36	%read{59,59} %write{58,58}
temp	float	$tmp37	%read{58,58} %write{57,57}
const	string	$const26	"Direct coloring"		%read{63,63} %write{2147483647,-1}
temp	int	$tmp38	%read{64,64} %write{63,63}
temp	float	$tmp39	%read{68,68} %write{67,67}
temp	float	$tmp40	%read{69,69} %write{68,68}
temp	float	$tmp41	%read{70,70} %write{69,69}
temp	float	$tmp42	%read{71,71} %write{70,70}
temp	float	$tmp43	%read{72,72} %write{71,71}
temp	float	$tmp44	%read{73,73} %write{72,72}
temp	float	$tmp45	%read{74,74} %write{73,73}
temp	float	$tmp46	%read{75,75} %write{74,74}
temp	float	$tmp47	%read{76,76} %write{75,75}
temp	color	$tmp48	%read{85,85} %write{84,84}
temp	float	$tmp49	%read{84,84} %write{79,79}
temp	float	$tmp50	%read{79,79} %write{78,78}
temp	float	$tmp51	%read{84,84} %write{81,81}
temp	float	$tmp52	%read{81,81} %write{80,80}
temp	float	$tmp53	%read{84,84} %write{83,83}
temp	float	$tmp54	%read{83,83} %write{82,82}
const	float	$const27	0.805437505		%read{89,89} %write{2147483647,-1}
temp	color	$tmp56	%read{90,90} %write{88,88}
temp	color	$tmp58	%read{90,90} %write{89,89}
const	string	$const28	"principled_hair"		%read{91,91} %write{2147483647,-1}
code Normal
# /build/blender/src/blender/intern/cycles/kernel/osl/shaders/node_principled_hair_bsdf.osl:31
#                                  normal Normal = Ng,
	assign		Normal Ng 	%filename{"/build/blender/src/blender/intern/cycles/kernel/osl/shaders/node_principled_hair_bsdf.osl"} %line{31} %argrw{"wr"}
code Offset
# /build/blender/src/blender/intern/cycles/kernel/osl/shaders/node_principled_hair_bsdf.osl:33
#                                  float Offset = radians(2),
	functioncall	$const3 4 	%filename{"/build/blender/src/blender/intern/cycles/kernel/osl/shaders/node_principled_hair_bsdf.osl"} %line{33} %argrw{"r"}
# /usr/share/OSL/shaders/stdosl.h:65
# float  radians (float x)  { return x*(M_PI/180.0); }
	div		$tmp1 $const4 $const5 	%filename{"/usr/share/OSL/shaders/stdosl.h"} %line{65} %argrw{"wrr"}
	mul		Offset $const2 $tmp1 	%argrw{"wrr"}
code ___main___
# /build/blender/src/blender/intern/cycles/kernel/osl/shaders/node_principled_hair_bsdf.osl:45
#   float random_value = 0.0;
	assign		random_value $const6 	%filename{"/build/blender/src/blender/intern/cycles/kernel/osl/shaders/node_principled_hair_bsdf.osl"} %line{45} %argrw{"wr"}
# /build/blender/src/blender/intern/cycles/kernel/osl/shaders/node_principled_hair_bsdf.osl:47
#   if (isconnected(Random)) {
	isconnected	$tmp2 Random 	%line{47} %argrw{"wr"}
	if		$tmp2 8 9 	%argrw{"r"}
# /build/blender/src/blender/intern/cycles/kernel/osl/shaders/node_principled_hair_bsdf.osl:48
#     random_value = Random;
	assign		random_value Random 	%line{48} %argrw{"wr"}
# /build/blender/src/blender/intern/cycles/kernel/osl/shaders/node_principled_hair_bsdf.osl:51
#     getattribute(AttrRandom, random_value);
	getattribute	$tmp3 AttrRandom random_value 	%line{51} %argrw{"wrw"}
# /build/blender/src/blender/intern/cycles/kernel/osl/shaders/node_principled_hair_bsdf.osl:55
#   float factor_random_roughness = 1.0 + 2.0 * (random_value - 0.5) * RandomRoughness;
	sub		$tmp4 random_value $const8 	%line{55} %argrw{"wrr"}
	mul		$tmp5 $const2 $tmp4 	%argrw{"wrr"}
	mul		$tmp6 $tmp5 RandomRoughness 	%argrw{"wrr"}
	add		factor_random_roughness $const7 $tmp6 	%argrw{"wrr"}
# /build/blender/src/blender/intern/cycles/kernel/osl/shaders/node_principled_hair_bsdf.osl:56
#   float m0_roughness = 1.0 - clamp(Coat, 0.0, 1.0);
	functioncall	$const9 16 	%line{56} %argrw{"r"}
# /usr/share/OSL/shaders/stdosl.h:141
# float  clamp (float x, float minval, float maxval) { return max(min(x,maxval),minval); }
	min		$tmp8 Coat $const7 	%filename{"/usr/share/OSL/shaders/stdosl.h"} %line{141} %argrw{"wrr"}
	max		$tmp7 $tmp8 $const6 	%argrw{"wrr"}
# /build/blender/src/blender/intern/cycles/kernel/osl/shaders/node_principled_hair_bsdf.osl:56
#   float m0_roughness = 1.0 - clamp(Coat, 0.0, 1.0);
	sub		m0_roughness $const7 $tmp7 	%filename{"/build/blender/src/blender/intern/cycles/kernel/osl/shaders/node_principled_hair_bsdf.osl"} %line{56} %argrw{"wrr"}
# /build/blender/src/blender/intern/cycles/kernel/osl/shaders/node_principled_hair_bsdf.osl:57
#   float roughness = Roughness * factor_random_roughness;
	mul		roughness Roughness factor_random_roughness 	%line{57} %argrw{"wrr"}
# /build/blender/src/blender/intern/cycles/kernel/osl/shaders/node_principled_hair_bsdf.osl:58
#   float radial_roughness = RadialRoughness * factor_random_roughness;
	mul		radial_roughness RadialRoughness factor_random_roughness 	%line{58} %argrw{"wrr"}
# /build/blender/src/blender/intern/cycles/kernel/osl/shaders/node_principled_hair_bsdf.osl:63
#   if (parametrization == "Absorption coefficient") {
	eq		$tmp9 parametrization $const10 	%line{63} %argrw{"wrr"}
	if		$tmp9 22 91 	%argrw{"r"}
# /build/blender/src/blender/intern/cycles/kernel/osl/shaders/node_principled_hair_bsdf.osl:64
#     sigma = AbsorptionCoefficient;
	assign		sigma AbsorptionCoefficient 	%line{64} %argrw{"wr"}
# /build/blender/src/blender/intern/cycles/kernel/osl/shaders/node_principled_hair_bsdf.osl:66
#   else if (parametrization == "Melanin concentration") {
	eq		$tmp10 parametrization $const11 	%line{66} %argrw{"wrr"}
	if		$tmp10 63 91 	%argrw{"r"}
# /build/blender/src/blender/intern/cycles/kernel/osl/shaders/node_principled_hair_bsdf.osl:68
#     float factor_random_color = 1.0 + 2.0 * (random_value - 0.5) * RandomColor;
	sub		$tmp11 random_value $const8 	%line{68} %argrw{"wrr"}
	mul		$tmp12 $const2 $tmp11 	%argrw{"wrr"}
	mul		$tmp13 $tmp12 RandomColor 	%argrw{"wrr"}
	add		___374_factor_random_color $const7 $tmp13 	%argrw{"wrr"}
# /build/blender/src/blender/intern/cycles/kernel/osl/shaders/node_principled_hair_bsdf.osl:69
#     float melanin = Melanin * factor_random_color;
	mul		___374_melanin Melanin ___374_factor_random_color 	%line{69} %argrw{"wrr"}
# /build/blender/src/blender/intern/cycles/kernel/osl/shaders/node_principled_hair_bsdf.osl:72
#     melanin = -log(max(1.0 - melanin, 0.0001));
	sub		$tmp16 $const7 ___374_melanin 	%line{72} %argrw{"wrr"}
	max		$tmp15 $tmp16 $const12 	%argrw{"wrr"}
	log		$tmp14 $tmp15 	%argrw{"wr"}
	neg		___374_melanin $tmp14 	%argrw{"wr"}
# /build/blender/src/blender/intern/cycles/kernel/osl/shaders/node_principled_hair_bsdf.osl:75
#     float eumelanin = melanin * (1.0 - MelaninRedness);
	sub		$tmp17 $const7 MelaninRedness 	%line{75} %argrw{"wrr"}
	mul		___374_eumelanin ___374_melanin $tmp17 	%argrw{"wrr"}
# /build/blender/src/blender/intern/cycles/kernel/osl/shaders/node_principled_hair_bsdf.osl:76
#     float pheomelanin = melanin * MelaninRedness;
	mul		___374_pheomelanin ___374_melanin MelaninRedness 	%line{76} %argrw{"wrr"}
# /build/blender/src/blender/intern/cycles/kernel/osl/shaders/node_principled_hair_bsdf.osl:77
#     color melanin_sigma = sigma_from_concentration(eumelanin, pheomelanin);
	functioncall	$const13 40 	%line{77} %argrw{"r"}
# /build/blender/src/blender/intern/cycles/kernel/osl/shaders/node_principled_hair_bsdf.osl:13
#   return eumelanin * color(0.506, 0.841, 1.653) + pheomelanin * color(0.343, 0.733, 1.924);
	mul		$tmp19 ___374_eumelanin $const14 	%line{13} %argrw{"wrr"}
	mul		$tmp21 ___374_pheomelanin $const15 	%argrw{"wrr"}
	add		___374_melanin_sigma $tmp19 $tmp21 	%argrw{"wrr"}
# /build/blender/src/blender/intern/cycles/kernel/osl/shaders/node_principled_hair_bsdf.osl:80
#     color tint_sigma = sigma_from_reflectance(Tint, radial_roughness);
	functioncall	$const16 62 	%line{80} %argrw{"r"}
# /build/blender/src/blender/intern/cycles/kernel/osl/shaders/node_principled_hair_bsdf.osl:18
#   float x = azimuthal_roughness;
	assign		___370_x radial_roughness 	%line{18} %argrw{"wr"}
# /build/blender/src/blender/intern/cycles/kernel/osl/shaders/node_principled_hair_bsdf.osl:19
#   float roughness_fac = (((((0.245 * x) + 5.574) * x - 10.73) * x + 2.532) * x - 0.215) * x +
	mul		$tmp22 $const17 ___370_x 	%line{19} %argrw{"wrr"}
	add		$tmp23 $tmp22 $const18 	%argrw{"wrr"}
	mul		$tmp24 $tmp23 ___370_x 	%argrw{"wrr"}
	sub		$tmp25 $tmp24 $const19 	%argrw{"wrr"}
	mul		$tmp26 $tmp25 ___370_x 	%argrw{"wrr"}
	add		$tmp27 $tmp26 $const20 	%argrw{"wrr"}
	mul		$tmp28 $tmp27 ___370_x 	%argrw{"wrr"}
	sub		$tmp29 $tmp28 $const21 	%argrw{"wrr"}
	mul		$tmp30 $tmp29 ___370_x 	%argrw{"wrr"}
	add		___370_roughness_fac $tmp30 $const22 	%argrw{"wrr"}
# /build/blender/src/blender/intern/cycles/kernel/osl/shaders/node_principled_hair_bsdf.osl:21
#   color sigma = log3(c) / roughness_fac;
	functioncall	$const23 60 	%line{21} %argrw{"r"}
# /build/blender/src/blender/intern/cycles/kernel/osl/shaders/node_principled_hair_bsdf.osl:8
#   return color(log(a[0]), log(a[1]), log(a[2]));
	compref		$tmp33 Tint $const24 	%line{8} %argrw{"wrr"}
	log		$tmp32 $tmp33 	%argrw{"wr"}
	compref		$tmp35 Tint $const25 	%argrw{"wrr"}
	log		$tmp34 $tmp35 	%argrw{"wr"}
	compref		$tmp37 Tint $const1 	%argrw{"wrr"}
	log		$tmp36 $tmp37 	%argrw{"wr"}
	color		$tmp31 $tmp32 $tmp34 $tmp36 	%argrw{"wrrr"}
# /build/blender/src/blender/intern/cycles/kernel/osl/shaders/node_principled_hair_bsdf.osl:21
#   color sigma = log3(c) / roughness_fac;
	div		___370_sigma $tmp31 ___370_roughness_fac 	%line{21} %argrw{"wrr"}
# /build/blender/src/blender/intern/cycles/kernel/osl/shaders/node_principled_hair_bsdf.osl:22
#   return sigma * sigma;
	mul		___374_tint_sigma ___370_sigma ___370_sigma 	%line{22} %argrw{"wrr"}
# /build/blender/src/blender/intern/cycles/kernel/osl/shaders/node_principled_hair_bsdf.osl:81
#     sigma = melanin_sigma + tint_sigma;
	add		sigma ___374_melanin_sigma ___374_tint_sigma 	%line{81} %argrw{"wrr"}
# /build/blender/src/blender/intern/cycles/kernel/osl/shaders/node_principled_hair_bsdf.osl:83
#   else if (parametrization == "Direct coloring") {
	eq		$tmp38 parametrization $const26 	%line{83} %argrw{"wrr"}
	if		$tmp38 87 91 	%argrw{"r"}
# /build/blender/src/blender/intern/cycles/kernel/osl/shaders/node_principled_hair_bsdf.osl:84
#     sigma = sigma_from_reflectance(Color, radial_roughness);
	functioncall	$const16 87 	%line{84} %argrw{"r"}
# /build/blender/src/blender/intern/cycles/kernel/osl/shaders/node_principled_hair_bsdf.osl:18
#   float x = azimuthal_roughness;
	assign		___370_x radial_roughness 	%line{18} %argrw{"wr"}
# /build/blender/src/blender/intern/cycles/kernel/osl/shaders/node_principled_hair_bsdf.osl:19
#   float roughness_fac = (((((0.245 * x) + 5.574) * x - 10.73) * x + 2.532) * x - 0.215) * x +
	mul		$tmp39 $const17 ___370_x 	%line{19} %argrw{"wrr"}
	add		$tmp40 $tmp39 $const18 	%argrw{"wrr"}
	mul		$tmp41 $tmp40 ___370_x 	%argrw{"wrr"}
	sub		$tmp42 $tmp41 $const19 	%argrw{"wrr"}
	mul		$tmp43 $tmp42 ___370_x 	%argrw{"wrr"}
	add		$tmp44 $tmp43 $const20 	%argrw{"wrr"}
	mul		$tmp45 $tmp44 ___370_x 	%argrw{"wrr"}
	sub		$tmp46 $tmp45 $const21 	%argrw{"wrr"}
	mul		$tmp47 $tmp46 ___370_x 	%argrw{"wrr"}
	add		___370_roughness_fac $tmp47 $const22 	%argrw{"wrr"}
# /build/blender/src/blender/intern/cycles/kernel/osl/shaders/node_principled_hair_bsdf.osl:21
#   color sigma = log3(c) / roughness_fac;
	functioncall	$const23 85 	%line{21} %argrw{"r"}
# /build/blender/src/blender/intern/cycles/kernel/osl/shaders/node_principled_hair_bsdf.osl:8
#   return color(log(a[0]), log(a[1]), log(a[2]));
	compref		$tmp50 Color $const24 	%line{8} %argrw{"wrr"}
	log		$tmp49 $tmp50 	%argrw{"wr"}
	compref		$tmp52 Color $const25 	%argrw{"wrr"}
	log		$tmp51 $tmp52 	%argrw{"wr"}
	compref		$tmp54 Color $const1 	%argrw{"wrr"}
	log		$tmp53 $tmp54 	%argrw{"wr"}
	color		$tmp48 $tmp49 $tmp51 $tmp53 	%argrw{"wrrr"}
# /build/blender/src/blender/intern/cycles/kernel/osl/shaders/node_principled_hair_bsdf.osl:21
#   color sigma = log3(c) / roughness_fac;
	div		___370_sigma $tmp48 ___370_roughness_fac 	%line{21} %argrw{"wrr"}
# /build/blender/src/blender/intern/cycles/kernel/osl/shaders/node_principled_hair_bsdf.osl:22
#   return sigma * sigma;
	mul		sigma ___370_sigma ___370_sigma 	%line{22} %argrw{"wrr"}
# /build/blender/src/blender/intern/cycles/kernel/osl/shaders/node_principled_hair_bsdf.osl:88
#     sigma = sigma_from_concentration(0.0, 0.8054375);
	functioncall	$const13 91 	%line{88} %argrw{"r"}
# /build/blender/src/blender/intern/cycles/kernel/osl/shaders/node_principled_hair_bsdf.osl:13
#   return eumelanin * color(0.506, 0.841, 1.653) + pheomelanin * color(0.343, 0.733, 1.924);
	mul		$tmp56 $const6 $const14 	%line{13} %argrw{"wrr"}
	mul		$tmp58 $const27 $const15 	%argrw{"wrr"}
	add		sigma $tmp56 $tmp58 	%argrw{"wrr"}
# /build/blender/src/blender/intern/cycles/kernel/osl/shaders/node_principled_hair_bsdf.osl:91
#   BSDF = principled_hair(Normal, sigma, roughness, radial_roughness, m0_roughness, Offset, IOR);
	closure		BSDF $const28 Normal sigma roughness radial_roughness m0_roughness Offset IOR 	%line{91} %argrw{"wrrrrrrrr"}
	end
