diff --git a/README.md b/README.md index 2d43207..f1b6022 100644 --- a/README.md +++ b/README.md @@ -16,6 +16,7 @@ Since I have no intention making this a extensive project (like AdaPT, taking ca |Depth Renderer|Unidirection PT| |:--:|:--:| |![](assets/depth-render.png)|![](assets/pt-render.png)| +|![](assets/render-balls.png)|![](assets/render-bunny.png)| - [ ] CUDA texture bindings (with normal or UV maps) - [ ] GPU side BVH implementation. This will be the most difficult part, since "it is always easy to write your program with parallelism, but difficult to make it fast". diff --git a/app/pt_renderer.cu b/app/pt_renderer.cu index 00c11bb..e79e8f1 100644 --- a/app/pt_renderer.cu +++ b/app/pt_renderer.cu @@ -30,7 +30,7 @@ int main(int argc, char** argv) { PathTracer pt(scene.objects, scene.shapes, vert_data, norm_data, uvs_data, 1, scene.config.width, scene.config.height); printf("Prepare to render the scene... [%d] bounces, [%d] SPP\n", scene.config.max_depth, scene.config.spp); - auto bytes_buffer = pt.render(scene.config.spp, scene.config.max_depth); + auto bytes_buffer = pt.render(scene.config.spp, scene.config.max_depth, scene.config.gamma_correction); std::string file_name = "render.png"; diff --git a/assets/render-balls.png b/assets/render-balls.png new file mode 100644 index 0000000..db16193 Binary files /dev/null and b/assets/render-balls.png differ diff --git a/assets/render-bunny.png b/assets/render-bunny.png new file mode 100644 index 0000000..f70a8bb Binary files /dev/null and b/assets/render-bunny.png differ diff --git a/scene/meshes/cornell/cbox_back.obj b/scene/meshes/cbox/back.obj similarity index 50% rename from scene/meshes/cornell/cbox_back.obj rename to scene/meshes/cbox/back.obj index e524570..4853081 100644 --- a/scene/meshes/cornell/cbox_back.obj +++ b/scene/meshes/cbox/back.obj @@ -1,10 +1,11 @@ -# Blender v2.82 (sub 7) OBJ File: '' +# Blender 4.1.1 # www.blender.org o cbox_back.001 -v 5.496000 -0.000000 5.592000 -v 0.000000 -0.000000 5.592000 +v 5.496000 0.000000 5.592000 +v 0.000000 0.000000 5.592000 v 0.000000 5.487999 5.592000 v 5.560000 5.487999 5.592000 -vn 0.0000 0.0000 -1.0000 +vn -0.0000 -0.0000 -1.0000 +s 0 f 1//1 3//1 4//1 f 1//1 2//1 3//1 diff --git a/scene/meshes/cbox/bunny.obj b/scene/meshes/cbox/bunny.obj new file mode 100644 index 0000000..2ce91b4 --- /dev/null +++ b/scene/meshes/cbox/bunny.obj @@ -0,0 +1,1253 @@ +# Blender 4.1.1 +# www.blender.org +o bunny +v 2.538230 2.610681 1.184223 +v 2.538378 2.354332 1.301462 +v 2.028490 2.508458 1.472836 +v 1.968266 2.436760 1.303576 +v 2.204623 1.765385 1.097066 +v 1.688724 2.555229 1.537527 +v 2.188913 2.749328 1.173992 +v 2.492951 2.016781 1.262120 +v 2.525619 2.089789 1.244311 +v 2.521946 2.183905 1.160053 +v 1.291169 1.998555 1.704785 +v 1.255161 1.963204 1.752330 +v 2.241028 2.910297 1.530657 +v 2.477499 2.859164 1.507063 +v 2.443812 2.841377 1.620492 +v 2.543022 2.922862 1.818414 +v 2.304125 1.650693 1.603345 +v 2.111114 2.244996 1.803051 +v 2.266480 2.187829 1.711057 +v 1.791301 2.536881 1.436561 +v 1.901740 2.535614 1.630220 +v 2.440907 1.651122 1.465481 +v 2.503995 2.425309 1.082382 +v 2.420312 2.097272 1.096407 +v 2.153075 1.824659 1.633428 +v 2.445153 2.417987 1.493262 +v 2.501250 2.757261 1.162654 +v 2.366990 2.757319 1.092782 +v 1.558548 2.252882 1.304071 +v 2.570706 2.576123 1.282102 +v 1.701003 2.533478 1.716175 +v 1.790566 2.210644 1.944827 +v 2.418868 2.783756 1.385929 +v 2.486755 2.766817 1.392521 +v 2.549464 2.265873 1.226398 +v 2.676241 2.957070 1.754578 +v 2.211811 2.738505 1.369650 +v 2.257981 2.781299 1.357985 +v 2.569113 2.439276 1.155180 +v 2.325182 2.538069 0.912439 +v 2.283205 2.634986 0.961313 +v 2.661906 3.015673 1.821167 +v 2.615489 3.022969 1.912985 +v 1.907180 1.718662 1.117103 +v 2.313769 1.961033 1.592476 +v 2.386438 2.083719 1.637936 +v 2.299556 2.052550 1.654189 +v 2.469278 2.647203 1.462680 +v 2.382247 2.743753 1.455780 +v 2.200762 1.769289 1.327756 +v 2.202479 1.847765 1.329792 +v 2.236914 2.396880 0.956035 +v 2.136402 2.131792 1.936382 +v 2.017860 2.095884 1.976423 +v 2.141721 2.735126 1.533444 +v 2.566364 2.139045 1.343989 +v 2.396964 2.660218 1.489903 +v 2.196486 2.450988 0.971333 +v 2.584114 2.955471 1.960572 +v 2.104604 2.952822 1.760856 +v 2.204649 2.799962 1.619436 +v 1.449214 2.252737 1.812896 +v 1.448414 1.839967 1.916173 +v 1.364063 1.783071 1.851882 +v 2.486935 2.672727 1.537934 +v 1.690189 2.360440 1.293801 +v 2.246997 2.659099 1.453693 +v 2.254106 2.157139 1.037664 +v 2.329815 2.324293 1.074389 +v 1.655904 1.836174 1.195243 +v 1.473294 1.671066 1.724453 +v 1.502671 2.156117 1.896625 +v 2.291182 1.658152 1.260245 +v 2.231061 2.369584 1.104502 +v 1.541343 2.144913 1.237015 +v 1.582589 1.886387 1.223547 +v 2.477448 2.606447 1.084746 +v 2.458505 2.462759 0.961749 +v 2.502242 2.760119 1.722240 +v 1.743738 1.768144 1.224346 +v 2.212172 2.652131 1.383630 +v 1.875471 1.694765 1.258257 +v 1.507214 1.846129 1.317295 +v 1.574261 1.745000 1.331378 +v 1.298188 1.908013 1.851863 +v 2.589413 2.847776 1.925017 +v 2.167350 2.189456 1.059076 +v 1.499023 2.279431 1.363792 +v 2.224790 2.747017 1.128473 +v 2.171892 2.045400 1.081266 +v 2.305976 2.017917 1.092873 +v 1.429993 1.992455 1.819502 +v 1.496706 2.055361 1.281305 +v 2.192338 2.783614 1.421664 +v 2.296657 1.865033 1.403783 +v 1.345532 1.793729 1.563247 +v 1.995355 2.900001 1.833934 +v 1.438372 2.371559 1.604571 +v 1.400639 1.827854 1.543283 +v 2.319711 2.703537 1.463198 +v 1.671816 1.661232 1.771476 +v 2.335807 1.895524 1.494780 +v 2.641324 2.956762 1.846280 +v 2.608629 2.777689 1.860618 +v 2.139559 2.416793 1.190594 +v 2.572543 2.727113 1.626902 +v 1.714220 2.278407 1.272496 +v 2.418915 1.707871 1.476086 +v 2.065606 2.005289 1.146152 +v 2.273280 1.744210 1.591728 +v 2.135241 1.720287 1.062454 +v 2.073221 2.177269 1.099094 +v 1.296632 1.925878 1.622106 +v 1.367218 1.967747 1.629564 +v 2.277756 1.743415 1.704676 +v 2.066919 2.327248 1.153935 +v 1.643325 2.012968 1.167259 +v 1.522420 2.432018 1.467013 +v 2.443327 1.666202 1.345595 +v 1.528359 1.666406 1.556289 +v 2.114479 1.802323 1.175229 +v 2.009871 1.781074 1.193114 +v 2.018373 2.281803 1.171086 +v 2.547056 2.723687 1.187174 +v 2.111092 2.492391 1.295717 +v 2.033087 3.001817 1.889523 +v 1.668284 2.164020 1.965139 +v 1.610751 2.082317 1.957254 +v 2.027182 2.117467 1.150906 +v 1.973192 2.169044 1.161181 +v 2.138911 2.918926 1.518762 +v 1.942893 2.118633 1.190730 +v 1.779970 2.457527 1.325589 +v 1.896180 2.302112 1.211596 +v 1.934854 1.842103 1.262546 +v 2.084347 3.014269 1.632412 +v 1.682650 2.223439 1.177586 +v 1.874072 2.219552 1.192412 +v 1.338406 1.988928 1.844805 +v 1.608090 2.484430 1.440697 +v 1.840488 1.762446 1.132022 +v 1.925972 2.381615 1.838397 +v 1.822184 1.801663 1.202864 +v 2.053734 3.077785 1.774574 +v 2.177210 1.800852 1.241827 +v 2.229611 2.107935 1.718152 +v 1.274634 1.860510 1.635858 +v 2.256006 1.652469 1.800184 +v 2.144848 1.777460 1.821801 +v 1.806713 2.092753 1.106285 +v 1.781185 1.941012 1.158184 +v 2.526024 2.618204 1.387289 +v 1.392734 2.192034 1.459004 +v 2.014910 2.820204 1.631804 +v 2.005178 1.665154 1.158225 +v 1.678559 1.793804 1.936266 +v 1.759264 1.747931 1.936126 +v 1.566441 1.943655 1.926438 +v 1.559759 1.833118 1.875668 +v 1.474293 1.938554 1.357486 +v 1.850911 1.666659 1.112483 +v 1.588184 2.326503 1.888822 +v 2.302718 1.788673 1.391325 +v 1.283206 1.792821 1.716532 +v 2.222951 2.603125 1.107632 +v 2.178382 2.480916 1.077406 +v 1.392078 1.902586 1.488627 +v 1.370896 2.201616 1.624253 +v 2.171562 2.365221 1.712275 +v 1.406292 2.044037 1.439357 +v 2.104423 2.310461 1.785168 +v 2.014155 2.953132 1.800305 +v 1.451682 1.783651 1.483636 +v 1.527374 1.665277 1.374704 +v 1.984089 2.851899 1.741672 +v 2.181615 2.635024 1.211812 +v 2.190471 1.662433 1.053561 +v 1.530248 1.700055 1.825428 +v 2.171884 1.800335 1.761879 +v 2.534427 2.198876 1.499785 +v 1.800809 1.663832 1.910887 +v 2.023479 1.661921 1.416111 +v 2.001149 1.653962 1.243929 +v 2.474047 2.350593 1.163513 +v 2.439738 2.670684 1.027086 +v 2.446957 2.383789 0.997670 +v 1.983770 1.676596 1.448803 +v 1.875975 2.261423 1.882022 +v 2.578180 2.463790 1.353411 +v 1.979768 1.651408 1.855023 +v 2.406975 1.742347 1.356816 +v 2.300038 1.676591 1.176595 +v 2.180831 2.185642 1.875362 +v 2.325945 2.385103 0.961806 +v 1.768920 1.865540 1.981532 +v 2.308866 1.653450 1.740994 +v 1.816397 1.653829 1.835034 +v 1.825652 1.692580 1.788359 +v 1.932807 2.206832 1.965821 +v 1.380108 2.012366 1.729361 +v 2.330853 2.790576 1.215249 +v 2.334543 2.776969 1.402105 +v 2.144032 2.536538 1.395257 +v 2.220620 2.060298 1.875192 +v 1.538185 2.422283 1.748306 +v 2.449380 2.254726 1.104709 +v 2.603264 2.848676 1.606193 +v 1.532453 2.475583 1.572740 +v 1.745212 2.295425 1.915917 +v 2.329391 1.785514 1.499438 +v 2.267071 2.533347 1.509487 +v 2.117106 1.691813 1.552082 +v 2.394117 2.218426 1.637053 +v 2.387068 2.418282 0.934526 +v 2.373358 2.350785 1.614580 +v 2.177977 1.900832 1.842873 +v 1.745076 2.445109 1.839349 +v 2.603356 2.738731 1.754002 +v 1.630869 1.661267 1.678492 +v 1.799489 1.650678 1.645497 +v 1.667982 1.697524 1.412716 +v 2.501519 2.724807 1.421179 +v 2.527250 2.037560 1.407401 +v 2.473018 2.033528 1.540014 +v 2.565667 2.217700 1.399432 +v 2.136623 2.466408 1.613142 +v 1.926713 2.494271 1.719070 +v 1.700998 1.664132 1.699099 +v 1.786629 1.697716 1.301712 +v 2.072511 1.660261 1.324047 +v 2.120446 1.662774 1.420828 +v 2.194328 1.646889 1.527722 +v 2.244235 2.487428 1.595868 +v 2.091326 1.646640 1.284861 +v 1.903870 1.805010 1.947517 +v 1.889942 2.005185 1.986753 +v 1.901035 1.735597 1.896683 +v 1.920315 1.913810 1.967454 +v 2.111040 1.932903 1.929341 +v 2.024621 1.788805 1.908303 +v 1.977759 1.687672 1.280699 +v 1.758757 1.650764 1.646970 +v 2.141819 1.919713 1.190629 +v 1.645939 1.650053 1.543867 +v 1.611953 1.670945 1.415978 +v 1.811874 1.654768 1.241171 +v 1.759768 1.634778 1.614303 +v 1.598754 1.670288 1.641305 +v 1.607803 1.656161 1.555306 +v 1.824572 1.686889 1.523409 +v 1.895973 1.653972 1.205033 +v 1.624527 1.685765 1.425750 +v 2.375447 1.911202 1.261694 +v 1.702493 1.654811 1.551753 +v 2.238768 1.644358 1.335200 +v 2.208314 1.654183 1.414379 +v 2.226185 1.651895 1.709793 +v 2.190925 1.663707 1.585717 +v 2.153598 1.692598 1.709997 +vn 0.1831 0.9827 -0.0293 +vn -0.7401 0.6624 -0.1159 +vn 0.0400 0.9922 0.1181 +vn 0.3276 -0.4927 0.8062 +vn 0.3645 0.0854 0.9273 +vn -0.5719 0.7428 -0.3481 +vn -0.3956 -0.0361 -0.9177 +vn -0.5152 0.1974 -0.8340 +vn 0.9675 -0.2052 -0.1477 +vn -0.1069 -0.8949 0.4332 +vn -0.4746 -0.2501 0.8439 +vn -0.8215 0.0385 0.5689 +vn 0.9783 -0.0814 0.1908 +vn -0.1600 0.2804 -0.9465 +vn -0.5788 -0.4692 -0.6669 +vn 0.0053 -0.3669 -0.9302 +vn -0.5569 0.5004 -0.6629 +vn -0.6328 -0.0819 0.7700 +vn -0.8575 0.5112 0.0570 +vn 0.6327 -0.5384 0.5567 +vn -0.5771 -0.4751 -0.6643 +vn -0.1283 0.2849 -0.9499 +vn -0.8526 0.1415 0.5031 +vn -0.2906 -0.1546 -0.9443 +vn -0.4434 0.1264 -0.8874 +vn -0.2358 -0.6052 -0.7604 +vn -0.3698 -0.1528 -0.9164 +vn -0.6158 0.2778 -0.7373 +vn -0.4043 0.3555 -0.8427 +vn -0.3685 0.5923 -0.7165 +vn -0.3465 0.3093 -0.8856 +vn -0.2456 0.7710 -0.5875 +vn -0.4475 -0.2175 -0.8674 +vn -0.4495 0.2193 -0.8659 +vn -0.3175 -0.6888 -0.6517 +vn 0.1176 0.9912 -0.0606 +vn -0.4895 0.6397 -0.5926 +vn -0.2565 0.7585 -0.5990 +vn -0.6222 -0.1809 -0.7616 +vn -0.5355 0.2701 -0.8002 +vn -0.2173 -0.0331 -0.9756 +vn -0.6720 0.2379 -0.7013 +vn -0.7680 0.0373 -0.6393 +vn -0.3202 0.5640 -0.7612 +vn -0.0762 0.1175 -0.9901 +vn -0.4927 -0.2003 -0.8469 +vn -0.2972 0.6665 -0.6837 +vn -0.4109 -0.0879 -0.9074 +vn -0.2794 0.1945 -0.9403 +vn -0.6100 0.3917 -0.6888 +vn -0.8855 0.3822 0.2641 +vn -0.7248 -0.0336 -0.6881 +vn -0.6588 0.7430 0.1182 +vn -0.4100 -0.2651 -0.8727 +vn 0.9400 0.1418 -0.3104 +vn -0.1644 0.2648 -0.9502 +vn -0.7347 -0.1504 -0.6615 +vn 0.1725 0.8835 -0.4356 +vn -0.1552 0.6125 -0.7751 +vn -0.3446 0.6937 -0.6325 +vn -0.0321 0.5754 -0.8172 +vn -0.6220 -0.0490 -0.7815 +vn -0.2585 0.8696 -0.4206 +vn -0.4521 0.7257 -0.5186 +vn -0.2416 0.8008 -0.5480 +vn 0.2255 0.9553 -0.1913 +vn 0.6514 0.4774 0.5897 +vn -0.3843 0.5884 -0.7114 +vn -0.6253 -0.0726 -0.7770 +vn 0.0761 0.5323 -0.8431 +vn 0.9767 0.2083 0.0510 +vn -0.1948 0.4808 -0.8549 +vn -0.2101 -0.2846 -0.9353 +vn -0.3310 0.1452 -0.9324 +vn 0.0214 0.8122 -0.5830 +vn -0.0523 -0.4491 -0.8919 +vn -0.3976 0.1189 -0.9098 +vn -0.2079 0.4727 -0.8564 +vn -0.7314 0.4110 0.5441 +vn -0.4544 -0.1707 -0.8743 +vn 0.1357 0.8001 -0.5844 +vn -0.7784 -0.0043 -0.6277 +vn -0.8756 0.3978 -0.2740 +vn -0.9276 0.0651 -0.3678 +vn -0.8117 -0.5679 -0.1364 +vn -0.8526 0.3632 -0.3756 +vn -0.9005 -0.4337 -0.0313 +vn -0.9506 0.3087 0.0333 +vn -0.8039 -0.4949 -0.3298 +vn -0.8846 0.3870 -0.2602 +vn -0.7623 0.1009 -0.6393 +vn -0.7790 0.0996 -0.6191 +vn -0.4693 -0.3216 -0.8224 +vn -0.7218 -0.4661 -0.5116 +vn -0.9339 -0.0572 -0.3530 +vn -0.8024 0.4018 -0.4414 +vn -0.8675 -0.0135 -0.4972 +vn -0.9139 0.2776 -0.2963 +vn -0.9077 0.3160 -0.2759 +vn -0.8331 0.4604 -0.3066 +vn -0.8515 -0.1619 -0.4987 +vn -0.9535 0.0536 -0.2967 +vn -0.8408 -0.1008 -0.5318 +vn -0.7637 0.0087 -0.6455 +vn -0.1802 -0.6073 0.7738 +vn -0.7488 0.2358 -0.6195 +vn -0.0747 -0.7692 0.6346 +vn -0.7723 0.4329 -0.4648 +vn -0.9255 0.3509 -0.1426 +vn -0.6034 0.4767 -0.6393 +vn -0.5118 -0.1580 -0.8445 +vn 0.2757 -0.2151 -0.9369 +vn -0.9838 0.0114 -0.1788 +vn -0.4931 -0.8629 0.1106 +vn -0.1883 0.9283 -0.3206 +vn -0.1995 -0.2345 -0.9514 +vn -0.0945 0.1891 -0.9774 +vn -0.6343 -0.4923 0.5961 +vn -0.5158 0.4905 -0.7023 +vn -0.6659 0.5120 -0.5426 +vn -0.0025 -1.0000 0.0072 +vn -0.9873 -0.1569 -0.0267 +vn -0.9281 -0.0358 -0.3706 +vn 0.5765 0.3032 0.7588 +vn -0.9914 -0.0111 -0.1304 +vn -0.8590 0.1733 -0.4818 +vn -0.9301 -0.1176 -0.3479 +vn -0.0275 -0.9965 0.0789 +vn -0.8181 -0.3923 -0.4205 +vn -0.3463 -0.8316 0.4341 +vn -0.6784 0.0745 -0.7309 +vn -0.9184 0.0554 -0.3918 +vn -0.7182 -0.5377 -0.4417 +vn -0.6863 0.0729 -0.7237 +vn 0.0445 -0.8881 0.4576 +vn -0.9798 -0.1783 -0.0904 +vn -0.4072 -0.8666 0.2886 +vn -0.1320 -0.1717 -0.9763 +vn -0.9062 0.2304 -0.3546 +vn -0.7987 -0.2136 -0.5626 +vn -0.8219 -0.3946 -0.4109 +vn -0.9089 -0.4169 -0.0094 +vn -0.7160 -0.4611 -0.5242 +vn -0.5717 -0.6346 0.5201 +vn -0.8925 -0.0880 0.4423 +vn -0.0859 -0.9952 -0.0461 +vn 0.5523 0.8335 -0.0160 +vn -0.3737 -0.3684 0.8512 +vn -0.9400 0.3410 0.0134 +vn 0.9399 -0.3414 -0.0008 +vn -0.4525 0.0072 0.8918 +vn -0.0453 -0.9428 0.3304 +vn -0.3813 0.2323 0.8948 +vn 0.9981 0.0347 -0.0499 +vn -0.1588 0.8886 0.4304 +vn -0.5047 -0.0304 0.8627 +vn 0.8320 -0.0094 -0.5546 +vn -0.6401 0.2451 -0.7282 +vn -0.9331 -0.0176 0.3592 +vn 0.9690 0.1481 -0.1979 +vn 0.9368 -0.2123 -0.2780 +vn 0.1836 0.8186 -0.5441 +vn -0.4578 -0.8065 0.3742 +vn 0.7169 -0.4493 -0.5331 +vn 0.5623 0.2709 0.7813 +vn 0.4537 -0.3656 0.8127 +vn -0.8391 -0.5439 0.0079 +vn -0.4615 -0.6601 0.5927 +vn -0.9180 -0.0043 0.3965 +vn 0.8531 -0.0531 -0.5190 +vn 0.6576 0.4632 -0.5942 +vn -0.9168 -0.0676 -0.3937 +vn -0.0897 -0.9870 -0.1331 +vn 0.6993 0.7135 -0.0424 +vn -0.9407 -0.1472 0.3057 +vn -0.9926 0.0183 0.1200 +vn -0.8837 -0.0533 0.4649 +vn -0.4103 -0.8104 0.4183 +vn -0.5806 0.3255 0.7463 +vn -0.7928 -0.4180 0.4435 +vn -0.9872 0.1031 0.1212 +vn -0.9343 -0.2137 0.2854 +vn -0.9847 0.0238 0.1727 +vn -0.5287 -0.8087 0.2576 +vn -0.9270 0.1466 0.3452 +vn -0.7640 0.6445 -0.0314 +vn -0.8588 0.4943 0.1349 +vn -0.6094 0.4265 0.6684 +vn -0.5107 0.8286 0.2293 +vn -0.1871 0.9737 0.1301 +vn -0.0301 0.9139 -0.4047 +vn 0.6416 -0.7141 -0.2799 +vn 0.0191 0.9785 0.2056 +vn 0.8123 0.4332 -0.3905 +vn 0.1364 0.7902 -0.5975 +vn -0.2138 0.9525 -0.2169 +vn 0.1288 0.9894 -0.0670 +vn 0.3516 0.7390 -0.5747 +vn -0.6146 0.7882 -0.0319 +vn -0.1433 0.9436 -0.2985 +vn 0.9328 0.3578 0.0439 +vn 0.2493 0.9642 -0.0900 +vn 0.8248 0.2357 -0.5140 +vn 0.0147 0.9973 0.0723 +vn 0.2484 0.7638 -0.5957 +vn -0.3905 0.8825 -0.2622 +vn 0.7239 0.1817 -0.6656 +vn -0.2053 0.7783 -0.5934 +vn -0.7702 0.5359 0.3458 +vn 0.5514 0.8278 0.1033 +vn 0.1188 0.9665 -0.2274 +vn -0.7564 0.6270 -0.1866 +vn -0.0659 0.9951 0.0738 +vn 0.0281 0.8610 0.5078 +vn -0.6850 0.6906 0.2320 +vn -0.6059 0.5404 0.5839 +vn -0.3633 0.8973 -0.2508 +vn -0.1273 0.9781 0.1644 +vn -0.8655 0.4898 0.1052 +vn 0.7488 0.6261 0.2173 +vn -0.2596 0.9632 -0.0699 +vn -0.5075 0.8198 0.2654 +vn -0.5614 0.7825 -0.2692 +vn -0.3615 0.7055 0.6095 +vn -0.2303 0.8734 -0.4292 +vn 0.8516 -0.3151 -0.4189 +vn -0.4818 0.8484 -0.2191 +vn 0.3788 0.8726 -0.3083 +vn 0.7054 0.7086 0.0161 +vn -0.4249 0.8947 0.1381 +vn -0.5795 0.8137 -0.0445 +vn 0.2150 0.5921 -0.7766 +vn 0.8638 0.1107 0.4915 +vn -0.1503 -0.1650 -0.9748 +vn 0.5013 -0.0032 -0.8653 +vn 0.3457 0.7440 -0.5719 +vn 0.4536 0.3232 -0.8305 +vn 0.5407 -0.3522 -0.7639 +vn 0.4361 -0.2381 -0.8678 +vn 0.2236 0.3531 -0.9084 +vn -0.3376 0.2979 -0.8929 +vn 0.1077 -0.8301 0.5471 +vn 0.9319 0.1319 -0.3380 +vn 0.1500 0.6743 -0.7231 +vn -0.3354 0.7045 0.6254 +vn -0.2491 -0.2986 -0.9213 +vn 0.4997 -0.1277 -0.8568 +vn 0.2266 -0.2849 -0.9314 +vn 0.3297 -0.0111 -0.9440 +vn 0.2293 0.5156 -0.8256 +vn -0.9503 0.3080 -0.0446 +vn 0.2881 0.0792 -0.9543 +vn -0.0502 0.8682 -0.4936 +vn 0.7248 -0.0790 -0.6844 +vn 0.4473 0.3357 -0.8290 +vn 0.5668 -0.0613 -0.8216 +vn 0.1201 0.8064 -0.5790 +vn 0.6170 0.0069 -0.7869 +vn 0.3170 0.7275 -0.6085 +vn 0.4666 -0.1377 0.8737 +vn 0.4822 0.2345 -0.8441 +vn 0.3530 0.7658 -0.5375 +vn 0.4960 0.1780 -0.8499 +vn 0.0572 0.8556 -0.5145 +vn 0.3513 0.0088 -0.9362 +vn 0.4762 0.3024 -0.8257 +vn 0.3727 0.6736 0.6382 +vn -0.0629 0.8162 0.5744 +vn 0.8829 -0.1143 0.4554 +vn 0.9082 -0.2947 0.2973 +vn 0.9207 -0.1725 0.3500 +vn 0.9838 -0.1783 0.0165 +vn 0.9068 0.1987 -0.3717 +vn 0.6255 -0.7438 0.2357 +vn 0.2503 0.7032 0.6655 +vn 0.9431 0.2992 0.1448 +vn 0.4662 -0.8320 0.3007 +vn 0.9669 -0.2542 -0.0217 +vn 0.9630 -0.0141 -0.2691 +vn 0.9558 -0.0434 -0.2907 +vn 0.4322 0.3881 -0.8140 +vn 0.1589 -0.9358 -0.3146 +vn 0.9895 0.0493 -0.1356 +vn 0.6791 -0.6982 -0.2266 +vn 0.6005 0.7699 -0.2159 +vn 0.9491 0.3125 -0.0390 +vn 0.9668 -0.2545 -0.0224 +vn 0.7025 0.1419 0.6974 +vn 0.8486 0.1306 -0.5127 +vn 0.9504 0.3091 -0.0355 +vn 0.7803 0.6252 0.0158 +vn -0.0634 0.4545 0.8885 +vn 0.7292 0.1157 -0.6745 +vn 0.8997 -0.2464 0.3604 +vn 0.8351 -0.5501 0.0084 +vn 0.9475 0.2114 -0.2398 +vn 0.8802 -0.0143 -0.4744 +vn 0.4233 0.4929 0.7602 +vn 0.9069 -0.4152 -0.0719 +vn 0.7485 0.1960 -0.6335 +vn 0.9469 -0.1905 0.2590 +vn 0.2044 0.5416 0.8154 +vn 0.1331 -0.9908 -0.0258 +vn 0.7336 0.2615 -0.6273 +vn 0.2342 0.2688 0.9343 +vn 0.1883 0.6172 -0.7639 +vn 0.9416 -0.1884 0.2792 +vn 0.8733 0.3868 0.2961 +vn 0.2064 0.8780 0.4320 +vn 0.6470 -0.7228 0.2426 +vn 0.7974 -0.0086 0.6034 +vn 0.6695 0.7288 0.1436 +vn 0.9855 0.1632 -0.0468 +vn 0.9038 0.4266 0.0328 +vn 0.8882 -0.4349 -0.1482 +vn 0.8771 0.1899 0.4411 +vn 0.9246 -0.0698 -0.3744 +vn 0.8888 -0.4338 -0.1478 +vn 0.9652 0.1149 -0.2348 +vn 0.0211 -0.3070 -0.9515 +vn 0.3861 0.9199 -0.0684 +vn 0.5081 0.8568 0.0878 +vn -0.6523 -0.2834 0.7030 +vn -0.3833 0.1825 0.9054 +vn -0.1002 0.6064 0.7888 +vn -0.0379 -0.9984 -0.0423 +vn 0.0282 0.3361 0.9414 +vn 0.2424 0.8514 0.4651 +vn 0.1535 0.9117 0.3811 +vn 0.3177 0.5348 0.7830 +vn 0.0425 -0.9983 0.0406 +vn 0.0077 -0.9997 0.0221 +vn 0.0164 -0.9873 -0.1580 +vn -0.3309 0.6421 0.6915 +vn 0.3222 0.5810 0.7474 +vn -0.1199 0.3573 0.9263 +vn 0.2864 0.9558 0.0657 +vn 0.3245 0.2005 0.9244 +vn 0.9317 -0.0717 0.3560 +vn -0.1548 0.3036 0.9402 +vn 0.2590 0.7201 0.6437 +vn 0.1367 0.8274 0.5447 +vn 0.5010 0.7023 0.5058 +vn 0.5207 0.5780 0.6283 +vn 0.4551 0.8494 0.2673 +vn -0.8963 0.0523 0.4403 +vn -0.2944 0.2273 0.9283 +vn -0.0809 0.3908 0.9169 +vn -0.0210 -0.3108 -0.9502 +vn 0.1624 0.4495 0.8784 +vn 0.6044 0.6144 0.5072 +vn 0.4078 0.4908 0.7699 +vn -0.1207 0.9215 0.3692 +vn -0.0207 0.6960 0.7177 +vn 0.3329 0.4590 0.8237 +vn 0.8679 0.3637 0.3384 +vn -0.2034 0.7736 -0.6002 +vn 0.7218 0.0163 0.6919 +vn 0.6072 0.5192 0.6015 +vn 0.8752 0.3161 0.3661 +vn 0.1141 0.0365 0.9928 +vn 0.8170 0.1540 0.5557 +vn 0.2110 -0.4420 0.8718 +vn 0.7194 -0.1000 0.6873 +vn 0.3026 -0.3420 0.8896 +vn -0.3233 0.3402 0.8830 +vn -0.1868 -0.9523 0.2413 +vn -0.3016 -0.1140 0.9466 +vn 0.7298 0.3154 0.6066 +vn -0.1439 0.0058 0.9896 +vn 0.4455 0.2325 0.8646 +vn -0.1915 -0.3398 0.9208 +vn -0.0764 0.0290 0.9967 +vn 0.5098 -0.3671 0.7781 +vn 0.5738 -0.1941 0.7956 +vn 0.5783 0.5535 0.5993 +vn 0.7129 0.6909 -0.1203 +vn 0.4725 -0.8667 -0.1600 +vn 0.4746 -0.5390 0.6959 +vn 0.0707 -0.3643 0.9286 +vn 0.6381 0.2986 0.7097 +vn 0.7042 -0.4968 0.5072 +vn -0.0199 0.1074 0.9940 +vn 0.2514 -0.1622 0.9542 +vn 0.1539 -0.2006 0.9675 +vn 0.1416 -0.1593 0.9770 +vn 0.5375 -0.4125 0.7355 +vn 0.6972 0.2249 0.6806 +vn 0.1693 -0.5868 0.7918 +vn 0.2969 0.2142 0.9306 +vn 0.0084 0.1015 0.9948 +vn 0.8376 0.1471 0.5261 +vn 0.2072 -0.1358 0.9688 +vn 0.1963 -0.1669 0.9662 +vn 0.2757 -0.2134 0.9372 +vn 0.2818 -0.3124 0.9072 +vn 0.2144 -0.2658 0.9399 +vn 0.1780 -0.5861 0.7904 +vn 0.9674 -0.0459 0.2490 +vn 0.3752 0.2798 0.8837 +vn 0.2788 -0.2037 0.9385 +vn 0.5056 -0.0232 0.8625 +vn 0.1875 -0.2892 0.9387 +vn 0.2968 -0.8024 0.5177 +vn -0.3803 -0.9237 -0.0473 +vn 0.2795 0.0831 0.9565 +vn 0.8449 0.2950 0.4462 +vn -0.7448 -0.6552 0.1269 +vn 0.4379 0.2168 0.8725 +vn 0.8876 -0.1266 0.4429 +vn 0.0072 -0.9667 0.2559 +vn 0.5429 -0.2810 0.7914 +vn 0.6111 -0.4605 0.6438 +vn 0.6964 -0.0350 0.7168 +vn 0.9234 0.2476 0.2932 +vn 0.4890 -0.6695 0.5592 +vn 0.4462 -0.0034 0.8949 +vn -0.0077 -0.9983 -0.0581 +vn 0.3848 -0.2952 0.8745 +vn 0.9345 0.3504 0.0629 +vn 0.6897 -0.3164 0.6513 +vn 0.6878 0.2174 0.6926 +vn 0.6224 -0.2717 0.7340 +vn 0.1628 -0.9659 -0.2011 +vn 0.0139 -0.9941 0.1079 +vn 0.0469 -0.9908 -0.1272 +vn -0.1140 -0.9313 0.3459 +vn 0.5842 -0.8088 -0.0677 +vn -0.0551 -0.9982 0.0239 +vn 0.3848 0.9164 -0.1100 +vn -0.1370 -0.9905 0.0069 +vn 0.0470 -0.9987 -0.0211 +vn 0.3276 -0.6770 0.6591 +vn -0.1259 -0.9863 0.1070 +vn -0.0474 -0.9976 0.0502 +vn -0.1281 -0.9917 -0.0144 +vn 0.6033 -0.6851 -0.4082 +vn -0.5617 -0.7938 -0.2331 +vn 0.4489 -0.7337 -0.5100 +vn 0.4967 -0.8634 0.0888 +vn -0.1925 -0.9772 0.0893 +vn -0.0299 -0.9918 0.1246 +vn 0.0052 -0.9998 0.0215 +vn -0.1265 -0.9323 0.3390 +vn 0.1661 -0.7906 -0.5894 +vn -0.1551 -0.7448 -0.6491 +vn 0.5374 -0.4130 -0.7353 +vn 0.0140 -0.8980 0.4399 +vn 0.1312 -0.8704 -0.4746 +vn -0.0551 -0.9964 -0.0637 +vn 0.7163 -0.4505 -0.5328 +vn 0.5604 -0.6215 -0.5475 +vn 0.6676 -0.7428 -0.0514 +vn -0.0561 -0.9925 -0.1087 +vn -0.0856 -0.8779 -0.4712 +vn -0.5288 -0.8354 -0.1500 +vn 0.4679 -0.6473 -0.6017 +vn 0.5563 -0.8301 0.0388 +vn 0.2429 -0.9061 -0.3463 +vn -0.4546 -0.8726 -0.1784 +vn 0.1084 -0.9761 -0.1883 +vn -0.7618 -0.6182 -0.1937 +vn 0.0216 -0.9996 0.0183 +vn 0.1203 -0.9853 -0.1215 +vn 0.4273 0.2162 -0.8779 +vn 0.2890 -0.9460 -0.1471 +vn 0.1441 -0.8086 -0.5704 +vn -0.5980 -0.7387 0.3110 +vn 0.1036 -0.9886 -0.1095 +vn 0.1198 -0.8597 -0.4966 +vn -0.0665 -0.6459 -0.7606 +vn -0.1207 -0.9923 0.0273 +vn -0.1576 -0.9856 0.0617 +vn 0.0114 -0.9997 0.0196 +vn 0.3143 -0.9335 -0.1725 +vn 0.0377 -0.9872 -0.1553 +vn -0.0240 -0.9997 -0.0063 +vn 0.2941 -0.9554 -0.0252 +vn -0.7388 -0.6576 0.1474 +vn 0.6490 0.4669 0.6007 +vn 0.0187 -0.9998 0.0002 +vn 0.8902 -0.1004 0.4444 +vn 0.6098 -0.7909 0.0505 +vn -0.4882 -0.8709 0.0558 +vn -0.6190 0.1871 -0.7628 +vn -0.0926 -0.9885 -0.1194 +vn 0.0272 -0.9719 -0.2338 +vn 0.0441 -0.9988 -0.0222 +vn -0.3918 -0.9151 0.0951 +vn -0.0526 -0.9978 -0.0397 +vn -0.1026 -0.9918 -0.0765 +vn 0.9440 -0.3205 -0.0789 +vn 0.0160 -0.9995 -0.0285 +vn -0.2613 -0.4617 -0.8477 +vn 0.0357 -0.9876 -0.1527 +s 0 +f 34//1 27//1 201//1 +f 15//2 14//2 49//2 +f 21//3 6//3 31//3 +f 45//4 46//4 47//4 +f 26//5 48//5 57//5 +f 43//6 42//6 16//6 +f 52//7 58//7 40//7 +f 58//8 41//8 40//8 +f 225//9 10//9 35//9 +f 65//10 79//10 57//10 +f 63//11 85//11 64//11 +f 72//12 62//12 200//12 +f 1//13 124//13 222//13 +f 68//14 74//14 69//14 +f 83//15 76//15 70//15 +f 90//16 68//16 91//16 +f 75//17 29//17 137//17 +f 158//18 72//18 92//18 +f 203//19 81//19 125//19 +f 60//20 126//20 97//20 +f 83//21 70//21 84//21 +f 87//22 74//22 68//22 +f 92//23 72//23 200//23 +f 90//24 87//24 68//24 +f 75//25 137//25 117//25 +f 90//26 243//26 109//26 +f 90//27 112//27 87//27 +f 93//28 88//28 29//28 +f 87//29 112//29 74//29 +f 74//30 116//30 105//30 +f 112//31 116//31 74//31 +f 88//32 107//32 29//32 +f 112//33 90//33 109//33 +f 96//34 113//34 99//34 +f 80//35 84//35 70//35 +f 21//36 20//36 6//36 +f 116//37 125//37 105//37 +f 111//38 122//38 121//38 +f 129//39 112//39 109//39 +f 123//40 116//40 112//40 +f 109//41 130//41 129//41 +f 94//42 131//42 38//42 +f 112//43 129//43 123//43 +f 88//44 118//44 107//44 +f 130//45 123//45 129//45 +f 109//46 132//46 130//46 +f 4//47 125//47 116//47 +f 122//48 132//48 109//48 +f 134//49 123//49 130//49 +f 123//50 4//50 116//50 +f 62//51 98//51 168//51 +f 107//52 118//52 66//52 +f 37//53 38//53 7//53 +f 132//54 138//54 130//54 +f 78//55 77//55 23//55 +f 138//56 134//56 130//56 +f 135//57 132//57 122//57 +f 20//58 3//58 4//58 +f 134//59 4//59 123//59 +f 114//60 113//60 11//60 +f 134//61 133//61 4//61 +f 76//62 93//62 117//62 +f 140//63 6//63 20//63 +f 141//64 80//64 143//64 +f 20//65 133//65 140//65 +f 5//66 121//66 145//66 +f 148//67 196//67 149//67 +f 133//68 66//68 140//68 +f 93//69 75//69 117//69 +f 137//70 138//70 150//70 +f 1//71 222//71 152//71 +f 113//72 114//72 99//72 +f 151//73 117//73 150//73 +f 107//74 66//74 134//74 +f 20//75 4//75 133//75 +f 80//76 70//76 143//76 +f 117//77 137//77 150//77 +f 66//78 133//78 134//78 +f 85//79 139//79 12//79 +f 70//80 76//80 117//80 +f 38//81 131//81 13//81 +f 83//82 160//82 76//82 +f 58//83 165//83 41//83 +f 41//84 165//84 89//84 +f 74//85 58//85 52//85 +f 12//86 11//86 113//86 +f 166//87 58//87 74//87 +f 144//88 172//88 126//88 +f 164//89 147//89 96//89 +f 166//90 165//90 58//90 +f 173//91 84//91 174//91 +f 7//92 89//92 165//92 +f 155//93 111//93 177//93 +f 74//94 105//94 166//94 +f 176//95 7//95 165//95 +f 166//96 176//96 165//96 +f 153//97 93//97 170//97 +f 166//98 125//98 176//98 +f 93//99 29//99 75//99 +f 153//100 98//100 118//100 +f 160//101 170//101 93//101 +f 166//102 105//102 125//102 +f 167//103 170//103 83//103 +f 83//104 170//104 160//104 +f 178//105 63//105 64//105 +f 153//106 88//106 93//106 +f 67//107 61//107 55//107 +f 153//108 118//108 88//108 +f 153//109 168//109 98//109 +f 37//110 94//110 38//110 +f 174//111 84//111 80//111 +f 161//112 44//112 155//112 +f 114//113 168//113 167//113 +f 154//114 55//114 175//114 +f 175//115 94//115 154//115 +f 120//116 96//116 99//116 +f 161//117 141//117 44//117 +f 181//118 157//118 101//118 +f 118//119 140//119 66//119 +f 172//120 94//120 175//120 +f 197//121 257//121 148//121 +f 164//122 12//122 147//122 +f 167//123 153//123 170//123 +f 19//124 169//124 171//124 +f 167//125 168//125 153//125 +f 172//126 144//126 94//126 +f 94//127 136//127 131//127 +f 250//128 187//128 259//128 +f 173//129 167//129 83//129 +f 64//130 71//130 178//130 +f 113//131 96//131 147//131 +f 94//132 37//132 55//132 +f 173//133 83//133 84//133 +f 161//134 80//134 141//134 +f 61//135 97//135 175//135 +f 99//136 114//136 167//136 +f 81//137 67//137 55//137 +f 122//138 109//138 121//138 +f 147//139 12//139 113//139 +f 76//140 160//140 93//140 +f 99//141 167//141 173//141 +f 144//142 136//142 94//142 +f 55//143 154//143 94//143 +f 86//144 79//144 104//144 +f 79//145 15//145 57//145 +f 250//146 82//146 187//146 +f 110//147 25//147 115//147 +f 195//148 158//148 159//148 +f 172//149 97//149 126//149 +f 2//150 39//150 189//150 +f 195//151 159//151 156//151 +f 65//152 57//152 48//152 +f 72//153 127//153 162//153 +f 39//154 30//154 189//154 +f 233//155 211//155 3//155 +f 128//156 72//156 158//156 +f 77//157 185//157 124//157 +f 122//158 111//158 155//158 +f 57//159 15//159 49//159 +f 10//160 225//160 56//160 +f 9//161 10//161 56//161 +f 191//162 50//162 163//162 +f 156//163 159//163 157//163 +f 24//164 10//164 9//164 +f 18//165 19//165 171//165 +f 25//166 47//166 146//166 +f 174//167 120//167 173//167 +f 157//168 159//168 101//168 +f 86//169 16//169 79//169 +f 1//170 77//170 124//170 +f 185//171 27//171 124//171 +f 55//172 37//172 81//172 +f 183//173 155//173 177//173 +f 5//174 145//174 192//174 +f 86//175 59//175 16//175 +f 200//176 168//176 114//176 +f 15//177 79//177 16//177 +f 65//178 104//178 79//178 +f 72//179 162//179 62//179 +f 64//180 85//180 164//180 +f 176//181 37//181 7//181 +f 164//182 85//182 12//182 +f 176//183 81//183 37//183 +f 71//184 64//184 164//184 +f 62//185 168//185 200//185 +f 14//186 33//186 49//186 +f 43//187 16//187 59//187 +f 211//188 81//188 203//188 +f 139//189 11//189 12//189 +f 200//190 11//190 139//190 +f 200//191 114//191 11//191 +f 39//192 2//192 184//192 +f 92//193 200//193 139//193 +f 35//194 184//194 2//194 +f 136//195 13//195 131//195 +f 7//196 201//196 89//196 +f 21//197 3//197 20//197 +f 42//198 36//198 14//198 +f 16//199 42//199 14//199 +f 89//200 201//200 28//200 +f 222//201 27//201 34//201 +f 34//202 201//202 33//202 +f 39//203 77//203 1//203 +f 202//204 201//204 38//204 +f 14//205 34//205 33//205 +f 3//206 203//206 125//206 +f 177//207 5//207 192//207 +f 89//208 28//208 41//208 +f 62//209 205//209 98//209 +f 222//210 124//210 27//210 +f 201//211 27//211 28//211 +f 208//212 118//212 98//212 +f 33//213 201//213 202//213 +f 33//214 202//214 49//214 +f 98//215 205//215 208//215 +f 62//216 162//216 205//216 +f 3//217 125//217 4//217 +f 211//218 203//218 3//218 +f 81//219 176//219 125//219 +f 192//220 145//220 73//220 +f 38//221 201//221 7//221 +f 205//222 31//222 208//222 +f 208//223 140//223 118//223 +f 162//224 31//224 205//224 +f 29//225 107//225 137//225 +f 186//226 78//226 23//226 +f 6//227 140//227 208//227 +f 144//228 13//228 136//228 +f 1//229 152//229 30//229 +f 31//230 6//230 208//230 +f 16//231 14//231 15//231 +f 141//232 122//232 44//232 +f 61//233 13//233 60//233 +f 151//234 70//234 117//234 +f 121//235 109//235 243//235 +f 34//236 14//236 36//236 +f 150//237 138//237 132//237 +f 132//238 151//238 150//238 +f 132//239 135//239 151//239 +f 111//240 5//240 177//240 +f 107//241 134//241 138//241 +f 61//242 175//242 55//242 +f 145//243 243//243 51//243 +f 185//244 41//244 28//244 +f 162//245 217//245 31//245 +f 194//246 40//246 214//246 +f 143//247 151//247 135//247 +f 91//248 68//248 24//248 +f 68//249 206//249 24//249 +f 40//250 41//250 185//250 +f 172//251 175//251 97//251 +f 206//252 68//252 69//252 +f 141//253 143//253 135//253 +f 145//254 121//254 243//254 +f 73//255 191//255 119//255 +f 24//256 206//256 10//256 +f 141//257 135//257 122//257 +f 51//258 95//258 50//258 +f 28//259 27//259 185//259 +f 146//260 19//260 18//260 +f 155//261 44//261 122//261 +f 38//262 13//262 202//262 +f 50//263 95//263 163//263 +f 138//264 137//264 107//264 +f 214//265 40//265 78//265 +f 40//266 185//266 78//266 +f 142//267 169//267 227//267 +f 32//268 199//268 188//268 +f 42//269 43//269 103//269 +f 179//270 216//270 149//270 +f 36//271 42//271 103//271 +f 218//272 103//272 104//272 +f 78//273 185//273 77//273 +f 103//274 207//274 36//274 +f 227//275 217//275 142//275 +f 146//276 193//276 204//276 +f 222//277 207//277 103//277 +f 216//278 146//278 204//278 +f 50//279 145//279 51//279 +f 218//280 222//280 103//280 +f 206//281 69//281 184//281 +f 252//282 221//282 250//282 +f 216//283 179//283 25//283 +f 106//284 65//284 222//284 +f 222//285 218//285 106//285 +f 196//286 17//286 115//286 +f 216//287 25//287 146//287 +f 17//288 22//288 108//288 +f 207//289 34//289 36//289 +f 110//290 115//290 17//290 +f 145//291 50//291 73//291 +f 217//292 162//292 209//292 +f 23//293 77//293 39//293 +f 224//294 223//294 180//294 +f 198//295 220//295 250//295 +f 1//296 30//296 39//296 +f 34//297 207//297 222//297 +f 142//298 171//298 169//298 +f 48//299 222//299 65//299 +f 206//300 184//300 35//300 +f 223//301 225//301 180//301 +f 139//302 63//302 92//302 +f 187//303 212//303 259//303 +f 10//304 206//304 35//304 +f 53//305 199//305 54//305 +f 73//306 50//306 191//306 +f 223//307 56//307 225//307 +f 2//308 26//308 225//308 +f 18//309 188//309 199//309 +f 102//310 223//310 224//310 +f 152//311 222//311 48//311 +f 191//312 210//312 108//312 +f 35//313 2//313 225//313 +f 191//314 108//314 119//314 +f 223//315 9//315 56//315 +f 202//316 13//316 100//316 +f 95//317 102//317 210//317 +f 223//318 8//318 9//318 +f 163//319 95//319 210//319 +f 52//320 40//320 194//320 +f 163//321 210//321 191//321 +f 25//322 179//322 115//322 +f 92//323 159//323 158//323 +f 127//324 72//324 128//324 +f 32//325 127//325 199//325 +f 221//326 229//326 250//326 +f 209//327 127//327 32//327 +f 18//328 199//328 193//328 +f 21//329 31//329 227//329 +f 92//330 63//330 159//330 +f 182//331 183//331 230//331 +f 182//332 230//332 231//332 +f 182//333 231//333 232//333 +f 202//334 100//334 49//334 +f 199//335 53//335 193//335 +f 100//336 57//336 49//336 +f 3//337 21//337 226//337 +f 188//338 18//338 142//338 +f 59//339 86//339 104//339 +f 100//340 211//340 57//340 +f 226//341 21//341 169//341 +f 31//342 217//342 227//342 +f 211//343 233//343 26//343 +f 233//344 215//344 26//344 +f 21//345 227//345 169//345 +f 81//346 211//346 67//346 +f 63//347 139//347 85//347 +f 162//348 127//348 209//348 +f 70//349 151//349 143//349 +f 217//350 209//350 142//350 +f 115//351 179//351 149//351 +f 233//352 169//352 215//352 +f 233//353 3//353 226//353 +f 226//354 169//354 233//354 +f 188//355 209//355 32//355 +f 225//356 26//356 180//356 +f 5//357 111//357 121//357 +f 189//358 48//358 26//358 +f 110//359 108//359 210//359 +f 126//360 60//360 144//360 +f 26//361 57//361 211//361 +f 189//362 152//362 48//362 +f 101//363 63//363 178//363 +f 224//364 180//364 46//364 +f 101//365 159//365 63//365 +f 67//366 211//366 100//366 +f 230//367 183//367 234//367 +f 158//368 195//368 128//368 +f 180//369 26//369 215//369 +f 195//370 127//370 128//370 +f 19//371 213//371 169//371 +f 156//372 157//372 195//372 +f 195//373 236//373 127//373 +f 210//374 45//374 25//374 +f 47//375 19//375 146//375 +f 110//376 210//376 25//376 +f 193//377 146//377 18//377 +f 220//378 247//378 250//378 +f 224//379 46//379 45//379 +f 157//380 235//380 195//380 +f 17//381 108//381 110//381 +f 2//382 189//382 26//382 +f 236//383 199//383 127//383 +f 181//384 237//384 157//384 +f 195//385 235//385 238//385 +f 195//386 238//386 236//386 +f 45//387 47//387 25//387 +f 213//388 180//388 215//388 +f 237//389 235//389 157//389 +f 142//390 209//390 188//390 +f 54//391 199//391 236//391 +f 100//392 13//392 61//392 +f 239//393 236//393 238//393 +f 236//394 239//394 54//394 +f 235//395 240//395 238//395 +f 47//396 46//396 19//396 +f 240//397 239//397 238//397 +f 237//398 240//398 235//398 +f 102//399 45//399 210//399 +f 18//400 171//400 142//400 +f 181//401 190//401 237//401 +f 46//402 213//402 19//402 +f 190//403 148//403 237//403 +f 149//404 240//404 237//404 +f 187//405 241//405 182//405 +f 237//406 148//406 149//406 +f 60//407 13//407 144//407 +f 241//408 183//408 182//408 +f 213//409 215//409 169//409 +f 103//410 59//410 104//410 +f 242//411 220//411 228//411 +f 149//412 216//412 240//412 +f 216//413 239//413 240//413 +f 180//414 213//414 46//414 +f 30//415 152//415 189//415 +f 224//416 45//416 102//416 +f 239//417 204//417 54//417 +f 190//418 197//418 148//418 +f 54//419 204//419 53//419 +f 22//420 119//420 108//420 +f 216//421 204//421 239//421 +f 204//422 193//422 53//422 +f 61//423 60//423 97//423 +f 244//424 174//424 245//424 +f 174//425 246//425 245//425 +f 251//426 155//426 183//426 +f 65//427 218//427 104//427 +f 65//428 106//428 218//428 +f 71//429 219//429 101//429 +f 219//430 249//430 248//430 +f 120//431 174//431 244//431 +f 101//432 219//432 228//432 +f 100//433 61//433 67//433 +f 249//434 120//434 244//434 +f 71//435 249//435 219//435 +f 71//436 120//436 249//436 +f 184//437 23//437 39//437 +f 164//438 96//438 120//438 +f 184//439 69//439 23//439 +f 69//440 186//440 23//440 +f 228//441 197//441 181//441 +f 181//442 197//442 190//442 +f 198//443 250//443 259//443 +f 178//444 71//444 101//444 +f 186//445 194//445 214//445 +f 197//446 198//446 259//446 +f 78//447 186//447 214//447 +f 242//448 247//448 220//448 +f 69//449 194//449 186//449 +f 82//450 241//450 187//450 +f 9//451 8//451 24//451 +f 8//452 253//452 24//452 +f 223//453 253//453 8//453 +f 161//454 251//454 246//454 +f 52//455 194//455 69//455 +f 164//456 120//456 71//456 +f 91//457 24//457 253//457 +f 102//458 95//458 253//458 +f 245//459 250//459 247//459 +f 74//460 52//460 69//460 +f 244//461 245//461 254//461 +f 173//462 120//462 99//462 +f 17//463 255//463 22//463 +f 73//464 119//464 22//464 +f 252//465 250//465 245//465 +f 95//466 51//466 253//466 +f 253//467 243//467 91//467 +f 254//468 245//468 247//468 +f 255//469 73//469 22//469 +f 51//470 243//470 253//470 +f 243//471 90//471 91//471 +f 197//472 228//472 220//472 +f 17//473 256//473 255//473 +f 196//474 257//474 17//474 +f 73//475 177//475 192//475 +f 234//476 73//476 255//476 +f 256//477 17//477 257//477 +f 232//478 256//478 257//478 +f 258//479 232//479 257//479 +f 196//480 115//480 149//480 +f 257//481 196//481 148//481 +f 103//482 43//482 59//482 +f 253//483 223//483 102//483 +f 259//484 258//484 257//484 +f 174//485 80//485 161//485 +f 174//486 161//486 246//486 +f 183//487 73//487 234//487 +f 101//488 228//488 181//488 +f 259//489 212//489 258//489 +f 250//490 229//490 82//490 +f 231//491 256//491 232//491 +f 197//492 220//492 198//492 +f 177//493 73//493 183//493 +f 257//494 197//494 259//494 +f 161//495 155//495 251//495 diff --git a/scene/meshes/cbox/ceiling.obj b/scene/meshes/cbox/ceiling.obj new file mode 100644 index 0000000..4ff391d --- /dev/null +++ b/scene/meshes/cbox/ceiling.obj @@ -0,0 +1,11 @@ +# Blender 4.1.1 +# www.blender.org +o cbox_ceiling.001 +v 5.560000 5.488000 -0.000000 +v 5.560000 5.487999 5.592000 +v 0.000000 5.487999 5.592000 +v 0.000000 5.488000 -0.000000 +vn -0.0000 -1.0000 -0.0000 +s 0 +f 2//1 4//1 1//1 +f 2//1 3//1 4//1 diff --git a/scene/meshes/cornell/cbox_floor.obj b/scene/meshes/cbox/floor.obj similarity index 81% rename from scene/meshes/cornell/cbox_floor.obj rename to scene/meshes/cbox/floor.obj index d6e768e..99f02e3 100644 --- a/scene/meshes/cornell/cbox_floor.obj +++ b/scene/meshes/cbox/floor.obj @@ -1,4 +1,4 @@ -# Blender 3.5.1 +# Blender 4.1.1 # www.blender.org o cbox_floor.001 v 5.528000 0.000000 0.000000 @@ -6,9 +6,10 @@ v 0.000000 0.000000 0.000000 v 0.000000 0.000000 5.592000 v 5.496000 0.000000 5.592000 vn -0.0000 1.0000 -0.0000 -vt 1.000000 0.829052 vt 0.000000 0.829052 -vt 0.000000 0.154667 vt 0.994211 0.154667 -f 2/2/1 4/4/1 1/1/1 -f 2/2/1 3/3/1 4/4/1 +vt 1.000000 0.829052 +vt 0.000000 0.154667 +s 0 +f 2/1/1 4/2/1 1/3/1 +f 2/1/1 3/4/1 4/2/1 diff --git a/scene/meshes/cornell/cbox_redwall.obj b/scene/meshes/cbox/left_wall.obj similarity index 56% rename from scene/meshes/cornell/cbox_redwall.obj rename to scene/meshes/cbox/left_wall.obj index b041a3c..82bc451 100644 --- a/scene/meshes/cornell/cbox_redwall.obj +++ b/scene/meshes/cbox/left_wall.obj @@ -1,11 +1,12 @@ -# Blender v2.82 (sub 7) OBJ File: '' +# Blender 4.1.1 # www.blender.org o cbox_redwall.001 v 5.528000 0.000000 0.000000 -v 5.496000 -0.000000 5.592000 +v 5.496000 0.000000 5.592000 v 5.560000 5.487999 5.592000 -v 5.560000 5.488000 0.000000 -vn -1.0000 0.0058 0.0000 +v 5.560000 5.488000 -0.000000 +vn -1.0000 0.0058 -0.0000 vn -0.9999 0.0117 -0.0057 +s 0 f 1//1 3//1 4//1 f 1//2 2//2 3//2 diff --git a/scene/meshes/cbox/light.obj b/scene/meshes/cbox/light.obj new file mode 100644 index 0000000..f82ddcc --- /dev/null +++ b/scene/meshes/cbox/light.obj @@ -0,0 +1,11 @@ +# Blender 4.1.1 +# www.blender.org +o cbox_luminaire.001 +v 3.430000 5.459543 2.270000 +v 3.430000 5.459543 3.319999 +v 2.130000 5.459543 3.319999 +v 2.130000 5.459543 2.270000 +vn -0.0000 -1.0000 -0.0000 +s 0 +f 2//1 4//1 1//1 +f 2//1 3//1 4//1 diff --git a/scene/meshes/cornell/cbox_greenwall.obj b/scene/meshes/cbox/right_wall.obj similarity index 52% rename from scene/meshes/cornell/cbox_greenwall.obj rename to scene/meshes/cbox/right_wall.obj index 529d25d..0b0015c 100644 --- a/scene/meshes/cornell/cbox_greenwall.obj +++ b/scene/meshes/cbox/right_wall.obj @@ -1,10 +1,11 @@ -# Blender v2.82 (sub 7) OBJ File: '' +# Blender 4.1.1 # www.blender.org o cbox_greenwall.001 -v 0.000000 -0.000000 5.592000 +v 0.000000 0.000000 5.592000 v 0.000000 0.000000 0.000000 -v 0.000000 5.488000 0.000000 +v 0.000000 5.488000 -0.000000 v 0.000000 5.487999 5.592000 -vn 1.0000 0.0000 0.0000 +vn 1.0000 -0.0000 -0.0000 +s 0 f 2//1 4//1 1//1 f 2//1 3//1 4//1 diff --git a/scene/meshes/cornell/cbox_smallbox.obj b/scene/meshes/cbox/short-box.obj similarity index 59% rename from scene/meshes/cornell/cbox_smallbox.obj rename to scene/meshes/cbox/short-box.obj index 8479de4..d6c2cec 100644 --- a/scene/meshes/cornell/cbox_smallbox.obj +++ b/scene/meshes/cbox/short-box.obj @@ -1,36 +1,37 @@ -# Blender v2.82 (sub 7) OBJ File: '' +# Blender 4.1.1 # www.blender.org o cbox_smallbox.001 v 1.300000 1.650000 0.650000 v 0.820000 1.650000 2.250000 v 2.400000 1.650000 2.720000 v 2.900000 1.650000 1.140000 -v 2.900000 -0.000000 1.140000 +v 2.900000 0.000000 1.140000 v 2.900000 1.650000 1.140000 v 2.400000 1.650000 2.720000 -v 2.400000 -0.000000 2.720000 -v 1.300000 -0.000000 0.650000 +v 2.400000 0.000000 2.720000 +v 1.300000 0.000000 0.650000 v 1.300000 1.650000 0.650000 v 2.900000 1.650000 1.140000 -v 2.900000 -0.000000 1.140000 -v 0.820000 -0.000000 2.250000 +v 2.900000 0.000000 1.140000 +v 0.820000 0.000000 2.250000 v 0.820000 1.650000 2.250000 v 1.300000 1.650000 0.650000 -v 1.300000 -0.000000 0.650000 -v 2.400000 -0.000000 2.720000 +v 1.300000 0.000000 0.650000 +v 2.400000 0.000000 2.720000 v 2.400000 1.650000 2.720000 v 0.820000 1.650000 2.250000 -v 0.820000 -0.000000 2.250000 -v 2.900000 -0.000000 1.140000 -v 2.400000 -0.000000 2.720000 -v 0.820000 -0.000000 2.250000 -v 1.300000 -0.000000 0.650000 +v 0.820000 0.000000 2.250000 +v 2.900000 0.000000 1.140000 +v 2.400000 0.000000 2.720000 +v 0.820000 0.000000 2.250000 +v 1.300000 0.000000 0.650000 vn -0.0000 1.0000 -0.0000 -vn 0.9534 0.0000 0.3017 -vn 0.2928 0.0000 -0.9562 +vn 0.9534 -0.0000 0.3017 +vn 0.2928 -0.0000 -0.9562 vn -0.9578 -0.0000 -0.2873 -vn -0.2851 0.0000 0.9585 +vn -0.2851 -0.0000 0.9585 vn -0.0000 -1.0000 -0.0000 +s 0 f 1//1 2//1 3//1 f 1//1 3//1 4//1 f 5//2 6//2 7//2 diff --git a/scene/meshes/cbox/tall-box.obj b/scene/meshes/cbox/tall-box.obj new file mode 100644 index 0000000..0d48f57 --- /dev/null +++ b/scene/meshes/cbox/tall-box.obj @@ -0,0 +1,46 @@ +# Blender 4.1.1 +# www.blender.org +o cbox_largebox.001 +v 4.230000 3.300000 2.470000 +v 2.650000 3.300000 2.960000 +v 3.140000 3.300000 4.559999 +v 4.720000 3.300000 4.059999 +v 4.230000 0.000000 2.470000 +v 4.230000 3.300000 2.470000 +v 4.720000 3.300000 4.059999 +v 4.720000 0.000000 4.060000 +v 4.720000 0.000000 4.060000 +v 4.720000 3.300000 4.059999 +v 3.140000 3.300000 4.559999 +v 3.140000 0.000000 4.560000 +v 3.140000 0.000000 4.560000 +v 3.140000 3.300000 4.559999 +v 2.650000 3.300000 2.960000 +v 2.650000 0.000000 2.960000 +v 2.650000 0.000000 2.960000 +v 2.650000 3.300000 2.960000 +v 4.230000 3.300000 2.470000 +v 4.230000 0.000000 2.470000 +v 4.720000 0.000000 4.060000 +v 3.140000 0.000000 4.560000 +v 2.650000 0.000000 2.960000 +v 4.230000 0.000000 2.470000 +vn -0.0000 1.0000 -0.0000 +vn 0.9556 -0.0000 -0.2945 +vn 0.3017 -0.0000 0.9534 +vn -0.9562 -0.0000 0.2928 +vn -0.2962 -0.0000 -0.9551 +vn -0.0000 -1.0000 -0.0000 +s 0 +f 1//1 2//1 3//1 +f 1//1 3//1 4//1 +f 5//2 6//2 7//2 +f 5//2 7//2 8//2 +f 9//3 10//3 11//3 +f 9//3 11//3 12//3 +f 13//4 14//4 15//4 +f 13//4 15//4 16//4 +f 17//5 18//5 19//5 +f 17//5 19//5 20//5 +f 21//6 22//6 23//6 +f 21//6 23//6 24//6 diff --git a/scene/meshes/cornell/cbox_ceiling.obj b/scene/meshes/cornell/cbox_ceiling.obj deleted file mode 100644 index 469c89a..0000000 --- a/scene/meshes/cornell/cbox_ceiling.obj +++ /dev/null @@ -1,11 +0,0 @@ -# Blender v2.82 (sub 7) OBJ File: '' -# www.blender.org -o cbox_ceiling.001 -v 5.560000 5.488000 0.000000 -v 5.560000 5.487999 5.592000 -v 0.000000 5.487999 5.592000 -v 0.000000 5.488000 0.000000 -vn 0.0000 -1.0000 0.0000 -vn 0.0000 1.0000 0.0000 -f 2//1 4//1 1//1 -f 2//1 3//1 4//1 diff --git a/scene/meshes/cornell/cbox_largebox.obj b/scene/meshes/cornell/cbox_largebox.obj deleted file mode 100644 index 610809e..0000000 --- a/scene/meshes/cornell/cbox_largebox.obj +++ /dev/null @@ -1,45 +0,0 @@ -# Blender v2.82 (sub 7) OBJ File: '' -# www.blender.org -o cbox_largebox.001 -v 4.230000 3.300000 2.470000 -v 2.650000 3.300000 2.960000 -v 3.140000 3.300000 4.560000 -v 4.720000 3.300000 4.060000 -v 4.230000 -0.000000 2.470000 -v 4.230000 3.300000 2.470000 -v 4.720000 3.300000 4.060000 -v 4.720000 -0.000000 4.060000 -v 4.720000 -0.000000 4.060000 -v 4.720000 3.300000 4.060000 -v 3.140000 3.300000 4.560000 -v 3.140000 -0.000000 4.560000 -v 3.140000 -0.000000 4.560000 -v 3.140000 3.300000 4.560000 -v 2.650000 3.300000 2.960000 -v 2.650000 -0.000000 2.960000 -v 2.650000 -0.000000 2.960000 -v 2.650000 3.300000 2.960000 -v 4.230000 3.300000 2.470000 -v 4.230000 -0.000000 2.470000 -v 4.720000 -0.000000 4.060000 -v 3.140000 -0.000000 4.560000 -v 2.650000 -0.000000 2.960000 -v 4.230000 -0.000000 2.470000 -vn -0.0000 1.0000 0.0000 -vn 0.9556 0.0000 -0.2945 -vn 0.3017 0.0000 0.9534 -vn -0.9562 0.0000 0.2928 -vn -0.2962 0.0000 -0.9551 -vn -0.0000 -1.0000 -0.0000 -f 1//1 2//1 3//1 -f 1//1 3//1 4//1 -f 5//2 6//2 7//2 -f 5//2 7//2 8//2 -f 9//3 10//3 11//3 -f 9//3 11//3 12//3 -f 13//4 14//4 15//4 -f 13//4 15//4 16//4 -f 17//5 18//5 19//5 -f 17//5 19//5 20//5 -f 21//6 22//6 23//6 -f 21//6 23//6 24//6 diff --git a/scene/meshes/cornell/cbox_luminaire.obj b/scene/meshes/cornell/cbox_luminaire.obj deleted file mode 100644 index b3ad8ba..0000000 --- a/scene/meshes/cornell/cbox_luminaire.obj +++ /dev/null @@ -1,10 +0,0 @@ -# Blender v2.82 (sub 7) OBJ File: '' -# www.blender.org -o cbox_luminaire.001 -v 3.430000 5.488000 2.270000 -v 3.430000 5.488000 3.320000 -v 2.130000 5.488000 3.320000 -v 2.130000 5.488000 2.270000 -vn 0.0000 -1.0000 0.0000 -f 2//1 4//1 1//1 -f 2//1 3//1 4//1 diff --git a/scene/xml/balls-mono.xml b/scene/xml/balls-mono.xml deleted file mode 100644 index 2f9d46e..0000000 --- a/scene/xml/balls-mono.xml +++ /dev/null @@ -1,148 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/scene/xml/bunny.xml b/scene/xml/bunny.xml new file mode 100644 index 0000000..a600fe9 --- /dev/null +++ b/scene/xml/bunny.xml @@ -0,0 +1,112 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/scene/xml/cbox-point.xml b/scene/xml/cbox-point.xml index c4d92c5..aa0fd74 100644 --- a/scene/xml/cbox-point.xml +++ b/scene/xml/cbox-point.xml @@ -6,8 +6,10 @@ - + + + @@ -16,6 +18,7 @@ + @@ -63,10 +66,16 @@ - + + + + + + + @@ -111,8 +120,15 @@ - - + + + + + + + + + \ No newline at end of file diff --git a/src/core/camera_model.cuh b/src/core/camera_model.cuh index 81e592a..7f6b615 100644 --- a/src/core/camera_model.cuh +++ b/src/core/camera_model.cuh @@ -39,11 +39,12 @@ private: Vec3 t, dir; // camera translation (world frame) and orientation float inv_focal; // focal length float _hw, _hh; // pixel plane + Vec2 signs; public: CPT_CPU_GPU DeviceCamera() {} - CPT_CPU_GPU DeviceCamera(const Vec3& from, const Vec3& lookat, float fov, float w, float h): - t(from), inv_focal(1.f / fov2focal(fov, w)), _hw(w * 0.5f), _hh(h * 0.5f) { + CPT_CPU_GPU DeviceCamera(const Vec3& from, const Vec3& lookat, float fov, float w, float h, float hsign = 1, float vsign = 1): + t(from), inv_focal(1.f / fov2focal(fov, w)), _hw(w * 0.5f), _hh(h * 0.5f), signs(hsign, vsign) { dir = (lookat - from).normalized(); R = rotation_between(Vec3(0, 0, 1), dir); } @@ -54,12 +55,12 @@ public: CPT_GPU Ray generate_ray(int x, int y, Sampler& sampler) const { float x_pos = sampler.next1D() + float(x), y_pos = sampler.next1D() + float(y); - Vec3 ndc_dir((x_pos - _hw) * inv_focal, (y_pos - _hh) * inv_focal, 1.f); + Vec3 ndc_dir((x_pos - _hw) * inv_focal * signs.x(), (y_pos - _hh) * inv_focal * signs.y(), 1.f); return Ray(t, R.rotate(ndc_dir.normalized())); } CPT_CPU static DeviceCamera from_xml(const tinyxml2::XMLElement* sensorElement) { - float fov = 0; + float fov = 0, hsign = 1, vsign = 1; int width = 512, height = 512; Vec3 lookat_target; Vec3 lookat_origin; @@ -85,6 +86,18 @@ public: } } + element = sensorElement->FirstChildElement("bool"); + while (element) { + std::string name = element->Attribute("name"); + std::string value = element->Attribute("value"); + if(name == "vflip") { + if (value == "true") vsign = -vsign; + } else if (name == "hflip") { + if (value == "true") hsign = -hsign; + } + element = element->NextSiblingElement("bool"); + } + // Read film values element = sensorElement->FirstChildElement("film"); if (element) { @@ -99,6 +112,6 @@ public: filmElement = filmElement->NextSiblingElement("integer"); } } - return DeviceCamera(lookat_origin, lookat_target, fov, width, height); + return DeviceCamera(lookat_origin, lookat_target, fov, width, height, hsign, vsign); } }; diff --git a/src/core/config.cuh b/src/core/config.cuh index cef4971..8c398be 100644 --- a/src/core/config.cuh +++ b/src/core/config.cuh @@ -12,8 +12,9 @@ struct RenderingConfig { int height; int max_depth; int spp; + bool gamma_correction; - RenderingConfig() : width(512), height(512), max_depth(16), spp(64) {} + RenderingConfig() : width(512), height(512), max_depth(16), spp(64), gamma_correction(true) {} static RenderingConfig from_xml(const tinyxml2::XMLElement *sensor_node) { RenderingConfig config; @@ -39,6 +40,13 @@ struct RenderingConfig { } film_elem = film_elem->NextSiblingElement("integer"); } + film_elem = node->FirstChildElement("bool"); + if (film_elem) { + std::string name = film_elem->Attribute("name"); + if (name == "gamma_correction") { + film_elem->QueryBoolAttribute("value", &config.gamma_correction); + } + } } return config; } diff --git a/src/core/cuda_utils.cuh b/src/core/cuda_utils.cuh index ecf1061..1bcec6d 100644 --- a/src/core/cuda_utils.cuh +++ b/src/core/cuda_utils.cuh @@ -46,5 +46,5 @@ CPT_CPU_GPU_INLINE auto select(T1&& v_true, T2&& v_false, bool predicate) { return v_true * predicate + v_false * (1 - predicate); } -// inline int to_int(float x) { return int(std::clamp(x, 0.f, 1.f) * 255); } +inline int to_int_linear(float x) { return int(std::clamp(x, 0.f, 1.f) * 255); } inline int to_int(float x) { return int(powf(std::clamp(x, 0.f, 1.f), 1 / 2.2) * 255 + .5); } diff --git a/src/core/emitter.cuh b/src/core/emitter.cuh index 1401e57..a171a60 100644 --- a/src/core/emitter.cuh +++ b/src/core/emitter.cuh @@ -93,8 +93,6 @@ public: Vec3 normal = (norms->x[sampled_index] * diff_x * diff_y + \ norms->y[sampled_index] * uv.x() * diff_y + \ norms->z[sampled_index] * uv.y() * diff_x).normalized(); - // if (sampled_index == 10 || sampled_index == 11) - // printf("Normal (%d): %f, %f, %f\n", sampled_index, normal.x(), normal.y(), normal.z()); Vec3 sphere_normal = sample_uniform_sphere(select(uv, -uv + 1.f, sample_sum < 1.f), sample_sum); sampled = select( sampled, sphere_normal * prims->y[sampled_index].x() + prims->x[sampled_index], @@ -106,14 +104,12 @@ public: pdf *= sphere_normal.length2(); sphere_normal.normalize(); sample_sum = normal.dot(sphere_normal); // dot_light - // printf("Sampled sum: %f\n", sample_sum); pdf *= float(sample_sum > 0) / sample_sum; le = Le * float(sample_sum > 0); return sampled; } CPT_GPU virtual Vec3 eval_le(const Vec3* const inci_dir, const Vec3* const normal) const override { - printf("valid: %d\n", int(inci_dir->dot(*normal) < 0)); return select(this->Le, Vec3(0, 0, 0), inci_dir->dot(*normal) < 0); } }; \ No newline at end of file diff --git a/src/core/host_device.cuh b/src/core/host_device.cuh index 61b8b59..0b18460 100644 --- a/src/core/host_device.cuh +++ b/src/core/host_device.cuh @@ -66,18 +66,35 @@ public: } // TODO: can be accelerated via multi-threading - std::vector export_cpu(float inv_factor = 1) const { + std::vector export_cpu(float inv_factor = 1, bool gamma_cor = true) const { std::vector byte_buffer(_w * _h * 4); size_t copy_pitch = _w * sizeof(Vec3); CUDA_CHECK_RETURN(cudaMemcpy2D(host_buffer, copy_pitch, image_buffer, pitch, copy_pitch, _h, cudaMemcpyDeviceToHost)); - for (int i = 0; i < _h; i ++) { - for (int j = 0; j < _w; j ++) { - int pixel_index = i * _w + j; - const Vec3& color = host_buffer[pixel_index]; - byte_buffer[(pixel_index << 2)] = to_int(color.x() * inv_factor); - byte_buffer[(pixel_index << 2) + 1] = to_int(color.y() * inv_factor); - byte_buffer[(pixel_index << 2) + 2] = to_int(color.z() * inv_factor); - byte_buffer[(pixel_index << 2) + 3] = 255; + if (gamma_cor) { + for (int i = 0; i < _h; i ++) { + int base = i * _w; + for (int j = 0; j < _w; j ++) { + int pixel_index = base + j; + const Vec3& color = host_buffer[pixel_index]; + pixel_index <<= 2; + byte_buffer[pixel_index] = to_int(color.x() * inv_factor); + byte_buffer[pixel_index + 1] = to_int(color.y() * inv_factor); + byte_buffer[pixel_index + 2] = to_int(color.z() * inv_factor); + byte_buffer[pixel_index + 3] = 255; + } + } + } else { + for (int i = 0; i < _h; i ++) { + int base = i * _w; + for (int j = 0; j < _w; j ++) { + int pixel_index = base + j; + const Vec3& color = host_buffer[pixel_index]; + pixel_index <<= 2; + byte_buffer[pixel_index] = to_int_linear(color.x() * inv_factor); + byte_buffer[pixel_index + 1] = to_int_linear(color.y() * inv_factor); + byte_buffer[pixel_index + 2] = to_int_linear(color.z() * inv_factor); + byte_buffer[pixel_index + 3] = 255; + } } } return byte_buffer; diff --git a/src/core/progress.h b/src/core/progress.h new file mode 100644 index 0000000..29cc8d7 --- /dev/null +++ b/src/core/progress.h @@ -0,0 +1,19 @@ +/** + * Solution from + * https://stackoverflow.com/questions/14539867/how-to-display-a-progress-indicator-in-pure-c-c-cout-printf + * C++ progress bar +*/ +#pragma once +#include + +#define PBSTR "||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||" +#define PBWIDTH 100 + +void printProgress(int spp_now, int spp_full) { + float percentage = float(spp_now + 1) / float(spp_full); + int val = (int) (percentage * 100); + int lpad = (int) (percentage * PBWIDTH); + int rpad = PBWIDTH - lpad; + printf("\r%3d%% (%4d / %4d) [%.*s%*s]", val, spp_now + 1, spp_full, lpad, PBSTR, rpad, ""); + fflush(stdout); +} diff --git a/src/core/scene.cuh b/src/core/scene.cuh index e132e4b..6d3951c 100644 --- a/src/core/scene.cuh +++ b/src/core/scene.cuh @@ -144,7 +144,7 @@ void parseEmitterNames( const tinyxml2::XMLElement* emitter_elem, std::unordered_map& emitter_map ) { - int idx = 0; + int idx = 1; while (emitter_elem) { std::string id = emitter_elem->Attribute("id"); emitter_map[id] = idx++; @@ -204,7 +204,7 @@ void parseEmitter( std::cerr << "Bound primitive is not specified for area source '" << id << "', name: "<< element->Attribute("name") << std::endl; throw std::runtime_error("Bound primitive is not specified for area source"); } - bool spherical_bound = element->Attribute("value") == "sphere"; + bool spherical_bound = element->Attribute("value") == std::string("sphere"); create_area_source<<<1, 1>>>(emitters[index], emission * scaler, emitter_obj_map[id], spherical_bound); } } @@ -520,6 +520,7 @@ public: std::cout << "\tConfig: height:\t\t" << config.height << std::endl; std::cout << "\tConfig: max depth:\t" << config.max_depth << std::endl; std::cout << "\tConfig: SPP:\t\t" << config.spp << std::endl; + std::cout << "\tConfig: Gamma corr:\t" << config.gamma_correction << std::endl; std::cout << std::endl; } }; \ No newline at end of file diff --git a/src/core/vec3.cuh b/src/core/vec3.cuh index eb7e102..a62f468 100644 --- a/src/core/vec3.cuh +++ b/src/core/vec3.cuh @@ -7,6 +7,7 @@ #include #include #include +#include #include "core/cuda_utils.cuh" #include "core/constants.cuh" @@ -122,6 +123,12 @@ public: _data = make_float3(v, v, v); } + CPT_CPU_GPU_INLINE + bool numeric_err() const noexcept { + return isnan(_data.x) || isnan(_data.y) || isnan(_data.z) || \ + isinf(_data.x) || isinf(_data.y) || isinf(_data.z); + } + CPT_CPU_GPU_INLINE Vec3 normalized() const { return *this * (1.f / length()); } diff --git a/src/renderer/depth.cuh b/src/renderer/depth.cuh index 31aff8a..15f2e6a 100644 --- a/src/renderer/depth.cuh +++ b/src/renderer/depth.cuh @@ -96,7 +96,8 @@ public: CPT_CPU std::vector render( int num_iter = 64, - int max_depth = 1/* max depth, useless for depth renderer, 1 anyway */ + int max_depth = 1,/* max depth, useless for depth renderer, 1 anyway */ + bool gamma_correction = true ) override { ProfilePhase _(Prof::DepthRenderingHost); { @@ -109,7 +110,7 @@ public: CUDA_CHECK_RETURN(cudaDeviceSynchronize()); } } - return image.export_cpu(1.f / (5.f * num_iter)); + return image.export_cpu(1.f / (5.f * num_iter), gamma_correction); } }; diff --git a/src/renderer/path_tracer.cuh b/src/renderer/path_tracer.cuh index f7a7065..7477633 100644 --- a/src/renderer/path_tracer.cuh +++ b/src/renderer/path_tracer.cuh @@ -4,6 +4,7 @@ * @author: Qianyue He */ #pragma once +#include "core/progress.h" #include "core/emitter.cuh" #include "core/object.cuh" #include "renderer/tracer_base.cuh" @@ -160,42 +161,41 @@ __global__ static void render_pt_kernel( // emitter MIS emission_weight = emission_weight / (emission_weight + - objects[object_id].solid_angle_pdf(it.shading_norm, ray.d, min_dist) * hit_emitter); + objects[object_id].solid_angle_pdf(it.shading_norm, ray.d, min_dist) * hit_emitter * (b > 0)); float direct_pdf = 1; // direct_pdf is the product of light_sampling_pdf and emitter_pdf // (2) check if the ray hits an emitter - radiance += emission_weight * throughput *\ + Vec3 direct_comp = throughput *\ c_emitter[emitter_id]->eval_le(&ray.d, &it.shading_norm); + radiance += direct_comp; Emitter* emitter = sample_emitter(sampler, direct_pdf, num_emitter, emitter_id); // (3) sample a point on the emitter (we avoid sampling the hit emitter) - // printf("Num of emitters: %d, %x, %x, %x, %d\n", num_emitter, int(c_emitter[0]), int(c_emitter[1]), int(emitter), int(hit_emitter)); - emitter_id = objects[emitter->get_obj_ref()].sample_emitter_primitive(sampler.discrete1D(), direct_pdf); - // if (objects[object_id].emitter_id) - // printf("Object id: %d, sampled id: %d, emitter: %d\n", object_id, emitter_id, objects[object_id].emitter_id); Ray shadow_ray(ray.o + ray.d * min_dist, Vec3(0, 0, 0)); // use ray.o to avoid creating another shadow_int variable shadow_ray.d = emitter->sample(shadow_ray.o, ray.o, direct_pdf, sampler.next2D(), verts, norms, emitter_id) - shadow_ray.o; - float emit_length = shadow_ray.d.length(); - shadow_ray.d *= 1.f / emit_length; // normalized direction + float emit_len_mis = shadow_ray.d.length(); + shadow_ray.d *= 1.f / emit_len_mis; // normalized direction - // (3) NEE scene intersection test (possible warp divergence, but... nevermind, it seems to be ) - if (emitter != c_emitter[0] && occlusion_test(shadow_ray, objects, shapes, aabbs, *verts, num_objects, emit_length)) { + // (3) NEE scene intersection test (possible warp divergence, but... nevermind) + if (emitter != c_emitter[0] && occlusion_test(shadow_ray, objects, shapes, aabbs, *verts, num_objects, emit_len_mis)) { // MIS for BSDF / light sampling, to achieve better rendering - // accumulate direct component // 1 / (direct + ...) is mis_weight direct_pdf / (direct_pdf + material_pdf), divided by direct_pdf + emit_len_mis = direct_pdf + c_material[material_id]->pdf(it, shadow_ray.d, ray.d) * emitter->non_delta(); radiance += throughput * ray.o * c_material[material_id]->eval(it, shadow_ray.d, ray.d) * \ - (1.f / (direct_pdf + c_material[material_id]->pdf(it, shadow_ray.d, ray.d) * emitter->non_delta())); + (float(emit_len_mis > EPSILON) / select(1.f, emit_len_mis, emit_len_mis < EPSILON)); + // numerical guard, in case emit_len_mis is 0 } // step 4: sample a new ray direction, bounce the ray.o = std::move(shadow_ray.o); ray.d = c_material[material_id]->sample_dir(ray.d, it, throughput, emission_weight, sampler.next2D()); - } - // TODO: MIS for emitter + if (radiance.numeric_err()) + radiance.fill(0); + } } __syncthreads(); image(px, py) += radiance; @@ -261,23 +261,26 @@ public: CPT_CPU std::vector render( int num_iter = 64, - int max_depth = 1/* max depth, useless for depth renderer, 1 anyway */ + int max_depth = 4, + bool gamma_correction = true ) override { ProfilePhase _(Prof::PTRenderingHost); - { - ProfilePhase _p(Prof::PTRenderingDevice); TicToc _timer("render_pt_kernel()", num_iter); // TODO: stream processing for (int i = 0; i < num_iter; i++) { // for more sophisticated renderer (like path tracer), shared_memory should be used - render_pt_kernel<<> 4, h >> 4), dim3(16, 16)>>>( - obj_info, prim2obj, shapes, aabbs, verts, norms, uvs, - *dev_image, num_prims, num_objs, num_emitter, i * SEED_SCALER, max_depth - ); - CUDA_CHECK_RETURN(cudaDeviceSynchronize()); + { + ProfilePhase _p(Prof::PTRenderingDevice); + render_pt_kernel<<> 4, h >> 4), dim3(16, 16)>>>( + obj_info, prim2obj, shapes, aabbs, verts, norms, uvs, + *dev_image, num_prims, num_objs, num_emitter, i * SEED_SCALER, max_depth + ); + CUDA_CHECK_RETURN(cudaDeviceSynchronize()); + } + printProgress(i, num_iter); } - } - return image.export_cpu(1.f / num_iter); + printf("\n"); + return image.export_cpu(1.f / num_iter, gamma_correction); } }; diff --git a/src/renderer/tracer_base.cuh b/src/renderer/tracer_base.cuh index e2010f4..660badf 100644 --- a/src/renderer/tracer_base.cuh +++ b/src/renderer/tracer_base.cuh @@ -109,7 +109,8 @@ public: CPT_CPU virtual std::vector render( int num_iter = 64, - int max_depth = 1/* max depth, useless for depth renderer, 1 anyway */ + int max_depth = 1,/* max depth, useless for depth renderer, 1 anyway */ + bool gamma_correction = true ) { throw std::runtime_error("Not implemented.\n"); return {};