OpenShadingLanguage 1.00 # Compiled by oslc 1.5.11 shader node_mandelbulb param int iterations 12 %read{16,54} %write{2147483647,-1} param float power 2 %read{13,13} %write{2147483647,-1} param float symmetry 3 %read{26,41} %write{2147483647,-1} param float scale 1 %read{1,1} %write{2147483647,-1} param point position 0 0 0 %read{1,1} %write{0,0} oparam float intensity 0 %read{2147483647,-1} %write{55,55} global point P %read{0,0} %write{2147483647,-1} local int ___320_iter %read{12,53} %write{3,52} local float ___320_r %read{12,52} %write{12,52} local float ___320_theta %read{12,52} %write{12,52} local float ___320_phi %read{12,52} %write{12,52} local float ___320_tmp_pow_r_n %read{12,52} %write{12,52} local float ___320_tmp_sin_theta_n %read{12,52} %write{12,52} local float ___320_x %read{7,52} %write{4,52} local float ___320_y %read{8,52} %write{5,52} local float ___320_z %read{10,52} %write{6,52} local float ___320_tmp_xyz %read{12,52} %write{11,52} temp float $tmp1 %read{55,55} %write{53,53} temp point $tmp2 %read{4,52} %write{1,52} const string $const1 "mandelbulb_intensity" %read{2,2} %write{2147483647,-1} const int $const2 0 %read{3,33} %write{2147483647,-1} const int $const3 1 %read{5,52} %write{2147483647,-1} const int $const4 2 %read{6,44} %write{2147483647,-1} temp float $tmp3 %read{9,9} %write{7,7} temp float $tmp4 %read{9,9} %write{8,8} temp float $tmp5 %read{11,11} %write{9,9} temp float $tmp6 %read{11,11} %write{10,10} temp int $tmp7 %read{14,14} %write{13,13} temp int $tmp8 %read{12,52} %write{12,52} temp int $tmp9 %read{17,17} %write{16,16} temp int $tmp10 %read{18,18} %write{17,17} temp float $tmp11 %read{24,24} %write{23,23} temp float $tmp12 %read{22,22} %write{20,20} temp float $tmp13 %read{22,22} %write{21,21} temp float $tmp14 %read{23,23} %write{22,22} temp float $tmp15 %read{28,28} %write{27,27} temp float $tmp16 %read{32,32} %write{29,29} temp float $tmp17 %read{32,32} %write{31,31} temp float $tmp18 %read{31,31} %write{30,30} temp float $tmp19 %read{34,34} %write{32,32} temp float $tmp20 %read{34,34} %write{33,33} temp float $tmp21 %read{38,38} %write{35,35} temp float $tmp22 %read{38,38} %write{37,37} temp float $tmp23 %read{37,37} %write{36,36} temp float $tmp24 %read{40,40} %write{38,38} temp float $tmp25 %read{40,40} %write{39,39} temp float $tmp26 %read{43,43} %write{42,42} temp float $tmp27 %read{42,42} %write{41,41} temp float $tmp28 %read{45,45} %write{43,43} temp float $tmp29 %read{45,45} %write{44,44} temp float $tmp30 %read{48,48} %write{46,46} temp float $tmp31 %read{48,48} %write{47,47} temp float $tmp32 %read{50,50} %write{48,48} temp float $tmp33 %read{50,50} %write{49,49} temp int $tmp34 %read{2147483647,-1} %write{51,51} temp float $tmp35 %read{55,55} %write{54,54} code position # mandelbulb.osl:76 # point position = P, assign position P %filename{"mandelbulb.osl"} %line{76} %argrw{"wr"} code ___main___ # mandelbulb.osl:81 # intensity = mandelbulb_intensity( position*scale, iterations, power, symmetry ) / iterations; mul $tmp2 position scale %filename{"mandelbulb.osl"} %line{81} %argrw{"wrr"} functioncall $const1 54 %argrw{"r"} # mandelbulb.osl:32 # int iter = 0; assign ___320_iter $const2 %line{32} %argrw{"wr"} # mandelbulb.osl:37 # float x = p[0]; compref ___320_x $tmp2 $const2 %line{37} %argrw{"wrr"} # mandelbulb.osl:38 # float y = p[1]; compref ___320_y $tmp2 $const3 %line{38} %argrw{"wrr"} # mandelbulb.osl:39 # float z = p[2]; compref ___320_z $tmp2 $const4 %line{39} %argrw{"wrr"} # mandelbulb.osl:41 # float tmp_xyz = x*x + y*y + z*z; mul $tmp3 ___320_x ___320_x %line{41} %argrw{"wrr"} mul $tmp4 ___320_y ___320_y %argrw{"wrr"} add $tmp5 $tmp3 $tmp4 %argrw{"wrr"} mul $tmp6 ___320_z ___320_z %argrw{"wrr"} add ___320_tmp_xyz $tmp5 $tmp6 %argrw{"wrr"} # mandelbulb.osl:43 # while ( tmp_xyz < max_pow && iter < max_iter) while $tmp8 13 19 53 53 %line{43} %argrw{"r"} lt $tmp7 ___320_tmp_xyz power %argrw{"wrr"} neq $tmp8 $tmp7 $const2 %argrw{"wrr"} if $tmp8 19 19 %argrw{"r"} lt $tmp9 ___320_iter iterations %argrw{"wrr"} neq $tmp10 $tmp9 $const2 %argrw{"wrr"} assign $tmp8 $tmp10 %argrw{"wr"} # mandelbulb.osl:46 # r = sqrt(tmp_xyz); sqrt ___320_r ___320_tmp_xyz %line{46} %argrw{"wr"} # mandelbulb.osl:47 # theta = atan2(sqrt(x*x + y*y) , z); mul $tmp12 ___320_x ___320_x %line{47} %argrw{"wrr"} mul $tmp13 ___320_y ___320_y %argrw{"wrr"} add $tmp14 $tmp12 $tmp13 %argrw{"wrr"} sqrt $tmp11 $tmp14 %argrw{"wr"} atan2 ___320_theta $tmp11 ___320_z %argrw{"wrr"} # mandelbulb.osl:48 # phi = atan2(y,x); atan2 ___320_phi ___320_y ___320_x %line{48} %argrw{"wrr"} # mandelbulb.osl:50 # tmp_pow_r_n = pow(r,n); pow ___320_tmp_pow_r_n ___320_r symmetry %line{50} %argrw{"wrr"} # mandelbulb.osl:51 # tmp_sin_theta_n = sin(theta*n); mul $tmp15 ___320_theta symmetry %line{51} %argrw{"wrr"} sin ___320_tmp_sin_theta_n $tmp15 %argrw{"wr"} # mandelbulb.osl:53 # x = tmp_pow_r_n * tmp_sin_theta_n * cos(phi*n) + p[0]; mul $tmp16 ___320_tmp_pow_r_n ___320_tmp_sin_theta_n %line{53} %argrw{"wrr"} mul $tmp18 ___320_phi symmetry %argrw{"wrr"} cos $tmp17 $tmp18 %argrw{"wr"} mul $tmp19 $tmp16 $tmp17 %argrw{"wrr"} compref $tmp20 $tmp2 $const2 %argrw{"wrr"} add ___320_x $tmp19 $tmp20 %argrw{"wrr"} # mandelbulb.osl:54 # y = tmp_pow_r_n * tmp_sin_theta_n * sin(phi*n) + p[1]; mul $tmp21 ___320_tmp_pow_r_n ___320_tmp_sin_theta_n %line{54} %argrw{"wrr"} mul $tmp23 ___320_phi symmetry %argrw{"wrr"} sin $tmp22 $tmp23 %argrw{"wr"} mul $tmp24 $tmp21 $tmp22 %argrw{"wrr"} compref $tmp25 $tmp2 $const3 %argrw{"wrr"} add ___320_y $tmp24 $tmp25 %argrw{"wrr"} # mandelbulb.osl:55 # z = tmp_pow_r_n * cos(theta*n) + p[2]; mul $tmp27 ___320_theta symmetry %line{55} %argrw{"wrr"} cos $tmp26 $tmp27 %argrw{"wr"} mul $tmp28 ___320_tmp_pow_r_n $tmp26 %argrw{"wrr"} compref $tmp29 $tmp2 $const4 %argrw{"wrr"} add ___320_z $tmp28 $tmp29 %argrw{"wrr"} # mandelbulb.osl:57 # tmp_xyz = x*x + y*y + z*z; mul $tmp30 ___320_x ___320_x %line{57} %argrw{"wrr"} mul $tmp31 ___320_y ___320_y %argrw{"wrr"} add $tmp32 $tmp30 $tmp31 %argrw{"wrr"} mul $tmp33 ___320_z ___320_z %argrw{"wrr"} add ___320_tmp_xyz $tmp32 $tmp33 %argrw{"wrr"} # mandelbulb.osl:59 # iter++; assign $tmp34 ___320_iter %line{59} %argrw{"wr"} add ___320_iter ___320_iter $const3 %argrw{"wrr"} # mandelbulb.osl:62 # return(iter); assign $tmp1 ___320_iter %line{62} %argrw{"wr"} # mandelbulb.osl:81 # intensity = mandelbulb_intensity( position*scale, iterations, power, symmetry ) / iterations; assign $tmp35 iterations %line{81} %argrw{"wr"} div intensity $tmp1 $tmp35 %argrw{"wrr"} end