OpenShadingLanguage 1.00 # Compiled by oslc 1.13.12.0 # options: shader phong_shader param point v_position 0 0 0 %read{2147483647,-1} %write{0,0} %initexpr param vector v_normal 0 1 0 %read{3,3} %write{2147483647,-1} param vector v_toCamera 0 0 0 %read{2,2} %write{2147483647,-1} param vector v_toLight 0 0 0 %read{1,1} %write{2147483647,-1} oparam color resultRGB 0 0 0 %read{2147483647,-1} %write{27,27} local vector vL %read{4,14} %write{1,1} local vector vV %read{8,8} %write{2,2} local vector vN %read{4,18} %write{3,3} local vector vR %read{2147483647,-1} %write{7,7} local vector vH %read{18,18} %write{9,9} local color u_ambientColor %read{13,13} %write{10,10} local color u_matColor %read{13,23} %write{11,11} local color u_lightColor %read{17,24} %write{12,12} local color colAmbient %read{25,25} %write{13,13} local float ndotl %read{16,20} %write{15,15} local color colDiff %read{25,25} %write{17,17} local float spec %read{21,21} %write{19,19} local color colSpec %read{26,26} %write{24,24} local color final %read{27,27} %write{26,26} const vector $const1 0 0 0 %read{0,0} %write{2147483647,-1} temp float $tmp1 %read{5,5} %write{4,4} temp float $tmp2 %read{6,6} %write{5,5} const float $const3 2 %read{5,5} %write{2147483647,-1} temp vector $tmp3 %read{7,7} %write{6,6} temp vector $tmp4 %read{9,9} %write{8,8} temp int $tmp5 %read{2147483647,-1} %write{10,10} const string $const4 "env:ambient_color" %read{10,10} %write{2147483647,-1} temp int $tmp6 %read{2147483647,-1} %write{11,11} const string $const5 "self:mat_color" %read{11,11} %write{2147483647,-1} temp int $tmp7 %read{2147483647,-1} %write{12,12} const string $const6 "light0:color" %read{12,12} %write{2147483647,-1} temp float $tmp8 %read{15,15} %write{14,14} const float $const8 0 %read{15,20} %write{2147483647,-1} temp color $tmp9 %read{17,17} %write{16,16} temp float $tmp10 %read{19,19} %write{18,18} temp float $tmp11 %read{22,22} %write{20,20} temp float $tmp12 %read{22,22} %write{21,21} const float $const10 64 %read{21,21} %write{2147483647,-1} temp float $tmp13 %read{23,23} %write{22,22} temp color $tmp14 %read{24,24} %write{23,23} temp color $tmp15 %read{26,26} %write{25,25} const vector $const11 0.454545438 0.454545438 0.454545438 %read{27,27} %write{2147483647,-1} code v_position # test_pixel_shader.osl:4 # point v_position = vector(0,0,0), assign v_position $const1 %filename{"test_pixel_shader.osl"} %line{4} %argrw{"wr"} code ___main___ # test_pixel_shader.osl:11 # vector vL = normalize(v_toLight); normalize vL v_toLight %filename{"test_pixel_shader.osl"} %line{11} %argrw{"wr"} # test_pixel_shader.osl:12 # vector vV = normalize(v_toCamera); normalize vV v_toCamera %line{12} %argrw{"wr"} # test_pixel_shader.osl:13 # vector vN = normalize(v_normal); normalize vN v_normal %line{13} %argrw{"wr"} # test_pixel_shader.osl:14 # vector vR = 2 * dot(vL, vN)*vN - vL; dot $tmp1 vL vN %line{14} %argrw{"wrr"} mul $tmp2 $const3 $tmp1 %argrw{"wrr"} mul $tmp3 $tmp2 vN %argrw{"wrr"} sub vR $tmp3 vL %argrw{"wrr"} # test_pixel_shader.osl:15 # vector vH = normalize(vL + vV); add $tmp4 vL vV %line{15} %argrw{"wrr"} normalize vH $tmp4 %argrw{"wr"} # test_pixel_shader.osl:18 # getattribute("env:ambient_color", u_ambientColor); getattribute $tmp5 $const4 u_ambientColor %line{18} %argrw{"wrw"} # test_pixel_shader.osl:21 # getattribute("self:mat_color", u_matColor); getattribute $tmp6 $const5 u_matColor %line{21} %argrw{"wrw"} # test_pixel_shader.osl:24 # getattribute("light0:color", u_lightColor); getattribute $tmp7 $const6 u_lightColor %line{24} %argrw{"wrw"} # test_pixel_shader.osl:26 # color colAmbient = u_ambientColor*u_matColor; mul colAmbient u_ambientColor u_matColor %line{26} %argrw{"wrr"} # test_pixel_shader.osl:28 # float ndotl = max(dot(vN, vL), 0); dot $tmp8 vN vL %line{28} %argrw{"wrr"} max ndotl $tmp8 $const8 %argrw{"wrr"} # test_pixel_shader.osl:29 # color colDiff = ndotl * u_matColor * u_lightColor; mul $tmp9 ndotl u_matColor %line{29} %argrw{"wrr"} mul colDiff $tmp9 u_lightColor %argrw{"wrr"} # test_pixel_shader.osl:31 # float spec = max(dot(vN, vH), 0); dot $tmp10 vN vH %line{31} %argrw{"wrr"} max spec $tmp10 $const8 %argrw{"wrr"} # test_pixel_shader.osl:32 # color colSpec = step(0, ndotl) * pow(spec, 64) * u_matColor * u_lightColor; step $tmp11 $const8 ndotl %line{32} %argrw{"wrr"} pow $tmp12 spec $const10 %argrw{"wrr"} mul $tmp13 $tmp11 $tmp12 %argrw{"wrr"} mul $tmp14 $tmp13 u_matColor %argrw{"wrr"} mul colSpec $tmp14 u_lightColor %argrw{"wrr"} # test_pixel_shader.osl:34 # color final = colAmbient + colDiff + colSpec; add $tmp15 colAmbient colDiff %line{34} %argrw{"wrr"} add final $tmp15 colSpec %argrw{"wrr"} # test_pixel_shader.osl:37 # resultRGB = pow(final, vector(1.0/2.2)); pow resultRGB final $const11 %line{37} %argrw{"wrr"} end