├── .gitignore ├── LICENSE ├── README.md ├── assets ├── map.png └── semantic.png ├── config ├── kitti360.yaml ├── maicity.yaml └── render_loop.yaml ├── dataset ├── kitti360 │ ├── generate_gt_kitti360.py │ ├── init_kitti360_pose.py │ ├── kitti360_dataset.py │ └── labels.py └── maicity │ ├── genarate_gt_maicity.py │ ├── init_maicity_pose.py │ └── maicity_dataset.py ├── eval ├── crop_intersection.py ├── crop_mesh.py ├── eval_utils.py └── evaluator.py ├── hole_mesh_generation.py ├── loop_demo.py ├── loop_demo ├── T38_2_T5.npy ├── init │ ├── cam0_to_world.txt │ ├── loam_odom.txt │ ├── loam_odom_6330_6530.txt │ ├── loam_odom_not_good.txt │ ├── timestamps.txt │ └── timestamps_sec.txt ├── pose │ ├── 10_pose_es.txt │ ├── 10_pose_gt.txt │ ├── 2_pose_es.txt │ ├── 2_pose_gt.txt │ ├── 5_pose_es.txt │ └── 5_pose_gt.txt └── timestamps_sec.txt ├── main.py ├── models ├── BaseGrid.py ├── SDFGrid.py ├── decoder.py ├── multi_cubes_orb.py └── rays.py ├── render ├── render_helper.py └── render_imgs.py ├── requirements.txt ├── third-party ├── kaolin-wisp │ ├── INSTALL.md │ ├── LICENSE │ ├── README.md │ ├── __init__.py │ ├── app │ │ ├── README.md │ │ ├── nerf │ │ │ ├── README.md │ │ │ ├── configs │ │ │ │ ├── nerf_base.yaml │ │ │ │ ├── nerf_codebook.yaml │ │ │ │ ├── nerf_hash.yaml │ │ │ │ ├── nerf_octree.yaml │ │ │ │ └── nerf_triplanar.yaml │ │ │ └── main_nerf.py │ │ └── nglod │ │ │ ├── README.md │ │ │ ├── configs │ │ │ ├── nglod_base.yaml │ │ │ ├── nglod_hash.yaml │ │ │ ├── nglod_octree.yaml │ │ │ └── nglod_triplanar.yaml │ │ │ └── main_nglod.py │ ├── ci │ │ └── gitlab_jenkins_templates │ │ │ ├── core_ci.jenkins │ │ │ ├── ubuntu_build_CI.jenkins │ │ │ └── ubuntu_test_CI.jenkins │ ├── data │ │ └── matcaps │ │ │ └── LICENSE │ ├── examples │ │ ├── latent_nerf │ │ │ ├── README.md │ │ │ ├── demo_app.py │ │ │ ├── funny_neural_field.py │ │ │ └── main_demo.py │ │ └── spc_browser │ │ │ ├── README.md │ │ │ ├── browse_spc_app.py │ │ │ ├── main_spc_browser.py │ │ │ ├── mesh2spc.py │ │ │ └── widget_spc_selector.py │ ├── requirements.txt │ ├── requirements_app.txt │ ├── setup.py │ ├── tests │ │ ├── apps │ │ │ ├── conftest.py │ │ │ ├── test_latent_nerf.py │ │ │ └── test_nerf.py │ │ ├── core │ │ │ └── test_packed_rf_tracer.py │ │ └── test_utils.py │ ├── tools │ │ └── linux │ │ │ └── Dockerfile │ └── wisp │ │ ├── README.md │ │ ├── __init__.py │ │ ├── accelstructs │ │ ├── __init__.py │ │ ├── aabb_as.py │ │ ├── base_as.py │ │ └── octree_as.py │ │ ├── app_utils.py │ │ ├── config_parser.py │ │ ├── core │ │ ├── README.md │ │ ├── __init__.py │ │ ├── channel_fn.py │ │ ├── channels.py │ │ ├── colors.py │ │ ├── primitives.py │ │ ├── rays.py │ │ ├── render_buffer.py │ │ ├── transforms.py │ │ └── wisp_module.py │ │ ├── csrc │ │ ├── bindings.cpp │ │ ├── external │ │ │ ├── mesh2sdf_kernel.cu │ │ │ ├── mesh_to_sdf.cpp │ │ │ └── mesh_to_sdf.h │ │ ├── ops │ │ │ ├── hashgrid_interpolate.cpp │ │ │ ├── hashgrid_interpolate.h │ │ │ └── hashgrid_interpolate_cuda.cu │ │ └── render │ │ │ ├── find_depth_bound.cpp │ │ │ ├── find_depth_bound.h │ │ │ └── find_depth_bound_cuda.cu │ │ ├── cuda_guard.py │ │ ├── datasets │ │ ├── __init__.py │ │ ├── formats │ │ │ ├── __init__.py │ │ │ ├── nerf_standard.py │ │ │ └── rtmv.py │ │ ├── multiview_dataset.py │ │ ├── random_view_dataset.py │ │ ├── sdf_dataset.py │ │ ├── transforms │ │ │ ├── __init__.py │ │ │ └── ray_sampler.py │ │ └── utils.py │ │ ├── framework │ │ ├── __init__.py │ │ ├── event.py │ │ └── state.py │ │ ├── gfx │ │ ├── __init__.py │ │ └── datalayers │ │ │ ├── __init__.py │ │ │ ├── aabb_datalayers.py │ │ │ ├── camera_datalayers.py │ │ │ ├── datalayers.py │ │ │ └── octree_datalayers.py │ │ ├── models │ │ ├── README.md │ │ ├── __init__.py │ │ ├── activations │ │ │ ├── __init__.py │ │ │ └── basic_activations.py │ │ ├── conditioners │ │ │ ├── __init__.py │ │ │ └── basic_conditioners.py │ │ ├── decoders │ │ │ ├── __init__.py │ │ │ └── basic_decoders.py │ │ ├── embedders │ │ │ ├── __init__.py │ │ │ └── positional_embedder.py │ │ ├── grids │ │ │ ├── __init__.py │ │ │ ├── blas_grid.py │ │ │ ├── codebook_grid.py │ │ │ ├── hash_grid.py │ │ │ ├── octree_grid.py │ │ │ └── triplanar_grid.py │ │ ├── layers.py │ │ ├── nefs │ │ │ ├── __init__.py │ │ │ ├── base_nef.py │ │ │ ├── nerf.py │ │ │ ├── neural_sdf.py │ │ │ ├── neural_sdf_tex.py │ │ │ └── spc_field.py │ │ └── pipeline.py │ │ ├── offline_renderer.py │ │ ├── ops │ │ ├── __init__.py │ │ ├── differential │ │ │ ├── __init__.py │ │ │ └── gradients.py │ │ ├── geometric.py │ │ ├── grid.py │ │ ├── image │ │ │ ├── __init__.py │ │ │ ├── io.py │ │ │ ├── metrics.py │ │ │ └── processing.py │ │ ├── mesh │ │ │ ├── __init__.py │ │ │ ├── area_weighted_distribution.py │ │ │ ├── barycentric_coordinates.py │ │ │ ├── closest_point.py │ │ │ ├── closest_tex.py │ │ │ ├── compute_sdf.py │ │ │ ├── load_obj.py │ │ │ ├── normalize.py │ │ │ ├── per_face_normals.py │ │ │ ├── point_sample.py │ │ │ ├── random_face.py │ │ │ ├── sample_near_surface.py │ │ │ ├── sample_surface.py │ │ │ ├── sample_tex.py │ │ │ └── sample_uniform.py │ │ ├── pointcloud │ │ │ ├── __init__.py │ │ │ ├── conversions.py │ │ │ └── processing.py │ │ ├── raygen │ │ │ ├── __init__.py │ │ │ └── raygen.py │ │ ├── sdf │ │ │ ├── __init__.py │ │ │ └── metrics.py │ │ ├── shaders │ │ │ ├── __init__.py │ │ │ ├── matcap.py │ │ │ └── shadow_rays.py │ │ └── spc │ │ │ ├── __init__.py │ │ │ ├── constructors.py │ │ │ ├── conversions.py │ │ │ ├── metrics.py │ │ │ ├── processing.py │ │ │ └── sampling.py │ │ ├── renderer │ │ ├── README.md │ │ ├── __init__.py │ │ ├── app │ │ │ ├── __init__.py │ │ │ ├── optimization_app.py │ │ │ └── wisp_app.py │ │ ├── core │ │ │ ├── __init__.py │ │ │ ├── api │ │ │ │ ├── __init__.py │ │ │ │ ├── base_renderer.py │ │ │ │ ├── decorators.py │ │ │ │ ├── renderers_factory.py │ │ │ │ └── scenegraph.py │ │ │ ├── control │ │ │ │ ├── __init__.py │ │ │ │ ├── camera_controller_mode.py │ │ │ │ ├── first_person.py │ │ │ │ ├── io.py │ │ │ │ ├── trackball.py │ │ │ │ └── turntable.py │ │ │ ├── render_core.py │ │ │ └── renderers │ │ │ │ ├── __init__.py │ │ │ │ ├── radiance_pipeline_renderer.py │ │ │ │ ├── sdf_pipeline_renderer.py │ │ │ │ └── spc_pipeline_renderer.py │ │ ├── gizmos │ │ │ ├── __init__.py │ │ │ ├── gizmo.py │ │ │ └── ogl │ │ │ │ ├── __init__.py │ │ │ │ ├── axis_painter.py │ │ │ │ ├── primitives_painter.py │ │ │ │ └── world_grid.py │ │ └── gui │ │ │ ├── __init__.py │ │ │ └── imgui │ │ │ ├── __init__.py │ │ │ ├── widget_cameras.py │ │ │ ├── widget_dictionary_octree_grid.py │ │ │ ├── widget_gpu_stats.py │ │ │ ├── widget_imgui.py │ │ │ ├── widget_object_transform.py │ │ │ ├── widget_octree_grid.py │ │ │ ├── widget_optimization.py │ │ │ ├── widget_property_editor.py │ │ │ ├── widget_radiance_pipeline.py │ │ │ ├── widget_radiance_pipeline_renderer.py │ │ │ ├── widget_renderer_properties.py │ │ │ ├── widget_scene_graph.py │ │ │ ├── widget_sdf_pipeline.py │ │ │ ├── widget_sdf_pipeline_renderer.py │ │ │ └── widget_triplanar_grid.py │ │ ├── tracers │ │ ├── __init__.py │ │ ├── base_tracer.py │ │ ├── packed_rf_tracer.py │ │ ├── packed_sdf_tracer.py │ │ └── packed_spc_tracer.py │ │ ├── trainers │ │ ├── README.md │ │ ├── __init__.py │ │ ├── base_trainer.py │ │ ├── multiview_trainer.py │ │ └── sdf_trainer.py │ │ └── utils │ │ ├── __init__.py │ │ ├── debug.py │ │ ├── helper_classes.py │ │ └── perf.py ├── kaolin │ ├── .dockerignore │ ├── .drone.yml │ ├── .flake8 │ ├── .readthedocs.yml │ ├── Acknowledgements.txt │ ├── CONTRIBUTING.md │ ├── COPYRIGHT │ ├── LICENSE │ ├── MANIFEST.in │ ├── README.md │ ├── ci │ │ └── gitlab_jenkins_templates │ │ │ ├── core_ci.jenkins │ │ │ ├── ubuntu_build_CI.jenkins │ │ │ ├── ubuntu_cpuonly_CI.jenkins │ │ │ ├── ubuntu_custom_build_CI.jenkins │ │ │ ├── ubuntu_test_CI.jenkins │ │ │ ├── windows_build_CI.jenkins │ │ │ └── windows_test_CI.jenkins │ ├── docs │ │ ├── Makefile │ │ ├── README.md │ │ ├── _templates │ │ │ └── layout.html │ │ ├── conf.py │ │ ├── index.rst │ │ ├── kaolin_ext.py │ │ ├── make.bat │ │ ├── modules │ │ │ ├── kaolin.io.materials.rst │ │ │ ├── kaolin.io.obj.rst │ │ │ ├── kaolin.io.rst │ │ │ ├── kaolin.io.shapenet.rst │ │ │ ├── kaolin.io.usd.rst │ │ │ ├── kaolin.metrics.rst │ │ │ ├── kaolin.metrics.tetmesh.rst │ │ │ ├── kaolin.ops.batch.rst │ │ │ ├── kaolin.ops.conversions.rst │ │ │ ├── kaolin.ops.mesh.rst │ │ │ ├── kaolin.ops.rst │ │ │ ├── kaolin.ops.spc.rst │ │ │ ├── kaolin.render.camera.camera.rst │ │ │ ├── kaolin.render.camera.camera_extrinsics.rst │ │ │ ├── kaolin.render.camera.camera_intrinsics.rst │ │ │ ├── kaolin.render.camera.extrinsics_rep.rst │ │ │ ├── kaolin.render.camera.orthographic_intrinsics.rst │ │ │ ├── kaolin.render.camera.pinhole_intrinsics.rst │ │ │ ├── kaolin.render.camera.rst │ │ │ ├── kaolin.render.rst │ │ │ ├── kaolin.render.spc.rst │ │ │ ├── kaolin.utils.rst │ │ │ ├── kaolin.visualize.rst │ │ │ ├── module.rst_t │ │ │ ├── package.rst_t │ │ │ └── toc.rst_t │ │ ├── notes │ │ │ ├── checkpoints.rst │ │ │ ├── diff_render.rst │ │ │ ├── installation.rst │ │ │ ├── overview.rst │ │ │ ├── spc_summary.rst │ │ │ └── tutorial_index.rst │ │ └── readthedocs_requirements.txt │ ├── examples │ │ ├── recipes │ │ │ ├── README.md │ │ │ ├── camera │ │ │ │ ├── camera_coordinate_systems.py │ │ │ │ ├── camera_init_explicit.py │ │ │ │ ├── camera_init_simple.py │ │ │ │ ├── camera_movement.py │ │ │ │ ├── camera_opengl_shaders.py │ │ │ │ ├── camera_properties.py │ │ │ │ ├── camera_ray_tracing.py │ │ │ │ ├── camera_transforms.py │ │ │ │ └── cameras_differentiable.py │ │ │ ├── dataload │ │ │ │ └── spc_from_pointcloud.py │ │ │ ├── preprocess │ │ │ │ ├── fast_mesh_sampling.py │ │ │ │ └── occupancy_sampling.py │ │ │ └── spc │ │ │ │ ├── spc_basics.py │ │ │ │ ├── spc_conv3d_example.py │ │ │ │ ├── spc_dual_octree.py │ │ │ │ └── spc_trilinear_interp.py │ │ ├── samples │ │ │ ├── 128_tets_0.npz │ │ │ ├── 128_tets_1.npz │ │ │ ├── 128_tets_2.npz │ │ │ ├── 128_tets_3.npz │ │ │ ├── 128_verts.npz │ │ │ ├── bbox.mtl │ │ │ ├── bear_pointcloud.usd │ │ │ ├── colored_sphere.obj.mtl │ │ │ └── rendered_clock.zip │ │ └── tutorial │ │ │ ├── bbox_tutorial.ipynb │ │ │ ├── camera_and_rasterization.ipynb │ │ │ ├── dibr_tutorial.ipynb │ │ │ ├── dmtet_network.py │ │ │ ├── dmtet_tutorial.ipynb │ │ │ ├── spc_formatting.py │ │ │ ├── understanding_spcs_tutorial.ipynb │ │ │ ├── usd_kitchenset.py │ │ │ └── visualize_main.py │ ├── kaolin │ │ ├── __init__.py │ │ ├── csrc │ │ │ ├── 2d_math.cuh │ │ │ ├── 3d_math.cuh │ │ │ ├── bindings.cpp │ │ │ ├── check.h │ │ │ ├── metrics │ │ │ │ ├── sided_distance.cpp │ │ │ │ ├── sided_distance.h │ │ │ │ ├── sided_distance_cuda.cu │ │ │ │ ├── unbatched_triangle_distance.cpp │ │ │ │ ├── unbatched_triangle_distance.h │ │ │ │ └── unbatched_triangle_distance_cuda.cu │ │ │ ├── ops │ │ │ │ ├── conversions │ │ │ │ │ ├── mesh_to_spc │ │ │ │ │ │ ├── mesh_to_spc.cpp │ │ │ │ │ │ ├── mesh_to_spc.h │ │ │ │ │ │ └── mesh_to_spc_cuda.cu │ │ │ │ │ └── unbatched_mcube │ │ │ │ │ │ ├── defines.h │ │ │ │ │ │ ├── helper_math.h │ │ │ │ │ │ ├── tables.h │ │ │ │ │ │ ├── unbatched_mcube.cpp │ │ │ │ │ │ ├── unbatched_mcube.h │ │ │ │ │ │ └── unbatched_mcube_cuda.cu │ │ │ │ ├── mesh │ │ │ │ │ ├── mesh_intersection.cpp │ │ │ │ │ ├── mesh_intersection.h │ │ │ │ │ └── mesh_intersection_cuda.cu │ │ │ │ ├── packed_simple_sum.cpp │ │ │ │ ├── packed_simple_sum.h │ │ │ │ ├── packed_simple_sum_cuda.cu │ │ │ │ ├── spc │ │ │ │ │ ├── convolution.cpp │ │ │ │ │ ├── convolution.cuh │ │ │ │ │ ├── convolution_cuda.cu │ │ │ │ │ ├── feature_grids.cpp │ │ │ │ │ ├── feature_grids.h │ │ │ │ │ ├── feature_grids_cuda.cu │ │ │ │ │ ├── generate_points.cu │ │ │ │ │ ├── minkowski_conv.cu │ │ │ │ │ ├── point_utils.cpp │ │ │ │ │ ├── point_utils.h │ │ │ │ │ ├── point_utils_cuda.cu │ │ │ │ │ ├── query.cpp │ │ │ │ │ ├── query.h │ │ │ │ │ ├── query_cuda.cu │ │ │ │ │ ├── scan_octrees.cu │ │ │ │ │ ├── spc.cpp │ │ │ │ │ └── spc.h │ │ │ │ ├── tile_to_packed.cpp │ │ │ │ ├── tile_to_packed.h │ │ │ │ └── tile_to_packed_cuda.cu │ │ │ ├── packed_base.cuh │ │ │ ├── render │ │ │ │ ├── mesh │ │ │ │ │ ├── deftet.cpp │ │ │ │ │ ├── deftet.h │ │ │ │ │ ├── deftet_cuda.cu │ │ │ │ │ ├── dibr_soft_mask.cpp │ │ │ │ │ ├── dibr_soft_mask.h │ │ │ │ │ ├── dibr_soft_mask_cuda.cu │ │ │ │ │ ├── rasterization.cpp │ │ │ │ │ ├── rasterization.h │ │ │ │ │ └── rasterization_cuda.cu │ │ │ │ └── spc │ │ │ │ │ ├── raytrace.cpp │ │ │ │ │ ├── raytrace.h │ │ │ │ │ ├── raytrace_cuda.cu │ │ │ │ │ └── spc_render_utils.cuh │ │ │ ├── smooth_sampler │ │ │ │ ├── smooth_sampler.h │ │ │ │ ├── smooth_sampler2.cpp │ │ │ │ └── smooth_sampler_kernel.cu │ │ │ ├── spc_math.h │ │ │ ├── spc_utils.cuh │ │ │ └── utils.h │ │ ├── cython │ │ │ └── ops │ │ │ │ ├── conversions │ │ │ │ ├── mise.cpp │ │ │ │ └── mise.pyx │ │ │ │ └── mesh │ │ │ │ ├── triangle_hash.cpp │ │ │ │ └── triangle_hash.pyx │ │ ├── experimental │ │ │ └── dash3d │ │ │ │ ├── Makefile │ │ │ │ ├── README.md │ │ │ │ ├── __init__.py │ │ │ │ ├── kaolin-dash3d │ │ │ │ ├── run.py │ │ │ │ ├── src │ │ │ │ ├── controller.js │ │ │ │ ├── copyright.js │ │ │ │ ├── geometry.js │ │ │ │ ├── render.js │ │ │ │ ├── style.css │ │ │ │ ├── test_util.js │ │ │ │ └── util.js │ │ │ │ ├── static │ │ │ │ ├── core-min.js │ │ │ │ ├── favicon.ico │ │ │ │ ├── green_plastic.frag │ │ │ │ ├── style.css │ │ │ │ ├── thirdparty.css │ │ │ │ └── thirdparty.js │ │ │ │ ├── templates │ │ │ │ ├── home.html │ │ │ │ ├── render_card.html │ │ │ │ ├── render_row.html │ │ │ │ └── view_settings.html │ │ │ │ └── util.py │ │ ├── io │ │ │ ├── __init__.py │ │ │ ├── dataset.py │ │ │ ├── materials.py │ │ │ ├── modelnet.py │ │ │ ├── obj.py │ │ │ ├── off.py │ │ │ ├── render.py │ │ │ ├── shapenet.py │ │ │ ├── shrec.py │ │ │ ├── usd.py │ │ │ └── utils.py │ │ ├── metrics │ │ │ ├── __init__.py │ │ │ ├── pointcloud.py │ │ │ ├── render.py │ │ │ ├── tetmesh.py │ │ │ ├── trianglemesh.py │ │ │ └── voxelgrid.py │ │ ├── ops │ │ │ ├── __init__.py │ │ │ ├── batch.py │ │ │ ├── conversions │ │ │ │ ├── __init__.py │ │ │ │ ├── pointcloud.py │ │ │ │ ├── sdf.py │ │ │ │ ├── tetmesh.py │ │ │ │ ├── trianglemesh.py │ │ │ │ └── voxelgrid.py │ │ │ ├── coords.py │ │ │ ├── gcn.py │ │ │ ├── mesh │ │ │ │ ├── __init__.py │ │ │ │ ├── check_sign.py │ │ │ │ ├── mesh.py │ │ │ │ ├── tetmesh.py │ │ │ │ └── trianglemesh.py │ │ │ ├── random.py │ │ │ ├── reduction.py │ │ │ ├── spc │ │ │ │ ├── __init__.py │ │ │ │ ├── convolution.py │ │ │ │ ├── points.py │ │ │ │ ├── spc.py │ │ │ │ └── uint8.py │ │ │ └── voxelgrid.py │ │ ├── render │ │ │ ├── __init__.py │ │ │ ├── camera │ │ │ │ ├── __init__.py │ │ │ │ ├── camera.py │ │ │ │ ├── coordinates.py │ │ │ │ ├── extrinsics.py │ │ │ │ ├── extrinsics_backends.py │ │ │ │ ├── intrinsics.py │ │ │ │ ├── intrinsics_ortho.py │ │ │ │ ├── intrinsics_pinhole.py │ │ │ │ └── legacy.py │ │ │ ├── mesh │ │ │ │ ├── __init__.py │ │ │ │ ├── deftet.py │ │ │ │ ├── dibr.py │ │ │ │ ├── rasterization.py │ │ │ │ └── utils.py │ │ │ └── spc │ │ │ │ ├── __init__.py │ │ │ │ └── raytrace.py │ │ ├── rep │ │ │ ├── __init__.py │ │ │ └── spc.py │ │ ├── utils │ │ │ ├── __init__.py │ │ │ └── testing.py │ │ ├── version.py │ │ └── visualize │ │ │ ├── __init__.py │ │ │ └── timelapse.py │ ├── package-lock.json │ ├── package.json │ ├── setup.py │ ├── tests │ │ ├── integration │ │ │ └── experimental │ │ │ │ └── dash3d │ │ │ │ ├── .gitignore │ │ │ │ ├── README.md │ │ │ │ ├── cypress.json │ │ │ │ ├── cypress │ │ │ │ ├── integration │ │ │ │ │ └── visual_regression.js │ │ │ │ ├── plugins │ │ │ │ │ └── index.js │ │ │ │ └── support │ │ │ │ │ ├── commands.js │ │ │ │ │ └── index.js │ │ │ │ ├── run_e2e_test.py │ │ │ │ ├── start_dash3d.sh │ │ │ │ ├── test_binary_parse.js │ │ │ │ └── test_client_server_io.py │ │ ├── python │ │ │ ├── examples │ │ │ │ └── tutorial │ │ │ │ │ ├── test_usd_kitchenset.py │ │ │ │ │ └── test_visualize_main.py │ │ │ └── kaolin │ │ │ │ ├── io │ │ │ │ ├── test_dataset.py │ │ │ │ ├── test_materials.py │ │ │ │ ├── test_modelnet.py │ │ │ │ ├── test_obj.py │ │ │ │ ├── test_off.py │ │ │ │ ├── test_render.py │ │ │ │ ├── test_shapenet.py │ │ │ │ ├── test_shrec.py │ │ │ │ └── test_usd.py │ │ │ │ ├── metrics │ │ │ │ ├── __init__.py │ │ │ │ ├── test_pointcloud.py │ │ │ │ ├── test_render.py │ │ │ │ ├── test_tetmesh.py │ │ │ │ ├── test_trianglemesh.py │ │ │ │ └── test_voxelgrid.py │ │ │ │ ├── ops │ │ │ │ ├── conversions │ │ │ │ │ ├── __init__.py │ │ │ │ │ ├── test_pointcloud.py │ │ │ │ │ ├── test_sdf.py │ │ │ │ │ ├── test_tetmesh.py │ │ │ │ │ ├── test_trianglemesh.py │ │ │ │ │ └── test_voxelgrid.py │ │ │ │ ├── mesh │ │ │ │ │ ├── test_check_sign.py │ │ │ │ │ ├── test_mesh.py │ │ │ │ │ └── test_tetmesh.py │ │ │ │ ├── spc │ │ │ │ │ ├── test_conv.py │ │ │ │ │ ├── test_points.py │ │ │ │ │ ├── test_spc.py │ │ │ │ │ └── test_uint8.py │ │ │ │ ├── test_batch.py │ │ │ │ ├── test_coords.py │ │ │ │ ├── test_gcn.py │ │ │ │ ├── test_random.py │ │ │ │ ├── test_reduction.py │ │ │ │ └── test_voxelgrid.py │ │ │ │ ├── render │ │ │ │ ├── camera │ │ │ │ │ ├── test_extrinsics.py │ │ │ │ │ └── test_transform.py │ │ │ │ ├── mesh │ │ │ │ │ ├── test_deftet.py │ │ │ │ │ ├── test_dibr.py │ │ │ │ │ ├── test_rasterization.py │ │ │ │ │ └── test_utils.py │ │ │ │ ├── spc │ │ │ │ │ ├── test_rayops.py │ │ │ │ │ └── test_raytrace.py │ │ │ │ └── test_camera.py │ │ │ │ ├── rep │ │ │ │ └── test_rep_spc.py │ │ │ │ ├── utils │ │ │ │ └── test_testing.py │ │ │ │ └── visualize │ │ │ │ └── test_timelapse.py │ │ └── samples │ │ │ ├── dibr │ │ │ ├── simple │ │ │ │ ├── close_face_dist_35_31_7000_0.02.pt │ │ │ │ ├── close_face_dist_35_31_7000_0.2.pt │ │ │ │ ├── close_face_dist_35_31_70_0.02.pt │ │ │ │ ├── close_face_dist_35_31_70_0.2.pt │ │ │ │ ├── close_face_dist_type_35_31_7000_0.02.pt │ │ │ │ ├── close_face_dist_type_35_31_7000_0.2.pt │ │ │ │ ├── close_face_dist_type_35_31_70_0.02.pt │ │ │ │ ├── close_face_dist_type_35_31_70_0.2.pt │ │ │ │ ├── close_face_idx_35_31_7000_0.02.pt │ │ │ │ ├── close_face_idx_35_31_7000_0.2.pt │ │ │ │ ├── close_face_idx_35_31_70_0.02.pt │ │ │ │ ├── close_face_idx_35_31_70_0.2.pt │ │ │ │ ├── grad_face_vertices_image_35_31_7000_0.02.pt │ │ │ │ ├── grad_face_vertices_image_35_31_7000_0.2.pt │ │ │ │ ├── grad_face_vertices_image_35_31_70_0.02.pt │ │ │ │ ├── grad_face_vertices_image_35_31_70_0.2.pt │ │ │ │ ├── new_face_idx_35_31.pt │ │ │ │ ├── soft_mask_35_31_7000_0.02.pt │ │ │ │ ├── soft_mask_35_31_7000_0.2.pt │ │ │ │ ├── soft_mask_35_31_70_0.02.pt │ │ │ │ └── soft_mask_35_31_70_0.2.pt │ │ │ └── sphere │ │ │ │ ├── close_face_dist_35_31_7000_0.01.pt │ │ │ │ ├── close_face_dist_35_31_7000_0.02.pt │ │ │ │ ├── close_face_dist_35_31_70_0.01.pt │ │ │ │ ├── close_face_dist_35_31_70_0.02.pt │ │ │ │ ├── close_face_dist_type_35_31_7000_0.01.pt │ │ │ │ ├── close_face_dist_type_35_31_7000_0.02.pt │ │ │ │ ├── close_face_dist_type_35_31_70_0.01.pt │ │ │ │ ├── close_face_dist_type_35_31_70_0.02.pt │ │ │ │ ├── close_face_idx_35_31_7000_0.01.pt │ │ │ │ ├── close_face_idx_35_31_7000_0.02.pt │ │ │ │ ├── close_face_idx_35_31_70_0.01.pt │ │ │ │ ├── close_face_idx_35_31_70_0.02.pt │ │ │ │ ├── grad_face_vertices_image_35_31_7000_0.01.pt │ │ │ │ ├── grad_face_vertices_image_35_31_7000_0.02.pt │ │ │ │ ├── grad_face_vertices_image_35_31_70_0.01.pt │ │ │ │ ├── grad_face_vertices_image_35_31_70_0.02.pt │ │ │ │ ├── soft_mask_35_31_7000_0.01.pt │ │ │ │ ├── soft_mask_35_31_7000_0.02.pt │ │ │ │ ├── soft_mask_35_31_70_0.01.pt │ │ │ │ └── soft_mask_35_31_70_0.02.pt │ │ │ ├── golden │ │ │ ├── mesh.usda │ │ │ ├── pbr_material_textures.usda │ │ │ ├── pbr_material_values.usda │ │ │ ├── pointcloud.usda │ │ │ ├── pointcloud_GeomPoints.usda │ │ │ ├── pointcloud_GeomPoints_colors.usda │ │ │ ├── pointcloud_PointInstancer.usda │ │ │ ├── rocket_homogenized.usda │ │ │ ├── rocket_homogenized_materials.usda │ │ │ └── voxelgrid.usda │ │ │ ├── model.mtl │ │ │ ├── model.usd │ │ │ ├── rocket_hetero.usd │ │ │ ├── rocket_hetero_subsets_materials.usd │ │ │ ├── rocket_pointcloud.v0.9.0.usda │ │ │ ├── rocket_pointcloud_GeomPoints.usda │ │ │ ├── simple_obj │ │ │ └── model.mtl │ │ │ ├── simple_off │ │ │ └── model.off │ │ │ ├── synthetic │ │ │ ├── 0_depth_linear.npy │ │ │ ├── 0_instance.npy │ │ │ ├── 0_metadata.json │ │ │ └── 0_semantic.npy │ │ │ └── timelapse │ │ │ └── notexture │ │ │ ├── ground_truth │ │ │ ├── mesh_0.usd │ │ │ └── mesh_1.usd │ │ │ ├── input │ │ │ ├── pointcloud_0.usd │ │ │ └── pointcloud_1.usd │ │ │ └── output │ │ │ ├── mesh_0.usd │ │ │ ├── mesh_1.usd │ │ │ ├── pointcloud_0.usd │ │ │ ├── pointcloud_1.usd │ │ │ ├── voxelgrid_0.usd │ │ │ └── voxelgrid_1.usd │ ├── tools │ │ ├── check_torchlibs_versions.py │ │ ├── ci_requirements.txt │ │ ├── doc_requirements.txt │ │ ├── fixNvPe.py │ │ ├── get_torchvision_ver.sh │ │ ├── linux │ │ │ ├── Dockerfile.base │ │ │ ├── Dockerfile.base_cpuonly │ │ │ ├── Dockerfile.install │ │ │ └── Dockerfile.install_wheel │ │ ├── requirements.txt │ │ └── windows │ │ │ ├── Dockerfile │ │ │ ├── SetupDriver.ps1 │ │ │ ├── Test.ps1 │ │ │ ├── bandwidthTest.exe │ │ │ ├── deviceQuery.exe │ │ │ └── main.ps1 │ └── version.txt └── setup.sh ├── tools ├── __init__.py ├── draw_line.py ├── draw_pose.py ├── extract_mesh.py └── prepare_data │ └── generate_voxel.py ├── train.py └── utils ├── loop ├── ICP.py ├── PoseGraphManager.py ├── ScanContextManager.py ├── UtilsMisc.py └── UtilsPointcloud.py ├── mesh_utils.py ├── qury_pose.py └── scannet_data_tools ├── depth2point3D.py ├── kitti360Viewer.py ├── kitti360Viewer3D.py ├── kitti360Viewer3DRaw.py └── write_evo_data.py /.gitignore: -------------------------------------------------------------------------------- 1 | # Byte-compiled / optimized / DLL files 2 | __pycache__/ 3 | logs/ 4 | 5 | 6 | # ignore all image files 7 | *.png 8 | *.jpg 9 | *.jpeg 10 | *.gif 11 | *.mov 12 | *.mp4 13 | # ignore all model files 14 | *.pth 15 | 16 | # ignore all 3d point cloud and mesh files 17 | *.ply 18 | *.pcd 19 | *.bin 20 | *.obj 21 | *.stl 22 | 23 | # C extensions 24 | *.so 25 | 26 | # Distribution / packaging 27 | .Python 28 | build/ 29 | develop-eggs/ 30 | dist/ 31 | downloads/ 32 | eggs/ 33 | .eggs/ 34 | lib/ 35 | lib64/ 36 | parts/ 37 | sdist/ 38 | var/ 39 | wheels/ 40 | share/python-wheels/ 41 | *.egg-info/ 42 | *.pyc 43 | .installed.cfg 44 | *.egg 45 | MANIFEST 46 | 47 | # Installer logs 48 | pip-log.txt 49 | pip-delete-this-directory.txt 50 | 51 | # Jupyter Notebook 52 | .ipynb_checkpoints 53 | 54 | # Environments 55 | .env 56 | .venv 57 | env/ 58 | venv/ 59 | ENV/ 60 | env.bak/ 61 | venv.bak/ 62 | 63 | # Cython debug symbols 64 | cython_debug/ 65 | 66 | .devcontainer 67 | .vscode 68 | -------------------------------------------------------------------------------- /assets/map.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yuxuan1206/NF-Atlas/b7fc99fe752222f3c7f1b969f30f0dd01d7abe81/assets/map.png -------------------------------------------------------------------------------- /assets/semantic.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yuxuan1206/NF-Atlas/b7fc99fe752222f3c7f1b969f30f0dd01d7abe81/assets/semantic.png -------------------------------------------------------------------------------- /eval/crop_intersection.py: -------------------------------------------------------------------------------- 1 | from eval_utils import crop_intersection 2 | 3 | # This file presents an example to crop the ground truth point cloud to the intersection part of all 4 | # the compared method's mesh reconstruction 5 | 6 | gt_pcd_path = "xxx/mai_city/01/gt_map_pc_mai.ply" 7 | 8 | pred_vdb_path = "xxx/mai_city/01/baseline/vdb_fusion/mesh_vdb_10cm.ply" 9 | 10 | pred_puma_path = "xxx/mai_city/01/baseline/puma/mesh_puma_l10.ply" 11 | 12 | pred_voxblox_path = "xxx/mai_city/01/baseline/voxblox/mesh_voxblox_10cm.ply" 13 | 14 | pred_shine_path = "xxx/mai_city/01/mesh_shine_10cm.ply" 15 | 16 | preds_path = [pred_vdb_path, pred_puma_path, pred_voxblox_path, pred_shine_path] 17 | 18 | crop_gt_pcd_path = "xxx/mai_city/01/gt_map_pc_mai_crop_intersection.ply" 19 | 20 | crop_intersection(gt_pcd_path, preds_path, crop_gt_pcd_path, dist_thre=0.2) -------------------------------------------------------------------------------- /eval/crop_mesh.py: -------------------------------------------------------------------------------- 1 | import open3d as o3d 2 | import numpy as np 3 | import torch 4 | import os 5 | os.environ["CUDA_VISIBLE_DEVICES"] = "1" 6 | from lietorch import SE3 7 | # PATH = "/home/yx/Project/voxblox_ws/src/voxblox/voxblox_ros/mesh_results" #voxblox 8 | 9 | 10 | # pointscloud = o3d.io.read_point_cloud(os.path.join(PATH,"kitti360.ply")) 11 | pointscloud = o3d.io.read_point_cloud("eval/kitti360.ply") 12 | world_points = np.array(pointscloud.points) 13 | # change frame 14 | poses = np.loadtxt("01_loam_map_init/pose/2_pose_es.txt") 15 | T1 = poses[0,1:] 16 | R = SE3(torch.FloatTensor(T1).cuda()) 17 | 18 | world_points = torch.FloatTensor(world_points).cuda() @ R.matrix()[:3,:3].T + R.matrix()[:3,3] 19 | 20 | # mask = np.logical_and(world_points[:,1]>-7.5, world_points[:,1]<7.5) 21 | # world_points = world_points[mask] 22 | # mask = np.logical_and(world_points[:,0]>-5, world_points[:,0]<100) 23 | # world_points = world_points[mask] 24 | # mask = world_points[:,2]<0.6 25 | # world_points = world_points[mask] 26 | 27 | points_o3d = o3d.geometry.PointCloud() 28 | points_o3d.points = o3d.utility.Vector3dVector(world_points.cpu().numpy()) 29 | o3d.io.write_point_cloud("eval/kitti360_crop.ply", points_o3d) -------------------------------------------------------------------------------- /loop_demo/T38_2_T5.npy: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yuxuan1206/NF-Atlas/b7fc99fe752222f3c7f1b969f30f0dd01d7abe81/loop_demo/T38_2_T5.npy -------------------------------------------------------------------------------- /models/BaseGrid.py: -------------------------------------------------------------------------------- 1 | 2 | import torch 3 | import torch.nn 4 | from torch.nn import functional as F 5 | from torch.autograd import Variable 6 | import numpy as np 7 | 8 | from .rays import * 9 | import os 10 | 11 | class BaseGrid: 12 | def __init__(self, device, config): 13 | super(BaseGrid, self).__init__() 14 | self.device = device 15 | 16 | # self.N_sample = config['params']['N_sample'] 17 | # self.near, self.far = config['params']['near'], config['params']['far'] 18 | self.grid_resolution = config['params']['grid_resolution'] 19 | self.important_sample = 1 20 | self.is_optim_depth = False 21 | self.is_optim_rgb = False 22 | 23 | def set_optim_flag(self, is_optim_depth, is_optim_rgb): 24 | self.is_optim_depth = is_optim_depth 25 | self.is_optim_rgb = is_optim_rgb 26 | 27 | def set_important_sample(self, flag): 28 | self.important_sample = flag 29 | 30 | def load_trans(self, path): 31 | self.trans_world_to_scale = torch.FloatTensor(np.loadtxt(path)).to(self.device) 32 | -------------------------------------------------------------------------------- /requirements.txt: -------------------------------------------------------------------------------- 1 | scipy 2 | pyyaml 3 | opencv-python==3.4.8.29 4 | open3d -i https://pypi.tuna.tsinghua.edu.cn/simple 5 | Cython 6 | pillow==9.3.0 7 | polyscope 8 | pytorch3d -------------------------------------------------------------------------------- /third-party/kaolin-wisp/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yuxuan1206/NF-Atlas/b7fc99fe752222f3c7f1b969f30f0dd01d7abe81/third-party/kaolin-wisp/__init__.py -------------------------------------------------------------------------------- /third-party/kaolin-wisp/app/README.md: -------------------------------------------------------------------------------- 1 | # Wisp Applications 2 | 3 | Main Script 4 | 5 | The `app` folder contains various apps built with Wisp building blocks. 6 | 7 | Each app includes its own set of argument definitions, configs, README file and where needed, also a `requirements.txt` for installing additional packages. 8 | 9 | Users are welcome to extend & modify these apps, as well as use them as a guidance for using Wisp. 10 | 11 | ## External Contributions 12 | 13 | Contributions are welcome! 14 | 15 | Have you built a useful app with Wisp? Message us or leave a PR: 16 | * Apps with their own dedicated repo will be linked from the main page. 17 | * Alternatively, you're welcome to submit a PR to add your app under this folder. 18 | 19 | ## Interactive Renderer v.s. HEADLESS mode 20 | Where possible, Wisp apps support both interactive and headless mode by modifying the `$WISP_HEADLESS` env variable 21 | (where `$WISP_HEADLESS=1` turns off the interactive renderer). 22 | 23 | Note the synergy of the various components: 24 | * Apps should always implement a `main_x.py` script. 25 | * Interactive apps are likely to generate an instance of a `WispApp` subclass. 26 | * `WispApp` can communicate with Trainers and other components via the `WispState` object. This 27 | maintains a clear separation of the gui logic and core code. 28 | -------------------------------------------------------------------------------- /third-party/kaolin-wisp/app/nerf/configs/nerf_base.yaml: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2022, NVIDIA CORPORATION & AFFILIATES. All rights reserved. 2 | # 3 | # NVIDIA CORPORATION & AFFILIATES and its licensors retain all intellectual property 4 | # and proprietary rights in and to this software, related documentation 5 | # and any modifications thereto. Any use, reproduction, disclosure or 6 | # distribution of this software and related documentation without an express 7 | # license agreement from NVIDIA CORPORATION & AFFILIATES is strictly prohibited. 8 | 9 | logging: 10 | exp_name: 'test-nerf' 11 | 12 | dataset: 13 | multiview_dataset_format: 'standard' 14 | num_rays_sampled_per_img: 4096 15 | mip: 2 16 | bg_color: 'white' 17 | 18 | nef: 19 | hidden_dim: 64 20 | num_layers: 1 21 | pos_embedder: 'none' 22 | position_input: False 23 | view_embedder: 'positional' 24 | view_multires: 4 25 | 26 | tracer: 27 | raymarch_type: 'ray' 28 | num_steps: 1024 29 | 30 | optimizer: 31 | optimizer_type: 'rmsprop' 32 | lr: 0.001 33 | 34 | trainer: 35 | epochs: 50 36 | batch_size: 1 37 | model_format: 'full' # If loading a pretrained pipeline, 'full' = torch.load instead of torch.load_state_dict 38 | valid_every: 50 39 | save_every: 10 40 | render_tb_every: 10 41 | 42 | # NOTE: These are OfflineRenderer definitions, used for validation. See WispState for interactive app definitions. 43 | renderer: 44 | render_batch: 4000 45 | camera_origin: 46 | - -3.0 47 | - 0.65 48 | - -3.0 49 | render_res: 50 | - 1024 51 | - 1024 -------------------------------------------------------------------------------- /third-party/kaolin-wisp/app/nerf/configs/nerf_codebook.yaml: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2022, NVIDIA CORPORATION & AFFILIATES. All rights reserved. 2 | # 3 | # NVIDIA CORPORATION & AFFILIATES and its licensors retain all intellectual property 4 | # and proprietary rights in and to this software, related documentation 5 | # and any modifications thereto. Any use, reproduction, disclosure or 6 | # distribution of this software and related documentation without an express 7 | # license agreement from NVIDIA CORPORATION & AFFILIATES is strictly prohibited. 8 | 9 | parent: 'nerf_base.yaml' 10 | 11 | grid: 12 | grid_type: 'CodebookOctreeGrid' 13 | interpolation_type: 'linear' 14 | multiscale_type: 'sum' 15 | feature_dim: 5 16 | feature_std: 0.01 17 | feature_bias: 0.0 18 | base_lod: 5 19 | num_lods: 4 20 | codebook_bitwidth: 4 21 | -------------------------------------------------------------------------------- /third-party/kaolin-wisp/app/nerf/configs/nerf_hash.yaml: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2022, NVIDIA CORPORATION & AFFILIATES. All rights reserved. 2 | # 3 | # NVIDIA CORPORATION & AFFILIATES and its licensors retain all intellectual property 4 | # and proprietary rights in and to this software, related documentation 5 | # and any modifications thereto. Any use, reproduction, disclosure or 6 | # distribution of this software and related documentation without an express 7 | # license agreement from NVIDIA CORPORATION & AFFILIATES is strictly prohibited. 8 | 9 | parent: 'nerf_base.yaml' 10 | 11 | grid: 12 | grid_type: 'HashGrid' 13 | interpolation_type: 'linear' 14 | multiscale_type: 'cat' 15 | feature_dim: 2 16 | feature_std: 0.01 17 | feature_bias: 0.0 18 | num_lods: 16 19 | codebook_bitwidth: 19 20 | tree_type: 'geometric' 21 | min_grid_res: 16 22 | max_grid_res: 2048 23 | blas_level: 7 24 | 25 | trainer: 26 | prune_every: 100 # iterations -------------------------------------------------------------------------------- /third-party/kaolin-wisp/app/nerf/configs/nerf_octree.yaml: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2022, NVIDIA CORPORATION & AFFILIATES. All rights reserved. 2 | # 3 | # NVIDIA CORPORATION & AFFILIATES and its licensors retain all intellectual property 4 | # and proprietary rights in and to this software, related documentation 5 | # and any modifications thereto. Any use, reproduction, disclosure or 6 | # distribution of this software and related documentation without an express 7 | # license agreement from NVIDIA CORPORATION & AFFILIATES is strictly prohibited. 8 | 9 | parent: 'nerf_base.yaml' 10 | 11 | grid: 12 | grid_type: 'OctreeGrid' 13 | interpolation_type: 'linear' 14 | multiscale_type: 'sum' 15 | feature_dim: 5 16 | feature_std: 0.01 17 | feature_bias: 0.0 18 | base_lod: 5 19 | num_lods: 4 20 | -------------------------------------------------------------------------------- /third-party/kaolin-wisp/app/nerf/configs/nerf_triplanar.yaml: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2022, NVIDIA CORPORATION & AFFILIATES. All rights reserved. 2 | # 3 | # NVIDIA CORPORATION & AFFILIATES and its licensors retain all intellectual property 4 | # and proprietary rights in and to this software, related documentation 5 | # and any modifications thereto. Any use, reproduction, disclosure or 6 | # distribution of this software and related documentation without an express 7 | # license agreement from NVIDIA CORPORATION & AFFILIATES is strictly prohibited. 8 | 9 | parent: 'nerf_base.yaml' 10 | 11 | grid: 12 | grid_type: 'TriplanarGrid' 13 | interpolation_type: 'linear' 14 | multiscale_type: 'sum' 15 | feature_dim: 4 16 | feature_std: 0.01 17 | feature_bias: 0.0 18 | base_lod: 5 19 | num_lods: 4 20 | 21 | tracer: 22 | raymarch_type: 'voxel' # Samples within the triplanar volume (e.g. AABB) 23 | num_steps: 512 -------------------------------------------------------------------------------- /third-party/kaolin-wisp/app/nglod/configs/nglod_base.yaml: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2022, NVIDIA CORPORATION & AFFILIATES. All rights reserved. 2 | # 3 | # NVIDIA CORPORATION & AFFILIATES and its licensors retain all intellectual property 4 | # and proprietary rights in and to this software, related documentation 5 | # and any modifications thereto. Any use, reproduction, disclosure or 6 | # distribution of this software and related documentation without an express 7 | # license agreement from NVIDIA CORPORATION & AFFILIATES is strictly prohibited. 8 | 9 | logging: 10 | exp_name: 'test-nglod-sdf' 11 | 12 | dataset: 13 | num_samples: 500000 # Number of samples held in dataset during training 14 | samples_per_voxel: 32 15 | 16 | nef: 17 | hidden_dim: 128 18 | num_layers: 1 19 | pos_embedder: 'none' 20 | position_input: True 21 | 22 | optimizer: 23 | optimizer_type: 'adam' 24 | eps: 1.0e-15 25 | lr: 0.001 26 | grid_lr_weight: 1.0 27 | 28 | trainer: 29 | epochs: 10 30 | batch_size: 512 31 | model_format: 'full' # If loading a pretrained pipeline, 'full' = torch.load instead of torch.load_state_dict 32 | valid_every: 10 33 | save_every: 5 34 | render_tb_every: 5 35 | log_2d: True 36 | only_last: True # Train only last LOD 37 | resample: True 38 | 39 | # Sphere Tracer is employed during inference only 40 | tracer: 41 | num_steps: 128 42 | step_size: 0.8 43 | 44 | # NOTE: These are OfflineRenderer definitions, used for validation. See WispState for interactive app definitions. 45 | renderer: 46 | render_batch: 0 47 | camera_origin: 48 | - -2.8 49 | - 2.3 50 | - -2.8 51 | shading_mode: 'matcap' # TODO (operel): For the time being, matcaps appear in offline renderings only (TBD) 52 | render_res: 53 | - 1024 54 | - 1024 55 | shadow: True 56 | -------------------------------------------------------------------------------- /third-party/kaolin-wisp/app/nglod/configs/nglod_hash.yaml: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2022, NVIDIA CORPORATION & AFFILIATES. All rights reserved. 2 | # 3 | # NVIDIA CORPORATION & AFFILIATES and its licensors retain all intellectual property 4 | # and proprietary rights in and to this software, related documentation 5 | # and any modifications thereto. Any use, reproduction, disclosure or 6 | # distribution of this software and related documentation without an express 7 | # license agreement from NVIDIA CORPORATION & AFFILIATES is strictly prohibited. 8 | 9 | parent: 'nglod_base.yaml' 10 | 11 | tracer: 12 | num_steps: 256 13 | step_size: 0.8 14 | 15 | grid: 16 | grid_type: 'HashGrid' 17 | interpolation_type: 'linear' 18 | multiscale_type: 'cat' 19 | feature_dim: 8 20 | feature_std: 0.01 21 | feature_bias: 0.0 22 | num_lods: 4 23 | codebook_bitwidth: 19 24 | tree_type: 'geometric' 25 | min_grid_res: 16 26 | max_grid_res: 2048 27 | -------------------------------------------------------------------------------- /third-party/kaolin-wisp/app/nglod/configs/nglod_octree.yaml: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2022, NVIDIA CORPORATION & AFFILIATES. All rights reserved. 2 | # 3 | # NVIDIA CORPORATION & AFFILIATES and its licensors retain all intellectual property 4 | # and proprietary rights in and to this software, related documentation 5 | # and any modifications thereto. Any use, reproduction, disclosure or 6 | # distribution of this software and related documentation without an express 7 | # license agreement from NVIDIA CORPORATION & AFFILIATES is strictly prohibited. 8 | 9 | parent: 'nglod_base.yaml' 10 | 11 | grid: 12 | grid_type: 'OctreeGrid' 13 | interpolation_type: 'linear' 14 | multiscale_type: 'sum' 15 | feature_dim: 16 16 | feature_std: 0.01 17 | base_lod: 2 18 | num_lods: 6 19 | num_samples_on_mesh: 100000000 # Number of samples generated on mesh surface to initialize the occupancy grid 20 | -------------------------------------------------------------------------------- /third-party/kaolin-wisp/app/nglod/configs/nglod_triplanar.yaml: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2022, NVIDIA CORPORATION & AFFILIATES. All rights reserved. 2 | # 3 | # NVIDIA CORPORATION & AFFILIATES and its licensors retain all intellectual property 4 | # and proprietary rights in and to this software, related documentation 5 | # and any modifications thereto. Any use, reproduction, disclosure or 6 | # distribution of this software and related documentation without an express 7 | # license agreement from NVIDIA CORPORATION & AFFILIATES is strictly prohibited. 8 | 9 | parent: 'nglod_base.yaml' 10 | 11 | tracer: 12 | num_steps: 256 13 | step_size: 0.8 14 | 15 | grid: 16 | grid_type: 'TriplanarGrid' 17 | interpolation_type: 'linear' 18 | multiscale_type: 'sum' 19 | feature_dim: 4 20 | feature_std: 0.01 21 | base_lod: 5 22 | num_lods: 1 -------------------------------------------------------------------------------- /third-party/kaolin-wisp/data/matcaps/LICENSE: -------------------------------------------------------------------------------- 1 | These are CC-0 / Public Domain matcaps collected from: https://blendswap.com/blend/6610 2 | -------------------------------------------------------------------------------- /third-party/kaolin-wisp/examples/latent_nerf/README.md: -------------------------------------------------------------------------------- 1 | # NeRF with Traced Latents (SIGGRAPH 2022 Demo) 2 | 3 | This example shows how to add a new type of **Neural Field** to wisp. 4 | Specifically, the newly added Neural Field exposes some of its latent channels to the tracer. 5 | To conclude the demo, an interactive demo app which renders the latent color channels is created. 6 | 7 | A full video walkthrough is [available here](https://www.nvidia.com/en-us/on-demand/session/siggraph2022-sigg22-s-14/?playlistId=playList-92d9241d-6d4c-4fc7-88f6-eb8484008787). 8 | 9 | 10 | ## Overview 11 | 12 | Latent NeRF 13 | 14 | ## Running the Demo 15 | 16 | The simplest configuration uses an Octree grid: 17 | ``` 18 | cd /examples/latent_nerf 19 | python3 main_demo.py --config funny_nerf_octree.yaml --dataset-path /path/to/nerf_lego --multiview-dataset-format standard 20 | ``` 21 | 22 | You can also experiment with a faster, alternative configuration which uses the Hashtable: 23 | ``` 24 | cd /examples/latent_nerf 25 | python3 main_demo.py --config funny_nerf_hash.yaml --dataset-path /path/to/nerf_lego --multiview-dataset-format standard 26 | ``` 27 | 28 | Make sure to use the appropriate `multiview-dataset-format` according to your data type. 29 | 30 | ## Files 31 | 32 | `funny_neural_field.py` contains: 33 | * The implementation of the custom `SigDecoder`, with a specialized forward function that exposes 3 latent channels. 34 | * The initialization of the feature grid, positional encoding, and decoders. 35 | * 2 forward functions for the tracer to invoke: `rgba()` and `color_feature()`. The example shows how to register these. 36 | 37 | `demo_app.py` is the interactive app which visualizes the optimization process. 38 | It includes additional logic for defining the new `color_feature` channel. 39 | 40 | `funny_nerf_octree.yaml` and `funny_nerf_hash.yaml` are the configuration files used to run this example. 41 | 42 | `main_demo,py` is the main script for registering the new neural field class and running the interactive demo. 43 | -------------------------------------------------------------------------------- /third-party/kaolin-wisp/examples/spc_browser/main_spc_browser.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2022, NVIDIA CORPORATION & AFFILIATES. All rights reserved. 2 | # 3 | # NVIDIA CORPORATION & AFFILIATES and its licensors retain all intellectual property 4 | # and proprietary rights in and to this software, related documentation 5 | # and any modifications thereto. Any use, reproduction, disclosure or 6 | # distribution of this software and related documentation without an express 7 | # license agreement from NVIDIA CORPORATION & AFFILIATES is strictly prohibited. 8 | 9 | 10 | """ 11 | An example application for browsing and visualizing Structured Point Cloud (SPC) models from kaolin. 12 | Assumes SPCs are stored as *.npz files, with an "octree" entry and some feature ("color" or "normal"). 13 | 14 | Usage: python examples/spc_browser/main_spc_browser.py --dataset-dir 15 | """ 16 | 17 | from wisp.cuda_guard import setup_cuda_context 18 | setup_cuda_context() # Must be called before any torch operations take place 19 | 20 | import argparse 21 | import torch 22 | from wisp.framework.state import WispState 23 | from browse_spc_app import BrowseSPCApp 24 | 25 | parser = argparse.ArgumentParser(description='An example application for browsing and visualizing ' 26 | 'Structured Point Cloud (SPC) models from kaolin.') 27 | parser.add_argument('--dataset-dir', type=str, help='Folder with SPC files for visualizing.') 28 | args = parser.parse_args() 29 | 30 | scene_state = WispState() 31 | scene_state.extent['dataset_path'] = args.dataset_dir # Save dir path in extent field, to be queried by the app 32 | scene_state.renderer.device = torch.device('cuda' if torch.cuda.is_available() else 'cpu') 33 | 34 | # In this example, the SPC Pipeline objects are created within the renderer's widget paint() logic. 35 | # See create_pipeline() within widget_spc_selector.py for an example of how SPCField is created. 36 | renderer = BrowseSPCApp(wisp_state=scene_state, window_name="SPC Browser") 37 | renderer.run() 38 | -------------------------------------------------------------------------------- /third-party/kaolin-wisp/requirements.txt: -------------------------------------------------------------------------------- 1 | mkl 2 | tensorboard 3 | matplotlib 4 | lpips 5 | git+https://github.com/tinyobjloader/tinyobjloader.git@v2.0.0rc8#subdirectory=python 6 | pyexr 7 | pybind11 8 | pyyaml 9 | trimesh>=3.0 10 | pandas 11 | tqdm 12 | Pillow 13 | scipy>=1.7.2 14 | scikit-image 15 | scikit-learn 16 | six>=1.12.0 17 | moviepy 18 | opencv-python 19 | plyfile 20 | protobuf>=3.20.0 21 | polyscope 22 | more_itertools 23 | Futureproof 24 | IPython 25 | pyarrow 26 | fastparquet 27 | PyDispatcher 28 | pynvml 29 | setuptools==59.5.0 30 | wandb>=0.13.5 31 | pytest>=7.1.0 -------------------------------------------------------------------------------- /third-party/kaolin-wisp/requirements_app.txt: -------------------------------------------------------------------------------- 1 | glfw 2 | imgui 3 | git+https://github.com/glumpy/glumpy.git@46a7635c08d3a200478397edbe0371a6c59cd9d7#egg=glumpy 4 | pyopengl 5 | -------------------------------------------------------------------------------- /third-party/kaolin-wisp/tests/apps/conftest.py: -------------------------------------------------------------------------------- 1 | import pytest 2 | from pathlib import Path 3 | 4 | 5 | def pytest_addoption(parser): 6 | parser.addoption("--dataroot", action="store", help="Root folder for dataset files.") 7 | parser.addoption("--dataset-num-workers", action="store", help="Number of parallel workers to process datasets." 8 | "Set to 0 to disable multiprocess.") 9 | 10 | 11 | @pytest.fixture 12 | def dataroot(request): 13 | return request.config.getoption("--dataroot", default="data/") 14 | 15 | 16 | @pytest.fixture 17 | def dataset_num_workers(request): 18 | return request.config.getoption("--dataset-num-workers", default=0) 19 | 20 | @pytest.fixture 21 | def V8_path(dataroot): 22 | return str(Path(dataroot, "V8/")) 23 | 24 | 25 | @pytest.fixture 26 | def lego_path(dataroot): 27 | return str(Path(dataroot, "lego/")) -------------------------------------------------------------------------------- /third-party/kaolin-wisp/tests/apps/test_latent_nerf.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2022, NVIDIA CORPORATION & AFFILIATES. All rights reserved. 2 | # 3 | # NVIDIA CORPORATION & AFFILIATES and its licensors retain all intellectual property 4 | # and proprietary rights in and to this software, related documentation 5 | # and any modifications thereto. Any use, reproduction, disclosure or 6 | # distribution of this software and related documentation without an express 7 | # license agreement from NVIDIA CORPORATION & AFFILIATES is strictly prohibited. 8 | 9 | from tests.test_utils import TestWispApp, run_wisp_script, collect_metrics_from_log, report_metrics 10 | 11 | 12 | class TestLatentNerfApp(TestWispApp): 13 | 14 | def test_latent_nerf_runs(self, lego_path, dataset_num_workers): 15 | cmd = 'examples/latent_nerf/main_demo.py' 16 | cli_args = f'--dataset-path {lego_path} --dataset-num-workers {dataset_num_workers} --epochs 1' 17 | 18 | out = run_wisp_script(cmd, cli_args) 19 | metrics = collect_metrics_from_log(out, ['PSNR']) 20 | report_metrics(metrics) # Prints to log 21 | -------------------------------------------------------------------------------- /third-party/kaolin-wisp/tests/core/test_packed_rf_tracer.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2022, NVIDIA CORPORATION & AFFILIATES. All rights reserved. 2 | # 3 | # NVIDIA CORPORATION & AFFILIATES and its licensors retain all intellectual property 4 | # and proprietary rights in and to this software, related documentation 5 | # and any modifications thereto. Any use, reproduction, disclosure or 6 | # distribution of this software and related documentation without an express 7 | # license agreement from NVIDIA CORPORATION & AFFILIATES is strictly prohibited. 8 | import unittest 9 | 10 | from wisp.datasets import RandomViewDataset 11 | from wisp.models.nefs import NeuralRadianceField 12 | from wisp.tracers import PackedRFTracer 13 | from wisp.models import Pipeline 14 | 15 | 16 | class Test(unittest.TestCase): 17 | def test_extra_channels(self): 18 | device = "cuda:0" 19 | nef = NeuralRadianceField(grid_type="HashGrid", multiscale_type="cat") 20 | nef.grid.init_from_geometric(min_width=2, max_width=4, num_lods=1) 21 | nef.to(device) 22 | tracer = PackedRFTracer() 23 | pipeline = Pipeline(nef, tracer) 24 | dataset = RandomViewDataset(num_rays=128, device=device) 25 | datum = dataset[0] 26 | rb = pipeline(rays=datum.rays, channels=["rgb", "density"]) 27 | assert hasattr(rb, "density") 28 | assert rb.rgb.shape[0] == rb.density.shape[0] 29 | -------------------------------------------------------------------------------- /third-party/kaolin-wisp/tools/linux/Dockerfile: -------------------------------------------------------------------------------- 1 | ARG BASE_IMAGE 2 | FROM ${BASE_IMAGE} 3 | 4 | # used for cross-compilation in docker build 5 | ARG FORCE_CUDA=1 6 | ARG INSTALL_RENDERER 7 | 8 | WORKDIR /wisp 9 | 10 | COPY . . 11 | 12 | RUN apt-get -y update \ 13 | && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \ 14 | libopenexr-dev \ 15 | git \ 16 | && apt-get clean \ 17 | && rm -rf /var/lib/apt/lists/* 18 | 19 | RUN pip install -r requirements.txt 20 | RUN python setup.py develop 21 | 22 | RUN if [ -z "${INSTALL_RENDERER}" ]; then \ 23 | git clone --recursive https://github.com/inducer/pycuda && \ 24 | cd ./pycuda && \ 25 | python configure.py --cuda-root=/usr/local/cuda/ --cuda-enable-gl && \ 26 | python setup.py develop && \ 27 | cd /wisp && \ 28 | pip install -r requirements_app.txt; \ 29 | fi 30 | -------------------------------------------------------------------------------- /third-party/kaolin-wisp/wisp/README.md: -------------------------------------------------------------------------------- 1 | # Wisp Library 2 | 3 | This is the main folder for the wisp library. The folders can be divided up into **framework** (core components and functions to make everything work) and **building blocks**. 4 | 5 | ## Framework 6 | 7 | `core` contains core primitives and structs that are used everywhere throughout the code. The `Rays` class and the `RenderBuffer` are particularly important classes to be aware of. 8 | 9 | `csrc` contains C++ and CUDA kernels which are used in the code. 10 | 11 | `framework` contains state objects and event handlers to interface the core library with apps (like the renderer). 12 | 13 | `ops` contains useful helper functions. 14 | 15 | `renderer` contains everything that is used to build the interactive visualizer. 16 | 17 | `config_parser.py` contains the parser for the configs and the command-line interface (CLI) arguments. 18 | 19 | ## Building Blocks 20 | 21 | `accelstructs` contains classes that can be used as spatial acceleration structures for fast raytracing and query. 22 | 23 | `datasets` contains classes for PyTorch datasets. 24 | 25 | `models` contains various objects like MLPs and grids which have parameters that can be optimized. 26 | 27 | `tracers` contains classes that can be used as **forward maps**, which are functions which map neural fields onto another domain. Currently this mostly contains mechanisms of tracing rays against neural fields. 28 | 29 | `trainers` contains classes that are designed per tasks to actually train, log, save different workloads. 30 | 31 | ## The Full Monty 32 | 33 | The architecture figure describes how the major Wisp components relate to each other: 34 | 35 | Wisp Architecture 36 | 37 | See also further README files accompanying the various wisp folders. 38 | -------------------------------------------------------------------------------- /third-party/kaolin-wisp/wisp/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2022, NVIDIA CORPORATION & AFFILIATES. All rights reserved. 2 | # 3 | # NVIDIA CORPORATION & AFFILIATES and its licensors retain all intellectual property 4 | # and proprietary rights in and to this software, related documentation 5 | # and any modifications thereto. Any use, reproduction, disclosure or 6 | # distribution of this software and related documentation without an express 7 | # license agreement from NVIDIA CORPORATION & AFFILIATES is strictly prohibited. 8 | -------------------------------------------------------------------------------- /third-party/kaolin-wisp/wisp/accelstructs/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2022, NVIDIA CORPORATION & AFFILIATES. All rights reserved. 2 | # 3 | # NVIDIA CORPORATION & AFFILIATES and its licensors retain all intellectual property 4 | # and proprietary rights in and to this software, related documentation 5 | # and any modifications thereto. Any use, reproduction, disclosure or 6 | # distribution of this software and related documentation without an express 7 | # license agreement from NVIDIA CORPORATION & AFFILIATES is strictly prohibited. 8 | 9 | from .base_as import BaseAS, ASQueryResults, ASRaytraceResults, ASRaymarchResults 10 | from .octree_as import OctreeAS 11 | from .aabb_as import AxisAlignedBBoxAS 12 | -------------------------------------------------------------------------------- /third-party/kaolin-wisp/wisp/accelstructs/aabb_as.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2022, NVIDIA CORPORATION & AFFILIATES. All rights reserved. 2 | # 3 | # NVIDIA CORPORATION & AFFILIATES and its licensors retain all intellectual property 4 | # and proprietary rights in and to this software, related documentation 5 | # and any modifications thereto. Any use, reproduction, disclosure or 6 | # distribution of this software and related documentation without an express 7 | # license agreement from NVIDIA CORPORATION & AFFILIATES is strictly prohibited. 8 | 9 | from __future__ import annotations 10 | from wisp.accelstructs.octree_as import OctreeAS 11 | import wisp.ops.spc as wisp_spc_ops 12 | 13 | 14 | class AxisAlignedBBoxAS(OctreeAS): 15 | """Axis Aligned Bounding Box, as a bottom-level acceleration structure class. 16 | Can be used to to quickly query cells occupancy, and trace rays against the volume. 17 | """ 18 | 19 | def __init__(self): 20 | """Initializes a simple acceleration structure of an AABB (axis aligned bounding box). """ 21 | # Builds a root-only octree, of one level, which is essentially a bounding box. 22 | # Useful for hacking together a quick AABB (axis aligned bounding box) tracer. 23 | octree = wisp_spc_ops.create_dense_octree(1) 24 | super().__init__(octree) 25 | 26 | def name(self) -> str: 27 | return "AABB" 28 | -------------------------------------------------------------------------------- /third-party/kaolin-wisp/wisp/app_utils.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2022, NVIDIA CORPORATION & AFFILIATES. All rights reserved. 2 | # 3 | # NVIDIA CORPORATION & AFFILIATES and its licensors retain all intellectual property 4 | # and proprietary rights in and to this software, related documentation 5 | # and any modifications thereto. Any use, reproduction, disclosure or 6 | # distribution of this software and related documentation without an express 7 | # license agreement from NVIDIA CORPORATION & AFFILIATES is strictly prohibited. 8 | 9 | import logging 10 | import sys 11 | import pprint 12 | 13 | 14 | def default_log_setup(level=logging.INFO): 15 | """ 16 | Sets up default logging, always logging to stdout. 17 | 18 | :param level: logging level, e.g. logging.INFO 19 | """ 20 | handlers = [logging.StreamHandler(sys.stdout)] 21 | # TODO: better to also use loggers per file and add %(name)15s 22 | logging.basicConfig(level=level, 23 | format='%(asctime)s|%(levelname)8s| %(message)s', 24 | handlers=handlers) 25 | 26 | 27 | def args_to_log_format(args_dict) -> str: 28 | """Convert args hierarchy to string representation suitable for logging (i.e. with Tensorboard). 29 | 30 | Args: 31 | args_dict : The parsed arguments, grouped within a dictionary. 32 | 33 | Returns: 34 | arg_str : The args encoded in a string format. 35 | """ 36 | pp = pprint.PrettyPrinter(indent=2) 37 | args_str = pp.pformat(args_dict) 38 | args_str = f'```{args_str}```' 39 | return args_str -------------------------------------------------------------------------------- /third-party/kaolin-wisp/wisp/core/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2022, NVIDIA CORPORATION & AFFILIATES. All rights reserved. 2 | # 3 | # NVIDIA CORPORATION & AFFILIATES and its licensors retain all intellectual property 4 | # and proprietary rights in and to this software, related documentation 5 | # and any modifications thereto. Any use, reproduction, disclosure or 6 | # distribution of this software and related documentation without an express 7 | # license agreement from NVIDIA CORPORATION & AFFILIATES is strictly prohibited. 8 | 9 | from .primitives import PrimitivesPack 10 | from .rays import Rays 11 | from .channels import * 12 | from .channel_fn import * 13 | from .colors import * 14 | from .render_buffer import RenderBuffer 15 | from .transforms import ObjectTransform 16 | from .wisp_module import WispModule 17 | -------------------------------------------------------------------------------- /third-party/kaolin-wisp/wisp/core/colors.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2022, NVIDIA CORPORATION & AFFILIATES. All rights reserved. 2 | # 3 | # NVIDIA CORPORATION & AFFILIATES and its licensors retain all intellectual property 4 | # and proprietary rights in and to this software, related documentation 5 | # and any modifications thereto. Any use, reproduction, disclosure or 6 | # distribution of this software and related documentation without an express 7 | # license agreement from NVIDIA CORPORATION & AFFILIATES is strictly prohibited. 8 | 9 | 10 | white = (1.0, 1.0, 1.0) 11 | black = (0.0, 0.0, 0.0) 12 | dark_gray = (0.25, 0.25, 0.25) 13 | light_purple = (0.788, 0.580, 1.0) 14 | lime = (0.746, 1.0, 0.0) 15 | red = (1.0, 0.0, 0.0) 16 | green = (0.0, 1.0, 0.0) 17 | blue = (0.0, 0.0, 1.0) 18 | orange = (1.0, 0.5, 0.0) 19 | light_cyan = (0.796, 1.0, 1.0) 20 | light_pink = (1.0, 0.796, 1.0) 21 | light_yellow = (1.0, 1.0, 0.796) 22 | light_teal = (0.757, 1.0, 0.949) 23 | gray = (0.5, 0.5, 0.5) 24 | soft_blue = (0.721, 0.90, 1.0) 25 | soft_red = (1.0, 0.0, 0.085) 26 | lime_green = (0.519, 0.819, 0.0) 27 | purple = (0.667, 0.0, 0.429) 28 | gold = (1.0, 0.804, 0.0) 29 | -------------------------------------------------------------------------------- /third-party/kaolin-wisp/wisp/core/wisp_module.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2022, NVIDIA CORPORATION & AFFILIATES. All rights reserved. 2 | # 3 | # NVIDIA CORPORATION & AFFILIATES and its licensors retain all intellectual property 4 | # and proprietary rights in and to this software, related documentation 5 | # and any modifications thereto. Any use, reproduction, disclosure or 6 | # distribution of this software and related documentation without an express 7 | # license agreement from NVIDIA CORPORATION & AFFILIATES is strictly prohibited. 8 | 9 | from abc import ABC, abstractmethod 10 | from typing import Dict, Any 11 | import torch.nn as nn 12 | 13 | 14 | class WispModule(nn.Module, ABC): 15 | """ A general interface for all Wisp building blocks, such as neural fields, grids and tracers. 16 | WispModules should: 17 | 1. Provide their name & dictionary of public properties. That makes them compatible with systems like 18 | logging & gui. 19 | 2. WispModules extend torch's nn.Module out of convenience. 20 | Modules are not required however, to implement a forward() function. 21 | """ 22 | 23 | def __init__(self): 24 | super().__init__() 25 | 26 | def name(self) -> str: 27 | """ 28 | Returns: 29 | (str) A WispModule should be given a meaningful, human readable name. 30 | By default, the class name is used. 31 | """ 32 | return type(self).__name__ 33 | 34 | @abstractmethod 35 | def public_properties(self) -> Dict[str, Any]: 36 | """ Wisp modules expose their public properties in a dictionary. 37 | The purpose of this method is to give an easy table of outwards facing attributes, 38 | for the purpose of logging, gui apps, etc. 39 | """ 40 | raise NotImplementedError('Wisp modules should implement the `public_properties` method') 41 | -------------------------------------------------------------------------------- /third-party/kaolin-wisp/wisp/csrc/bindings.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2022, NVIDIA CORPORATION & AFFILIATES. All rights reserved. 3 | * 4 | * NVIDIA CORPORATION & AFFILIATES and its licensors retain all intellectual property 5 | * and proprietary rights in and to this software, related documentation 6 | * and any modifications thereto. Any use, reproduction, disclosure or 7 | * distribution of this software and related documentation without an express 8 | * license agreement from NVIDIA CORPORATION & AFFILIATES is strictly prohibited. 9 | */ 10 | 11 | #include 12 | #include "./render/find_depth_bound.h" 13 | #include "./external/mesh_to_sdf.h" 14 | #include "./ops/hashgrid_interpolate.h" 15 | 16 | namespace wisp { 17 | 18 | PYBIND11_MODULE(TORCH_EXTENSION_NAME, m) { 19 | py::module render = m.def_submodule("render"); 20 | render.def("find_depth_bound_cuda", &find_depth_bound_cuda); 21 | py::module external = m.def_submodule("external"); 22 | external.def("mesh_to_sdf_cuda", &mesh_to_sdf_cuda); 23 | py::module ops = m.def_submodule("ops"); 24 | ops.def("hashgrid_interpolate_cuda", &hashgrid_interpolate_cuda); 25 | ops.def("hashgrid_interpolate_backward_cuda", &hashgrid_interpolate_backward_cuda); 26 | } 27 | 28 | } 29 | 30 | -------------------------------------------------------------------------------- /third-party/kaolin-wisp/wisp/csrc/external/mesh_to_sdf.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2022, NVIDIA CORPORATION & AFFILIATES. All rights reserved. 3 | * 4 | * NVIDIA CORPORATION & AFFILIATES and its licensors retain all intellectual property 5 | * and proprietary rights in and to this software, related documentation 6 | * and any modifications thereto. Any use, reproduction, disclosure or 7 | * distribution of this software and related documentation without an express 8 | * license agreement from NVIDIA CORPORATION & AFFILIATES is strictly prohibited. 9 | */ 10 | 11 | #include 12 | #include 13 | 14 | std::vector mesh2sdf_gpu_fast_nopre( 15 | at::Tensor& points, 16 | at::Tensor& mesh); 17 | 18 | namespace wisp { 19 | 20 | std::vector mesh_to_sdf_cuda( 21 | at::Tensor points, 22 | at::Tensor mesh) { 23 | #ifdef WITH_CUDA 24 | return mesh2sdf_gpu_fast_nopre(points, mesh); 25 | #else 26 | AT_ERROR(__func__); 27 | #endif // WITH_CUDA 28 | } 29 | 30 | } 31 | 32 | -------------------------------------------------------------------------------- /third-party/kaolin-wisp/wisp/csrc/external/mesh_to_sdf.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2022, NVIDIA CORPORATION & AFFILIATES. All rights reserved. 3 | * 4 | * NVIDIA CORPORATION & AFFILIATES and its licensors retain all intellectual property 5 | * and proprietary rights in and to this software, related documentation 6 | * and any modifications thereto. Any use, reproduction, disclosure or 7 | * distribution of this software and related documentation without an express 8 | * license agreement from NVIDIA CORPORATION & AFFILIATES is strictly prohibited. 9 | */ 10 | 11 | #pragma once 12 | 13 | #include 14 | #include 15 | 16 | // Header file to wrap the mesh2sdf kernel from DualSDF 17 | 18 | namespace wisp { 19 | 20 | std::vector mesh_to_sdf_cuda( 21 | at::Tensor points, 22 | at::Tensor mesh); 23 | 24 | } 25 | -------------------------------------------------------------------------------- /third-party/kaolin-wisp/wisp/csrc/ops/hashgrid_interpolate.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2022, NVIDIA CORPORATION & AFFILIATES. All rights reserved. 3 | * 4 | * NVIDIA CORPORATION & AFFILIATES and its licensors retain all intellectual property 5 | * and proprietary rights in and to this software, related documentation 6 | * and any modifications thereto. Any use, reproduction, disclosure or 7 | * distribution of this software and related documentation without an express 8 | * license agreement from NVIDIA CORPORATION & AFFILIATES is strictly prohibited. 9 | */ 10 | 11 | #pragma once 12 | 13 | #include 14 | #include 15 | 16 | namespace wisp { 17 | 18 | at::Tensor hashgrid_interpolate_cuda( 19 | at::Tensor coords, 20 | std::vector codebook, 21 | std::vector resolution, 22 | int32_t codebook_bitwidth); 23 | 24 | std::vector hashgrid_interpolate_backward_cuda( 25 | at::Tensor coords, 26 | at::Tensor grad_output, 27 | std::vector codebook, 28 | std::vector resolution, 29 | std::vector codebook_shapes, 30 | int32_t codebook_bitwidth, 31 | int32_t feature_dim, 32 | bool require_grad_coords); 33 | 34 | } 35 | 36 | -------------------------------------------------------------------------------- /third-party/kaolin-wisp/wisp/csrc/render/find_depth_bound.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2022, NVIDIA CORPORATION & AFFILIATES. All rights reserved. 3 | * 4 | * NVIDIA CORPORATION & AFFILIATES and its licensors retain all intellectual property 5 | * and proprietary rights in and to this software, related documentation 6 | * and any modifications thereto. Any use, reproduction, disclosure or 7 | * distribution of this software and related documentation without an express 8 | * license agreement from NVIDIA CORPORATION & AFFILIATES is strictly prohibited. 9 | */ 10 | 11 | #include 12 | 13 | namespace wisp { 14 | 15 | void find_depth_bound_cuda_impl( 16 | int64_t num_packs, 17 | int64_t num_nugs, 18 | at::Tensor query, 19 | at::Tensor curr_idxes_in, 20 | at::Tensor curr_idxes_out, 21 | at::Tensor depth); 22 | 23 | at::Tensor find_depth_bound_cuda( 24 | at::Tensor query, 25 | at::Tensor curr_idxes_in, 26 | at::Tensor depth) { 27 | #ifdef WITH_CUDA 28 | int64_t num_packs = query.size(0); 29 | int64_t num_nugs = depth.size(0); 30 | at::Tensor curr_idxes_out = at::zeros({num_packs}, query.options().dtype(at::kInt)) - 1; 31 | find_depth_bound_cuda_impl(num_packs, num_nugs, query, curr_idxes_in, curr_idxes_out, depth); 32 | return curr_idxes_out; 33 | #else 34 | AT_ERROR(__func__); 35 | #endif // WITH_CUDA 36 | } 37 | 38 | 39 | } 40 | 41 | -------------------------------------------------------------------------------- /third-party/kaolin-wisp/wisp/csrc/render/find_depth_bound.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2022, NVIDIA CORPORATION & AFFILIATES. All rights reserved. 3 | * 4 | * NVIDIA CORPORATION & AFFILIATES and its licensors retain all intellectual property 5 | * and proprietary rights in and to this software, related documentation 6 | * and any modifications thereto. Any use, reproduction, disclosure or 7 | * distribution of this software and related documentation without an express 8 | * license agreement from NVIDIA CORPORATION & AFFILIATES is strictly prohibited. 9 | */ 10 | 11 | #pragma once 12 | 13 | #include 14 | 15 | namespace wisp { 16 | 17 | at::Tensor find_depth_bound_cuda( 18 | at::Tensor query, 19 | at::Tensor curr_idxes_in, 20 | at::Tensor depth); 21 | 22 | } 23 | 24 | -------------------------------------------------------------------------------- /third-party/kaolin-wisp/wisp/datasets/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2022, NVIDIA CORPORATION & AFFILIATES. All rights reserved. 2 | # 3 | # NVIDIA CORPORATION & AFFILIATES and its licensors retain all intellectual property 4 | # and proprietary rights in and to this software, related documentation 5 | # and any modifications thereto. Any use, reproduction, disclosure or 6 | # distribution of this software and related documentation without an express 7 | # license agreement from NVIDIA CORPORATION & AFFILIATES is strictly prohibited. 8 | 9 | from .sdf_dataset import SDFDataset 10 | from .multiview_dataset import MultiviewDataset 11 | from .random_view_dataset import RandomViewDataset 12 | from .utils import default_collate 13 | -------------------------------------------------------------------------------- /third-party/kaolin-wisp/wisp/datasets/formats/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2022, NVIDIA CORPORATION & AFFILIATES. All rights reserved. 2 | # 3 | # NVIDIA CORPORATION & AFFILIATES and its licensors retain all intellectual property 4 | # and proprietary rights in and to this software, related documentation 5 | # and any modifications thereto. Any use, reproduction, disclosure or 6 | # distribution of this software and related documentation without an express 7 | # license agreement from NVIDIA CORPORATION & AFFILIATES is strictly prohibited. 8 | 9 | from .rtmv import * 10 | from .nerf_standard import * 11 | -------------------------------------------------------------------------------- /third-party/kaolin-wisp/wisp/datasets/transforms/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2022, NVIDIA CORPORATION & AFFILIATES. All rights reserved. 2 | # 3 | # NVIDIA CORPORATION & AFFILIATES and its licensors retain all intellectual property 4 | # and proprietary rights in and to this software, related documentation 5 | # and any modifications thereto. Any use, reproduction, disclosure or 6 | # distribution of this software and related documentation without an express 7 | # license agreement from NVIDIA CORPORATION & AFFILIATES is strictly prohibited. 8 | 9 | 10 | from .ray_sampler import * 11 | -------------------------------------------------------------------------------- /third-party/kaolin-wisp/wisp/datasets/transforms/ray_sampler.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2022, NVIDIA CORPORATION & AFFILIATES. All rights reserved. 2 | # 3 | # NVIDIA CORPORATION & AFFILIATES and its licensors retain all intellectual property 4 | # and proprietary rights in and to this software, related documentation 5 | # and any modifications thereto. Any use, reproduction, disclosure or 6 | # distribution of this software and related documentation without an express 7 | # license agreement from NVIDIA CORPORATION & AFFILIATES is strictly prohibited. 8 | 9 | import torch 10 | 11 | 12 | class SampleRays: 13 | """ A dataset transform for sub-sampling a fixed amount of rays. """ 14 | def __init__(self, num_samples): 15 | self.num_samples = num_samples 16 | 17 | def __call__(self, inputs): 18 | ray_idx = torch.randint(0, inputs['imgs'].shape[0], [self.num_samples], 19 | device=inputs['imgs'].device) 20 | 21 | out = {} 22 | out['rays'] = inputs['rays'][ray_idx].contiguous() 23 | out['imgs'] = inputs['imgs'][ray_idx].contiguous() 24 | return out 25 | -------------------------------------------------------------------------------- /third-party/kaolin-wisp/wisp/framework/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2022, NVIDIA CORPORATION & AFFILIATES. All rights reserved. 2 | # 3 | # NVIDIA CORPORATION & AFFILIATES and its licensors retain all intellectual property 4 | # and proprietary rights in and to this software, related documentation 5 | # and any modifications thereto. Any use, reproduction, disclosure or 6 | # distribution of this software and related documentation without an express 7 | # license agreement from NVIDIA CORPORATION & AFFILIATES is strictly prohibited. 8 | 9 | from .event import watch, watchedfields 10 | from .state import * 11 | -------------------------------------------------------------------------------- /third-party/kaolin-wisp/wisp/gfx/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2022, NVIDIA CORPORATION & AFFILIATES. All rights reserved. 2 | # 3 | # NVIDIA CORPORATION & AFFILIATES and its licensors retain all intellectual property 4 | # and proprietary rights in and to this software, related documentation 5 | # and any modifications thereto. Any use, reproduction, disclosure or 6 | # distribution of this software and related documentation without an express 7 | # license agreement from NVIDIA CORPORATION & AFFILIATES is strictly prohibited. 8 | 9 | from .datalayers import * 10 | -------------------------------------------------------------------------------- /third-party/kaolin-wisp/wisp/gfx/datalayers/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2022, NVIDIA CORPORATION & AFFILIATES. All rights reserved. 2 | # 3 | # NVIDIA CORPORATION & AFFILIATES and its licensors retain all intellectual property 4 | # and proprietary rights in and to this software, related documentation 5 | # and any modifications thereto. Any use, reproduction, disclosure or 6 | # distribution of this software and related documentation without an express 7 | # license agreement from NVIDIA CORPORATION & AFFILIATES is strictly prohibited. 8 | 9 | from .datalayers import Datalayers 10 | from .camera_datalayers import CameraDatalayers 11 | from .octree_datalayers import OctreeDatalayers 12 | from .aabb_datalayers import AABBDatalayers 13 | -------------------------------------------------------------------------------- /third-party/kaolin-wisp/wisp/gfx/datalayers/aabb_datalayers.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2022, NVIDIA CORPORATION & AFFILIATES. All rights reserved. 2 | # 3 | # NVIDIA CORPORATION & AFFILIATES and its licensors retain all intellectual property 4 | # and proprietary rights in and to this software, related documentation 5 | # and any modifications thereto. Any use, reproduction, disclosure or 6 | # distribution of this software and related documentation without an express 7 | # license agreement from NVIDIA CORPORATION & AFFILIATES is strictly prohibited. 8 | 9 | import torch 10 | from typing import Dict 11 | import kaolin.ops.spc as spc_ops 12 | from wisp.core import PrimitivesPack 13 | from wisp.accelstructs import AxisAlignedBBoxAS 14 | from wisp.gfx.datalayers import Datalayers 15 | from wisp.core.colors import soft_blue, soft_red, lime_green, purple, gold 16 | 17 | 18 | class AABBDatalayers(Datalayers): 19 | 20 | def __init__(self): 21 | self._last_state = dict() 22 | 23 | def needs_redraw(self, blas: AxisAlignedBBoxAS) -> True: 24 | return True 25 | 26 | def regenerate_data_layers(self, blas: AxisAlignedBBoxAS) -> Dict[str, PrimitivesPack]: 27 | data_layers = dict() 28 | color_tensor = torch.tensor((*soft_blue, 1.0)) 29 | 30 | cells = PrimitivesPack() 31 | lod = 0 32 | level_points = spc_ops.unbatched_get_level_points(blas.points, blas.pyramid, 0) 33 | corners = spc_ops.points_to_corners(level_points) / (2 ** lod) 34 | corners = corners * 2.0 - 1.0 35 | grid_lines = corners[:, [(0, 1), (1, 3), (3, 2), (2, 0), 36 | (4, 5), (5, 7), (7, 6), (6, 4), 37 | (0, 4), (1, 5), (2, 6), (3, 7)]] 38 | 39 | grid_lines_start = grid_lines[:, :, 0].reshape(-1, 3) 40 | grid_lines_end = grid_lines[:, :, 1].reshape(-1, 3) 41 | grid_lines_color = color_tensor.repeat(grid_lines_start.shape[0], 1) 42 | cells.add_lines(grid_lines_start, grid_lines_end, grid_lines_color) 43 | 44 | data_layers[f'AABB'] = cells 45 | return data_layers 46 | -------------------------------------------------------------------------------- /third-party/kaolin-wisp/wisp/gfx/datalayers/datalayers.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2022, NVIDIA CORPORATION & AFFILIATES. All rights reserved. 2 | # 3 | # NVIDIA CORPORATION & AFFILIATES and its licensors retain all intellectual property 4 | # and proprietary rights in and to this software, related documentation 5 | # and any modifications thereto. Any use, reproduction, disclosure or 6 | # distribution of this software and related documentation without an express 7 | # license agreement from NVIDIA CORPORATION & AFFILIATES is strictly prohibited. 8 | 9 | from abc import ABC, abstractmethod 10 | from typing import Dict 11 | from wisp.core import PrimitivesPack 12 | 13 | class Datalayers(ABC): 14 | 15 | @abstractmethod 16 | def needs_redraw(self, *args, **kwargs) -> bool: 17 | raise NotImplementedError 18 | 19 | @abstractmethod 20 | def regenerate_data_layers(self, *args, **kwargs) -> Dict[str, PrimitivesPack]: 21 | raise NotImplementedError 22 | -------------------------------------------------------------------------------- /third-party/kaolin-wisp/wisp/models/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2022, NVIDIA CORPORATION & AFFILIATES. All rights reserved. 2 | # 3 | # NVIDIA CORPORATION & AFFILIATES and its licensors retain all intellectual property 4 | # and proprietary rights in and to this software, related documentation 5 | # and any modifications thereto. Any use, reproduction, disclosure or 6 | # distribution of this software and related documentation without an express 7 | # license agreement from NVIDIA CORPORATION & AFFILIATES is strictly prohibited. 8 | 9 | from .pipeline import Pipeline 10 | -------------------------------------------------------------------------------- /third-party/kaolin-wisp/wisp/models/activations/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2022, NVIDIA CORPORATION & AFFILIATES. All rights reserved. 2 | # 3 | # NVIDIA CORPORATION & AFFILIATES and its licensors retain all intellectual property 4 | # and proprietary rights in and to this software, related documentation 5 | # and any modifications thereto. Any use, reproduction, disclosure or 6 | # distribution of this software and related documentation without an express 7 | # license agreement from NVIDIA CORPORATION & AFFILIATES is strictly prohibited. 8 | 9 | from .basic_activations import * 10 | -------------------------------------------------------------------------------- /third-party/kaolin-wisp/wisp/models/conditioners/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2022, NVIDIA CORPORATION & AFFILIATES. All rights reserved. 2 | # 3 | # NVIDIA CORPORATION & AFFILIATES and its licensors retain all intellectual property 4 | # and proprietary rights in and to this software, related documentation 5 | # and any modifications thereto. Any use, reproduction, disclosure or 6 | # distribution of this software and related documentation without an express 7 | # license agreement from NVIDIA CORPORATION & AFFILIATES is strictly prohibited. 8 | 9 | from .basic_conditioners import * 10 | -------------------------------------------------------------------------------- /third-party/kaolin-wisp/wisp/models/decoders/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2022, NVIDIA CORPORATION & AFFILIATES. All rights reserved. 2 | # 3 | # NVIDIA CORPORATION & AFFILIATES and its licensors retain all intellectual property 4 | # and proprietary rights in and to this software, related documentation 5 | # and any modifications thereto. Any use, reproduction, disclosure or 6 | # distribution of this software and related documentation without an express 7 | # license agreement from NVIDIA CORPORATION & AFFILIATES is strictly prohibited. 8 | 9 | from .basic_decoders import * 10 | -------------------------------------------------------------------------------- /third-party/kaolin-wisp/wisp/models/embedders/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2022, NVIDIA CORPORATION & AFFILIATES. All rights reserved. 2 | # 3 | # NVIDIA CORPORATION & AFFILIATES and its licensors retain all intellectual property 4 | # and proprietary rights in and to this software, related documentation 5 | # and any modifications thereto. Any use, reproduction, disclosure or 6 | # distribution of this software and related documentation without an express 7 | # license agreement from NVIDIA CORPORATION & AFFILIATES is strictly prohibited. 8 | 9 | from .positional_embedder import * 10 | -------------------------------------------------------------------------------- /third-party/kaolin-wisp/wisp/models/grids/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2022, NVIDIA CORPORATION & AFFILIATES. All rights reserved. 2 | # 3 | # NVIDIA CORPORATION & AFFILIATES and its licensors retain all intellectual property 4 | # and proprietary rights in and to this software, related documentation 5 | # and any modifications thereto. Any use, reproduction, disclosure or 6 | # distribution of this software and related documentation without an express 7 | # license agreement from NVIDIA CORPORATION & AFFILIATES is strictly prohibited. 8 | 9 | from .blas_grid import * 10 | from .octree_grid import * 11 | from .codebook_grid import * 12 | from .hash_grid import * 13 | from .triplanar_grid import * 14 | -------------------------------------------------------------------------------- /third-party/kaolin-wisp/wisp/models/nefs/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2022, NVIDIA CORPORATION & AFFILIATES. All rights reserved. 2 | # 3 | # NVIDIA CORPORATION & AFFILIATES and its licensors retain all intellectual property 4 | # and proprietary rights in and to this software, related documentation 5 | # and any modifications thereto. Any use, reproduction, disclosure or 6 | # distribution of this software and related documentation without an express 7 | # license agreement from NVIDIA CORPORATION & AFFILIATES is strictly prohibited. 8 | 9 | from .base_nef import * 10 | from .neural_sdf import * 11 | from .nerf import * 12 | from .spc_field import * 13 | -------------------------------------------------------------------------------- /third-party/kaolin-wisp/wisp/ops/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2022, NVIDIA CORPORATION & AFFILIATES. All rights reserved. 2 | # 3 | # NVIDIA CORPORATION & AFFILIATES and its licensors retain all intellectual property 4 | # and proprietary rights in and to this software, related documentation 5 | # and any modifications thereto. Any use, reproduction, disclosure or 6 | # distribution of this software and related documentation without an express 7 | # license agreement from NVIDIA CORPORATION & AFFILIATES is strictly prohibited. 8 | 9 | from . import geometric 10 | from . import grid 11 | -------------------------------------------------------------------------------- /third-party/kaolin-wisp/wisp/ops/differential/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2022, NVIDIA CORPORATION & AFFILIATES. All rights reserved. 2 | # 3 | # NVIDIA CORPORATION & AFFILIATES and its licensors retain all intellectual property 4 | # and proprietary rights in and to this software, related documentation 5 | # and any modifications thereto. Any use, reproduction, disclosure or 6 | # distribution of this software and related documentation without an express 7 | # license agreement from NVIDIA CORPORATION & AFFILIATES is strictly prohibited. 8 | 9 | from .gradients import * 10 | -------------------------------------------------------------------------------- /third-party/kaolin-wisp/wisp/ops/image/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2022, NVIDIA CORPORATION & AFFILIATES. All rights reserved. 2 | # 3 | # NVIDIA CORPORATION & AFFILIATES and its licensors retain all intellectual property 4 | # and proprietary rights in and to this software, related documentation 5 | # and any modifications thereto. Any use, reproduction, disclosure or 6 | # distribution of this software and related documentation without an express 7 | # license agreement from NVIDIA CORPORATION & AFFILIATES is strictly prohibited. 8 | 9 | from .io import * 10 | from .metrics import * 11 | from .processing import * 12 | -------------------------------------------------------------------------------- /third-party/kaolin-wisp/wisp/ops/image/processing.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2022, NVIDIA CORPORATION & AFFILIATES. All rights reserved. 2 | # 3 | # NVIDIA CORPORATION & AFFILIATES and its licensors retain all intellectual property 4 | # and proprietary rights in and to this software, related documentation 5 | # and any modifications thereto. Any use, reproduction, disclosure or 6 | # distribution of this software and related documentation without an express 7 | # license agreement from NVIDIA CORPORATION & AFFILIATES is strictly prohibited. 8 | 9 | import cv2 10 | import torch 11 | 12 | 13 | def srgb_to_linear(img): 14 | """Converts from SRGB to Linear colorspace. 15 | 16 | Args: 17 | img (torch.FloatTensor): SRGB image. 18 | 19 | Returns: 20 | (torch.FloatTensor): Linear image. 21 | """ 22 | limit = 0.04045 23 | return torch.where(img > limit, torch.power((img + 0.055) / 1.055, 2.4), img / 12.92) 24 | 25 | 26 | def linear_to_srgb(img): 27 | """Converts from Linear to SRGB colorspace. 28 | 29 | Args: 30 | img (torch.FloatTensor): Linear image. 31 | 32 | Returns: 33 | (torch.FloatTensor): SRGB image. 34 | """ 35 | limit = 0.0031308 36 | img = torch.where(img > limit, 1.055 * (img ** (1.0 / 2.4)) - 0.055, 12.92 * img) 37 | img[img > 1] = 1 38 | return img 39 | 40 | 41 | def resize_mip(img, mip, interpolation=cv2.INTER_LINEAR): 42 | """Resize image with cv2. 43 | 44 | Args: 45 | img (torch.FloatTensor): Image of shape [H, W, 3] 46 | mip (int): Rescaling factor. Will rescale by 2**mip. 47 | interpolation: Interpolation modes used by `cv2.resize`. 48 | 49 | Returns: 50 | (torch.FloatTensor): Rescaled image of shape [H/(2**mip), W/(2**mip), 3] 51 | """ 52 | resize_factor = 2**mip 53 | # WARNING: cv2 expects (w,h) for the shape. God knows why :) 54 | shape = (int(img.shape[1] // resize_factor), int(img.shape[0] // resize_factor)) 55 | img = cv2.resize(img, dsize=shape, interpolation=interpolation) 56 | return img 57 | -------------------------------------------------------------------------------- /third-party/kaolin-wisp/wisp/ops/mesh/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2022, NVIDIA CORPORATION & AFFILIATES. All rights reserved. 2 | # 3 | # NVIDIA CORPORATION & AFFILIATES and its licensors retain all intellectual property 4 | # and proprietary rights in and to this software, related documentation 5 | # and any modifications thereto. Any use, reproduction, disclosure or 6 | # distribution of this software and related documentation without an express 7 | # license agreement from NVIDIA CORPORATION & AFFILIATES is strictly prohibited. 8 | 9 | from .area_weighted_distribution import area_weighted_distribution 10 | from .random_face import random_face 11 | from .point_sample import point_sample 12 | from .sample_surface import sample_surface 13 | from .sample_near_surface import sample_near_surface 14 | from .sample_uniform import sample_uniform 15 | from .load_obj import load_obj 16 | from .compute_sdf import compute_sdf 17 | from .normalize import normalize 18 | from .closest_point import closest_point 19 | from .closest_tex import closest_tex 20 | from .barycentric_coordinates import barycentric_coordinates 21 | from .sample_tex import sample_tex 22 | from .per_face_normals import per_face_normals 23 | -------------------------------------------------------------------------------- /third-party/kaolin-wisp/wisp/ops/mesh/area_weighted_distribution.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2022, NVIDIA CORPORATION & AFFILIATES. All rights reserved. 2 | # 3 | # NVIDIA CORPORATION & AFFILIATES and its licensors retain all intellectual property 4 | # and proprietary rights in and to this software, related documentation 5 | # and any modifications thereto. Any use, reproduction, disclosure or 6 | # distribution of this software and related documentation without an express 7 | # license agreement from NVIDIA CORPORATION & AFFILIATES is strictly prohibited. 8 | 9 | import torch 10 | from .per_face_normals import per_face_normals 11 | 12 | def area_weighted_distribution( 13 | V : torch.Tensor, 14 | F : torch.Tensor, 15 | normals : torch.Tensor = None): 16 | """Construct discrete area weighted distribution over triangle mesh. 17 | 18 | Args: 19 | V (torch.Tensor): #V, 3 array of vertices 20 | F (torch.Tensor): #F, 3 array of indices 21 | normals (torch.Tensor): normals (if precomputed) 22 | eps (float): epsilon 23 | 24 | Returns: 25 | (torch.distributions): Distribution to be used 26 | """ 27 | 28 | if normals is None: 29 | normals = per_face_normals(V, F) 30 | areas = torch.norm(normals, p=2, dim=1) * 0.5 31 | areas /= torch.sum(areas) + 1e-10 32 | 33 | # Discrete PDF over triangles 34 | return torch.distributions.Categorical(areas.view(-1)) 35 | 36 | -------------------------------------------------------------------------------- /third-party/kaolin-wisp/wisp/ops/mesh/barycentric_coordinates.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2022, NVIDIA CORPORATION & AFFILIATES. All rights reserved. 2 | # 3 | # NVIDIA CORPORATION & AFFILIATES and its licensors retain all intellectual property 4 | # and proprietary rights in and to this software, related documentation 5 | # and any modifications thereto. Any use, reproduction, disclosure or 6 | # distribution of this software and related documentation without an express 7 | # license agreement from NVIDIA CORPORATION & AFFILIATES is strictly prohibited. 8 | 9 | import torch 10 | import numpy as np 11 | 12 | # Same API as https://github.com/libigl/libigl/blob/main/include/igl/barycentric_coordinates.cpp 13 | 14 | def barycentric_coordinates( 15 | points : torch.Tensor, 16 | A : torch.Tensor, 17 | B : torch.Tensor, 18 | C : torch.Tensor): 19 | """ 20 | Return barycentric coordinates for a given set of points and triangle vertices 21 | 22 | Args: 23 | points (torch.FloatTensor): [N, 3] 24 | A (torch.FloatTensor): [N, 3] vertex0 25 | B (torch.FloatTensor): [N, 3] vertex1 26 | C (torch.FloatTensor): [N, 3] vertex2 27 | 28 | Returns: 29 | (torch.FloatTensor): barycentric coordinates of [N, 2] 30 | """ 31 | 32 | v0 = B-A 33 | v1 = C-A 34 | v2 = points-A 35 | d00 = (v0*v0).sum(dim=-1) 36 | d01 = (v0*v1).sum(dim=-1) 37 | d11 = (v1*v1).sum(dim=-1) 38 | d20 = (v2*v0).sum(dim=-1) 39 | d21 = (v2*v1).sum(dim=-1) 40 | denom = d00*d11 - d01*d01 41 | L = torch.zeros(points.shape[0], 3, device=points.device) 42 | # Warning: This clipping may cause undesired behaviour 43 | L[...,1] = torch.clip((d11*d20 - d01*d21)/denom, 0.0, 1.0) 44 | L[...,2] = torch.clip((d00*d21 - d01*d20)/denom, 0.0, 1.0) 45 | L[...,0] = torch.clip(1.0 - (L[...,1] + L[...,2]), 0.0, 1.0) 46 | return L 47 | -------------------------------------------------------------------------------- /third-party/kaolin-wisp/wisp/ops/mesh/closest_point.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2022, NVIDIA CORPORATION & AFFILIATES. All rights reserved. 2 | # 3 | # NVIDIA CORPORATION & AFFILIATES and its licensors retain all intellectual property 4 | # and proprietary rights in and to this software, related documentation 5 | # and any modifications thereto. Any use, reproduction, disclosure or 6 | # distribution of this software and related documentation without an express 7 | # license agreement from NVIDIA CORPORATION & AFFILIATES is strictly prohibited. 8 | 9 | # Closest point function + texture sampling 10 | # https://en.wikipedia.org/wiki/Closest_point_method 11 | 12 | import torch 13 | import numpy as np 14 | 15 | def closest_point( 16 | V : torch.Tensor, 17 | F : torch.Tensor, 18 | points : torch.Tensor): 19 | 20 | assert False and "This function is not supported in the main branch. Please use ttakikawa/pysdf for this function." 21 | 22 | 23 | -------------------------------------------------------------------------------- /third-party/kaolin-wisp/wisp/ops/mesh/closest_tex.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2022, NVIDIA CORPORATION & AFFILIATES. All rights reserved. 2 | # 3 | # NVIDIA CORPORATION & AFFILIATES and its licensors retain all intellectual property 4 | # and proprietary rights in and to this software, related documentation 5 | # and any modifications thereto. Any use, reproduction, disclosure or 6 | # distribution of this software and related documentation without an express 7 | # license agreement from NVIDIA CORPORATION & AFFILIATES is strictly prohibited. 8 | 9 | import torch 10 | import numpy as np 11 | from .barycentric_coordinates import barycentric_coordinates 12 | from .closest_point import closest_point 13 | from .sample_tex import sample_tex 14 | 15 | def closest_tex( 16 | V : torch.Tensor, 17 | F : torch.Tensor, 18 | TV : torch.Tensor, 19 | TF : torch.Tensor, 20 | materials, 21 | points : torch.Tensor): 22 | """Returns the closest texture for a set of points. 23 | 24 | V (torch.FloatTensor): mesh vertices of shape [V, 3] 25 | F (torch.LongTensor): mesh face indices of shape [F, 3] 26 | TV (torch.FloatTensor): 27 | TF (torch.FloatTensor): 28 | materials: 29 | points (torch.FloatTensor): sample locations of shape [N, 3] 30 | 31 | Returns: 32 | (torch.FloatTensor): texture samples of shape [N, 3] 33 | """ 34 | 35 | TV = TV.to(V.device) 36 | TF = TF.to(V.device) 37 | points = points.to(V.device) 38 | 39 | dist, hit_pts, hit_tidx = closest_point(V, F, points) 40 | 41 | hit_F = F[hit_tidx] 42 | hit_V = V[hit_F] 43 | BC = barycentric_coordinates(hit_pts.cuda(), hit_V[:,0], hit_V[:,1], hit_V[:,2]) 44 | 45 | hit_TF = TF[hit_tidx] 46 | hit_TM = hit_TF[...,3] 47 | hit_TF = hit_TF[...,:3] 48 | 49 | if TV.shape[0] > 0: 50 | hit_TV = TV[hit_TF] 51 | hit_Tp = (hit_TV * BC.unsqueeze(-1)).sum(1) 52 | else: 53 | hit_Tp = BC 54 | 55 | rgb = sample_tex(hit_Tp, hit_TM, materials) 56 | 57 | return rgb, hit_pts, dist 58 | -------------------------------------------------------------------------------- /third-party/kaolin-wisp/wisp/ops/mesh/compute_sdf.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2022, NVIDIA CORPORATION & AFFILIATES. All rights reserved. 2 | # 3 | # NVIDIA CORPORATION & AFFILIATES and its licensors retain all intellectual property 4 | # and proprietary rights in and to this software, related documentation 5 | # and any modifications thereto. Any use, reproduction, disclosure or 6 | # distribution of this software and related documentation without an express 7 | # license agreement from NVIDIA CORPORATION & AFFILIATES is strictly prohibited. 8 | 9 | import math 10 | import contextlib 11 | import os 12 | import sys 13 | 14 | import torch 15 | import numpy as np 16 | import wisp._C as _C 17 | 18 | def compute_sdf( 19 | V : torch.Tensor, 20 | F : torch.Tensor, 21 | points : torch.Tensor, 22 | split_size : int = 10**6): 23 | """Computes SDF given point samples and a mesh. 24 | 25 | Args: 26 | V (torch.FloatTensor): #V, 3 array of vertices 27 | F (torch.LongTensor): #F, 3 array of indices 28 | points (torch.FloatTensor): [N, 3] array of points to sample 29 | split_size (int): The batch at which the SDF will be computed. The kernel will break for too large 30 | batches; when in doubt use the default. 31 | 32 | Returns: 33 | (torch.FloatTensor): [N, 1] array of computed SDF values. 34 | """ 35 | mesh = V[F] 36 | 37 | _points = torch.split(points, split_size) 38 | sdfs = [] 39 | for _p in _points: 40 | sdfs.append(_C.external.mesh_to_sdf_cuda(_p.cuda().contiguous(), mesh.cuda().contiguous())[0]) 41 | return torch.cat(sdfs)[...,None] 42 | -------------------------------------------------------------------------------- /third-party/kaolin-wisp/wisp/ops/mesh/per_face_normals.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2022, NVIDIA CORPORATION & AFFILIATES. All rights reserved. 2 | # 3 | # NVIDIA CORPORATION & AFFILIATES and its licensors retain all intellectual property 4 | # and proprietary rights in and to this software, related documentation 5 | # and any modifications thereto. Any use, reproduction, disclosure or 6 | # distribution of this software and related documentation without an express 7 | # license agreement from NVIDIA CORPORATION & AFFILIATES is strictly prohibited. 8 | 9 | import torch 10 | 11 | def per_face_normals( 12 | V : torch.Tensor, 13 | F : torch.Tensor): 14 | """Compute normals per face. 15 | 16 | Args: 17 | V (torch.FloatTensor): Vertices of shape [V, 3] 18 | F (torch.LongTensor): Faces of shape [F, 3] 19 | 20 | Returns: 21 | (torch.FloatTensor): Normals of shape [F, 3] 22 | """ 23 | mesh = V[F] 24 | 25 | vec_a = mesh[:, 0] - mesh[:, 1] 26 | vec_b = mesh[:, 1] - mesh[:, 2] 27 | normals = torch.cross(vec_a, vec_b) 28 | return normals 29 | 30 | -------------------------------------------------------------------------------- /third-party/kaolin-wisp/wisp/ops/mesh/point_sample.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2022, NVIDIA CORPORATION & AFFILIATES. All rights reserved. 2 | # 3 | # NVIDIA CORPORATION & AFFILIATES and its licensors retain all intellectual property 4 | # and proprietary rights in and to this software, related documentation 5 | # and any modifications thereto. Any use, reproduction, disclosure or 6 | # distribution of this software and related documentation without an express 7 | # license agreement from NVIDIA CORPORATION & AFFILIATES is strictly prohibited. 8 | 9 | import torch 10 | from .sample_near_surface import sample_near_surface 11 | from .sample_surface import sample_surface 12 | from .sample_uniform import sample_uniform 13 | from .area_weighted_distribution import area_weighted_distribution 14 | 15 | def point_sample( 16 | V : torch.Tensor, 17 | F : torch.Tensor, 18 | techniques : list, 19 | num_samples : int): 20 | """Sample points from a mesh. 21 | 22 | Args: 23 | V (torch.Tensor): #V, 3 array of vertices 24 | F (torch.Tensor): #F, 3 array of indices 25 | techniques (list[str]): list of techniques to sample with 26 | num_samples (int): points to sample per technique 27 | 28 | Returns: 29 | (torch.FloatTensor): Samples of shape [len(techniques)*num_samples, 3] 30 | """ 31 | if 'trace' in techniques or 'near' in techniques: 32 | # Precompute face distribution 33 | distrib = area_weighted_distribution(V, F) 34 | 35 | samples = [] 36 | for technique in techniques: 37 | if technique =='trace': 38 | samples.append(sample_surface(V, F, num_samples, distrib=distrib)[0]) 39 | elif technique == 'near': 40 | samples.append(sample_near_surface(V, F, num_samples, distrib=distrib)) 41 | elif technique == 'rand': 42 | samples.append(sample_uniform(num_samples).to(V.device)) 43 | samples = torch.cat(samples, dim=0) 44 | return samples 45 | 46 | -------------------------------------------------------------------------------- /third-party/kaolin-wisp/wisp/ops/mesh/random_face.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2022, NVIDIA CORPORATION & AFFILIATES. All rights reserved. 2 | # 3 | # NVIDIA CORPORATION & AFFILIATES and its licensors retain all intellectual property 4 | # and proprietary rights in and to this software, related documentation 5 | # and any modifications thereto. Any use, reproduction, disclosure or 6 | # distribution of this software and related documentation without an express 7 | # license agreement from NVIDIA CORPORATION & AFFILIATES is strictly prohibited. 8 | 9 | import torch 10 | from .area_weighted_distribution import area_weighted_distribution 11 | from .per_face_normals import per_face_normals 12 | 13 | def random_face( 14 | V : torch.Tensor, 15 | F : torch.Tensor, 16 | num_samples : int, 17 | distrib=None): 18 | """Return an area weighted random sample of faces and their normals from the mesh. 19 | 20 | Args: 21 | V (torch.Tensor): #V, 3 array of vertices 22 | F (torch.Tensor): #F, 3 array of indices 23 | num_samples (int): num of samples to return 24 | distrib: distribution to use. By default, area-weighted distribution is used. 25 | 26 | Returns: 27 | (torch.LongTensor, torch.FloatTensor): 28 | - Faces 29 | - Normals 30 | """ 31 | if distrib is None: 32 | distrib = area_weighted_distribution(V, F) 33 | 34 | normals = per_face_normals(V, F) 35 | 36 | idx = distrib.sample([num_samples]) 37 | 38 | return F[idx], normals[idx] 39 | 40 | -------------------------------------------------------------------------------- /third-party/kaolin-wisp/wisp/ops/mesh/sample_near_surface.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2022, NVIDIA CORPORATION & AFFILIATES. All rights reserved. 2 | # 3 | # NVIDIA CORPORATION & AFFILIATES and its licensors retain all intellectual property 4 | # and proprietary rights in and to this software, related documentation 5 | # and any modifications thereto. Any use, reproduction, disclosure or 6 | # distribution of this software and related documentation without an express 7 | # license agreement from NVIDIA CORPORATION & AFFILIATES is strictly prohibited. 8 | 9 | import torch 10 | from .sample_surface import sample_surface 11 | from .area_weighted_distribution import area_weighted_distribution 12 | 13 | def sample_near_surface( 14 | V : torch.Tensor, 15 | F : torch.Tensor, 16 | num_samples: int, 17 | variance : float = 0.01, 18 | distrib=None): 19 | """Sample points near the mesh surface. 20 | 21 | Args: 22 | V (torch.Tensor): #V, 3 array of vertices 23 | F (torch.Tensor): #F, 3 array of indices 24 | num_samples (int): number of surface samples 25 | distrib: distribution to use. By default, area-weighted distribution is used 26 | 27 | Returns: 28 | (torch.FloatTensor): samples of shape [num_samples, 3] 29 | """ 30 | if distrib is None: 31 | distrib = area_weighted_distribution(V, F) 32 | samples = sample_surface(V, F, num_samples, distrib)[0] 33 | samples += torch.randn_like(samples) * variance 34 | return samples 35 | -------------------------------------------------------------------------------- /third-party/kaolin-wisp/wisp/ops/mesh/sample_surface.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2022, NVIDIA CORPORATION & AFFILIATES. All rights reserved. 2 | # 3 | # NVIDIA CORPORATION & AFFILIATES and its licensors retain all intellectual property 4 | # and proprietary rights in and to this software, related documentation 5 | # and any modifications thereto. Any use, reproduction, disclosure or 6 | # distribution of this software and related documentation without an express 7 | # license agreement from NVIDIA CORPORATION & AFFILIATES is strictly prohibited. 8 | 9 | import torch 10 | from .random_face import random_face 11 | from .area_weighted_distribution import area_weighted_distribution 12 | 13 | def sample_surface( 14 | V : torch.Tensor, 15 | F : torch.Tensor, 16 | num_samples : int, 17 | distrib = None): 18 | """Sample points and their normals on mesh surface. 19 | 20 | Args: 21 | V (torch.Tensor): #V, 3 array of vertices 22 | F (torch.Tensor): #F, 3 array of indices 23 | num_samples (int): number of surface samples 24 | distrib: distribution to use. By default, area-weighted distribution is used 25 | 26 | Returns: 27 | (torch.FloatTensor): samples of shape [num_samples, 3] 28 | """ 29 | if distrib is None: 30 | distrib = area_weighted_distribution(V, F) 31 | 32 | # Select faces & sample their surface 33 | fidx, normals = random_face(V, F, num_samples, distrib) 34 | f = V[fidx] 35 | 36 | u = torch.sqrt(torch.rand(num_samples)).to(V.device).unsqueeze(-1) 37 | v = torch.rand(num_samples).to(V.device).unsqueeze(-1) 38 | 39 | samples = (1 - u) * f[:,0,:] + (u * (1 - v)) * f[:,1,:] + u * v * f[:,2,:] 40 | 41 | return samples, normals 42 | 43 | -------------------------------------------------------------------------------- /third-party/kaolin-wisp/wisp/ops/mesh/sample_uniform.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2022, NVIDIA CORPORATION & AFFILIATES. All rights reserved. 2 | # 3 | # NVIDIA CORPORATION & AFFILIATES and its licensors retain all intellectual property 4 | # and proprietary rights in and to this software, related documentation 5 | # and any modifications thereto. Any use, reproduction, disclosure or 6 | # distribution of this software and related documentation without an express 7 | # license agreement from NVIDIA CORPORATION & AFFILIATES is strictly prohibited. 8 | 9 | import torch 10 | 11 | def sample_uniform(num_samples : int): 12 | """Sample uniformly in [-1,1] bounding volume. 13 | 14 | Args: 15 | num_samples(int) : number of points to sample 16 | 17 | Returns: 18 | (torch.FloatTensor): samples of shape [num_samples, 3] 19 | """ 20 | return torch.rand(num_samples, 3) * 2.0 - 1.0 21 | 22 | -------------------------------------------------------------------------------- /third-party/kaolin-wisp/wisp/ops/pointcloud/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2022, NVIDIA CORPORATION & AFFILIATES. All rights reserved. 2 | # 3 | # NVIDIA CORPORATION & AFFILIATES and its licensors retain all intellectual property 4 | # and proprietary rights in and to this software, related documentation 5 | # and any modifications thereto. Any use, reproduction, disclosure or 6 | # distribution of this software and related documentation without an express 7 | # license agreement from NVIDIA CORPORATION & AFFILIATES is strictly prohibited. 8 | 9 | from .conversions import * 10 | from .processing import * 11 | -------------------------------------------------------------------------------- /third-party/kaolin-wisp/wisp/ops/pointcloud/conversions.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2022, NVIDIA CORPORATION & AFFILIATES. All rights reserved. 2 | # 3 | # NVIDIA CORPORATION & AFFILIATES and its licensors retain all intellectual property 4 | # and proprietary rights in and to this software, related documentation 5 | # and any modifications thereto. Any use, reproduction, disclosure or 6 | # distribution of this software and related documentation without an express 7 | # license agreement from NVIDIA CORPORATION & AFFILIATES is strictly prohibited. 8 | 9 | import torch 10 | 11 | 12 | def create_pointcloud_from_images(rgbs, masks, rays, depths): 13 | """Given depth images, will create a RGB pointcloud. 14 | 15 | TODO (ttakikawa): Probably make the input a tensor not a list... 16 | 17 | Args: 18 | rgbs (list of torch.FloatTensor): List of RGB tensors of shape [H, W, 3]. 19 | masks (list of torch.FloatTensor): List of mask tensors of shape [H, W, 1]. 20 | rays (list of wisp.core.Rays): List of rays.origins and rays.dirs of shape [H, W, 3]. 21 | depths (list of torch.FloatTensor): List of depth tensors of shape [H, W, 1]. 22 | 23 | Returns: 24 | (torch.FloatTensor, torch.FloatTensor): 25 | - 3D coordinates of shape [N*H*W, 3] 26 | - colors of shape [N*H*W, 3] 27 | """ 28 | cloud_coords = [] 29 | cloud_colors = [] 30 | 31 | for i in range(len(rgbs)): 32 | mask = masks[i].bool() 33 | h, w = mask.shape[:2] 34 | mask = mask.reshape(h, w) 35 | depth = depths[i].reshape(h, w, 1) 36 | assert(len(mask.shape) == 2 and "Mask shape is not correct... it should be [H,W], check size here") 37 | coords = rays[i].origins[mask] + rays[i].dirs[mask] * depth[mask] 38 | colors = rgbs[i][mask] 39 | cloud_coords.append(coords.reshape(-1, 3)) 40 | cloud_colors.append(colors[...,:3].reshape(-1, 3)) 41 | 42 | return torch.cat(cloud_coords, dim=0), torch.cat(cloud_colors, dim=0) 43 | -------------------------------------------------------------------------------- /third-party/kaolin-wisp/wisp/ops/pointcloud/processing.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2022, NVIDIA CORPORATION & AFFILIATES. All rights reserved. 2 | # 3 | # NVIDIA CORPORATION & AFFILIATES and its licensors retain all intellectual property 4 | # and proprietary rights in and to this software, related documentation 5 | # and any modifications thereto. Any use, reproduction, disclosure or 6 | # distribution of this software and related documentation without an express 7 | # license agreement from NVIDIA CORPORATION & AFFILIATES is strictly prohibited. 8 | 9 | import torch 10 | 11 | 12 | def normalize_pointcloud(coords, return_scale=False): 13 | """Normalizes pointcloud to an AABB within [-1, 1]. 14 | 15 | Args: 16 | coords (torch.FloatTensor): 3D coordinates of shape [N, 3] 17 | return_scale (bool): If True, will return the center of the cloud and the scaling factor. 18 | 19 | Returns: 20 | (torch.FloatTensor) or (torch.FloatTensor, torch.FloatTensor, float): 21 | - Normalized 3D coordinates of shape [N, 3] 22 | - Center of the cloud of shape [3] 23 | - Scaling factor (floating point value) 24 | """ 25 | coords_max, _ = torch.max(coords, dim=0) 26 | coords_min, _ = torch.min(coords, dim=0) 27 | coords_center = (coords_max + coords_min) / 2.0 28 | 29 | # AABB normalize 30 | coords = coords - coords_center 31 | max_dist = torch.max(coords) 32 | coords_scale = 1.0 / max_dist 33 | coords *= coords_scale 34 | 35 | if return_scale: 36 | return coords, coords_center, coords_scale 37 | else: 38 | return coords 39 | -------------------------------------------------------------------------------- /third-party/kaolin-wisp/wisp/ops/raygen/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2022, NVIDIA CORPORATION & AFFILIATES. All rights reserved. 2 | # 3 | # NVIDIA CORPORATION & AFFILIATES and its licensors retain all intellectual property 4 | # and proprietary rights in and to this software, related documentation 5 | # and any modifications thereto. Any use, reproduction, disclosure or 6 | # distribution of this software and related documentation without an express 7 | # license agreement from NVIDIA CORPORATION & AFFILIATES is strictly prohibited. 8 | 9 | from .raygen import * 10 | -------------------------------------------------------------------------------- /third-party/kaolin-wisp/wisp/ops/sdf/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2022, NVIDIA CORPORATION & AFFILIATES. All rights reserved. 2 | # 3 | # NVIDIA CORPORATION & AFFILIATES and its licensors retain all intellectual property 4 | # and proprietary rights in and to this software, related documentation 5 | # and any modifications thereto. Any use, reproduction, disclosure or 6 | # distribution of this software and related documentation without an express 7 | # license agreement from NVIDIA CORPORATION & AFFILIATES is strictly prohibited. 8 | 9 | from .metrics import * 10 | -------------------------------------------------------------------------------- /third-party/kaolin-wisp/wisp/ops/shaders/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2022, NVIDIA CORPORATION & AFFILIATES. All rights reserved. 2 | # 3 | # NVIDIA CORPORATION & AFFILIATES and its licensors retain all intellectual property 4 | # and proprietary rights in and to this software, related documentation 5 | # and any modifications thereto. Any use, reproduction, disclosure or 6 | # distribution of this software and related documentation without an express 7 | # license agreement from NVIDIA CORPORATION & AFFILIATES is strictly prohibited. 8 | 9 | from .matcap import * 10 | from .shadow_rays import * 11 | -------------------------------------------------------------------------------- /third-party/kaolin-wisp/wisp/ops/spc/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2022, NVIDIA CORPORATION & AFFILIATES. All rights reserved. 2 | # 3 | # NVIDIA CORPORATION & AFFILIATES and its licensors retain all intellectual property 4 | # and proprietary rights in and to this software, related documentation 5 | # and any modifications thereto. Any use, reproduction, disclosure or 6 | # distribution of this software and related documentation without an express 7 | # license agreement from NVIDIA CORPORATION & AFFILIATES is strictly prohibited. 8 | 9 | from .constructors import * 10 | from .conversions import * 11 | from .metrics import * 12 | from .processing import * 13 | from .sampling import * 14 | -------------------------------------------------------------------------------- /third-party/kaolin-wisp/wisp/ops/spc/constructors.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2022, NVIDIA CORPORATION & AFFILIATES. All rights reserved. 2 | # 3 | # NVIDIA CORPORATION & AFFILIATES and its licensors retain all intellectual property 4 | # and proprietary rights in and to this software, related documentation 5 | # and any modifications thereto. Any use, reproduction, disclosure or 6 | # distribution of this software and related documentation without an express 7 | # license agreement from NVIDIA CORPORATION & AFFILIATES is strictly prohibited. 8 | 9 | import torch 10 | import numpy as np 11 | import kaolin.ops.spc as spc_ops 12 | 13 | 14 | def create_dense_octree(level): 15 | """Creates a dense SPC model 16 | 17 | Args: 18 | level (int): The level at which the octree will be initialized to. 19 | 20 | Returns: 21 | (torch.ByteTensor): the octree tensor 22 | """ 23 | coords = np.arange(2**level) 24 | points = np.array(np.meshgrid(coords, coords, coords, indexing='xy')) 25 | points = points.transpose(3,2,1,0).reshape(-1, 3) 26 | points = torch.from_numpy(points).short().cuda() 27 | octree = spc_ops.unbatched_points_to_octree(points, level) 28 | return octree 29 | 30 | 31 | def make_trilinear_spc(points, pyramid): 32 | """Builds a trilinear spc from a regular spc. 33 | 34 | Args: 35 | points (torch.ShortTensor): The point_hierarchy. 36 | pyramid (torch.LongTensor): The pyramid tensor. 37 | 38 | Returns: 39 | (torch.ShortTensor, torch.LongTensor, torch.LongTensor, torch.LongTensor) 40 | - The dual point_hierarchy. 41 | - The dual pyramid. 42 | - The trinkets. 43 | - The parent pointers. 44 | """ 45 | points_dual, pyramid_dual = spc_ops.unbatched_make_dual(points, pyramid) 46 | trinkets, parents = spc_ops.unbatched_make_trinkets(points, pyramid, points_dual, pyramid_dual) 47 | return points_dual, pyramid_dual, trinkets, parents 48 | -------------------------------------------------------------------------------- /third-party/kaolin-wisp/wisp/ops/spc/metrics.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2022, NVIDIA CORPORATION & AFFILIATES. All rights reserved. 2 | # 3 | # NVIDIA CORPORATION & AFFILIATES and its licensors retain all intellectual property 4 | # and proprietary rights in and to this software, related documentation 5 | # and any modifications thereto. Any use, reproduction, disclosure or 6 | # distribution of this software and related documentation without an express 7 | # license agreement from NVIDIA CORPORATION & AFFILIATES is strictly prohibited. 8 | 9 | import torch 10 | 11 | 12 | def total_variation(pidx, trinkets, features, level): 13 | """Calculates total variation for the voxels specified by the pidx. 14 | 15 | Args: 16 | pidx : int tensor of size [N] specifying the point indices to calculate TV on. 17 | trinkets : the trinkets. 18 | features : the features for the given level. (assumes the correct level is given) 19 | level : int specifying the level of spc 20 | 21 | Returns: 22 | (torch.FloatTensor): Total variation of shape [1] 23 | """ 24 | resolution = 2**level 25 | # N, 8, F tensor of features 26 | feats = features[trinkets.index_select(0, pidx).long()] 27 | 28 | # N, F 29 | diff_x = ((torch.abs(feats[:, [4,5,6,7]] - feats[:, [0,1,2,3]]) / resolution)**2).sum((1,2)) 30 | diff_y = ((torch.abs(feats[:, [2,3,6,7]] - feats[:, [0,1,4,5]]) / resolution)**2).sum((1,2)) 31 | diff_z = ((torch.abs(feats[:, [1,3,5,7]] - feats[:, [0,2,4,6]]) / resolution)**2).sum((1,2)) 32 | return diff_x + diff_y + diff_z 33 | -------------------------------------------------------------------------------- /third-party/kaolin-wisp/wisp/renderer/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2022, NVIDIA CORPORATION & AFFILIATES. All rights reserved. 2 | # 3 | # NVIDIA CORPORATION & AFFILIATES and its licensors retain all intellectual property 4 | # and proprietary rights in and to this software, related documentation 5 | # and any modifications thereto. Any use, reproduction, disclosure or 6 | # distribution of this software and related documentation without an express 7 | # license agreement from NVIDIA CORPORATION & AFFILIATES is strictly prohibited. 8 | -------------------------------------------------------------------------------- /third-party/kaolin-wisp/wisp/renderer/app/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2022, NVIDIA CORPORATION & AFFILIATES. All rights reserved. 2 | # 3 | # NVIDIA CORPORATION & AFFILIATES and its licensors retain all intellectual property 4 | # and proprietary rights in and to this software, related documentation 5 | # and any modifications thereto. Any use, reproduction, disclosure or 6 | # distribution of this software and related documentation without an express 7 | # license agreement from NVIDIA CORPORATION & AFFILIATES is strictly prohibited. 8 | 9 | 10 | from .wisp_app import WispApp 11 | from .optimization_app import OptimizationApp 12 | -------------------------------------------------------------------------------- /third-party/kaolin-wisp/wisp/renderer/core/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2022, NVIDIA CORPORATION & AFFILIATES. All rights reserved. 2 | # 3 | # NVIDIA CORPORATION & AFFILIATES and its licensors retain all intellectual property 4 | # and proprietary rights in and to this software, related documentation 5 | # and any modifications thereto. Any use, reproduction, disclosure or 6 | # distribution of this software and related documentation without an express 7 | # license agreement from NVIDIA CORPORATION & AFFILIATES is strictly prohibited. 8 | 9 | from .render_core import * 10 | -------------------------------------------------------------------------------- /third-party/kaolin-wisp/wisp/renderer/core/api/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2022, NVIDIA CORPORATION & AFFILIATES. All rights reserved. 2 | # 3 | # NVIDIA CORPORATION & AFFILIATES and its licensors retain all intellectual property 4 | # and proprietary rights in and to this software, related documentation 5 | # and any modifications thereto. Any use, reproduction, disclosure or 6 | # distribution of this software and related documentation without an express 7 | # license agreement from NVIDIA CORPORATION & AFFILIATES is strictly prohibited. 8 | 9 | from .renderers_factory import * 10 | from .base_renderer import * 11 | from .decorators import * 12 | from .scenegraph import * 13 | -------------------------------------------------------------------------------- /third-party/kaolin-wisp/wisp/renderer/core/api/decorators.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2022, NVIDIA CORPORATION & AFFILIATES. All rights reserved. 2 | # 3 | # NVIDIA CORPORATION & AFFILIATES and its licensors retain all intellectual property 4 | # and proprietary rights in and to this software, related documentation 5 | # and any modifications thereto. Any use, reproduction, disclosure or 6 | # distribution of this software and related documentation without an express 7 | # license agreement from NVIDIA CORPORATION & AFFILIATES is strictly prohibited. 8 | 9 | from __future__ import annotations 10 | from typing import Type 11 | from wisp.models.nefs import BaseNeuralField 12 | from wisp.tracers import BaseTracer 13 | from wisp.renderer.core.api import BottomLevelRenderer, register_neural_field_type 14 | 15 | 16 | def field_renderer(field_type: Type[BaseNeuralField], tracer_type: Type[BaseTracer]): 17 | """ A decorator that registers a neural field type with a renderer. 18 | By registering the renderer type, the interactive renderer knows what type of renderer to create 19 | when dealing with this type of field. 20 | Essentially, this allows displaying custom types of objects on the canvas. 21 | """ 22 | def _register_renderer_fn(renderer_class: Type[BottomLevelRenderer]): 23 | register_neural_field_type(field_type, tracer_type, renderer_class) 24 | return renderer_class 25 | return _register_renderer_fn 26 | -------------------------------------------------------------------------------- /third-party/kaolin-wisp/wisp/renderer/core/control/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2022, NVIDIA CORPORATION & AFFILIATES. All rights reserved. 2 | # 3 | # NVIDIA CORPORATION & AFFILIATES and its licensors retain all intellectual property 4 | # and proprietary rights in and to this software, related documentation 5 | # and any modifications thereto. Any use, reproduction, disclosure or 6 | # distribution of this software and related documentation without an express 7 | # license agreement from NVIDIA CORPORATION & AFFILIATES is strictly prohibited. 8 | 9 | 10 | from .io import * 11 | from .camera_controller_mode import * 12 | from .first_person import * 13 | from .trackball import * 14 | from .turntable import * 15 | -------------------------------------------------------------------------------- /third-party/kaolin-wisp/wisp/renderer/core/renderers/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2022, NVIDIA CORPORATION & AFFILIATES. All rights reserved. 2 | # 3 | # NVIDIA CORPORATION & AFFILIATES and its licensors retain all intellectual property 4 | # and proprietary rights in and to this software, related documentation 5 | # and any modifications thereto. Any use, reproduction, disclosure or 6 | # distribution of this software and related documentation without an express 7 | # license agreement from NVIDIA CORPORATION & AFFILIATES is strictly prohibited. 8 | 9 | from .radiance_pipeline_renderer import NeuralRadianceFieldPackedRenderer 10 | from .sdf_pipeline_renderer import NeuralSDFPackedRenderer 11 | from .spc_pipeline_renderer import SPCRenderer 12 | -------------------------------------------------------------------------------- /third-party/kaolin-wisp/wisp/renderer/gizmos/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2022, NVIDIA CORPORATION & AFFILIATES. All rights reserved. 2 | # 3 | # NVIDIA CORPORATION & AFFILIATES and its licensors retain all intellectual property 4 | # and proprietary rights in and to this software, related documentation 5 | # and any modifications thereto. Any use, reproduction, disclosure or 6 | # distribution of this software and related documentation without an express 7 | # license agreement from NVIDIA CORPORATION & AFFILIATES is strictly prohibited. 8 | 9 | 10 | from .gizmo import * 11 | from .ogl.world_grid import * 12 | from .ogl.axis_painter import * 13 | from .ogl.primitives_painter import * 14 | -------------------------------------------------------------------------------- /third-party/kaolin-wisp/wisp/renderer/gizmos/gizmo.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2022, NVIDIA CORPORATION & AFFILIATES. All rights reserved. 2 | # 3 | # NVIDIA CORPORATION & AFFILIATES and its licensors retain all intellectual property 4 | # and proprietary rights in and to this software, related documentation 5 | # and any modifications thereto. Any use, reproduction, disclosure or 6 | # distribution of this software and related documentation without an express 7 | # license agreement from NVIDIA CORPORATION & AFFILIATES is strictly prohibited. 8 | 9 | 10 | from abc import ABC, abstractmethod 11 | from kaolin.render.camera import Camera 12 | 13 | 14 | class Gizmo(ABC): 15 | """ 16 | A template for representing gizmos the interactive renderer is able to render over the canvas. 17 | Gizmos are entities rendered by the graphics api (i.e: OpenGL). 18 | Normally they're used to draw transient markups or tools over the canvas (such as a world grid or axes). 19 | """ 20 | 21 | @abstractmethod 22 | def render(self, camera: Camera): 23 | """ Renders the gizmo using the graphics api. """ 24 | raise NotImplementedError("Gizmos must implement the render function") 25 | 26 | @abstractmethod 27 | def destroy(self): 28 | """ Release GL resources, must be called from the rendering thread which owns the GL context """ 29 | raise NotImplementedError("Gizmos must implement the destroy function") 30 | -------------------------------------------------------------------------------- /third-party/kaolin-wisp/wisp/renderer/gizmos/ogl/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2022, NVIDIA CORPORATION & AFFILIATES. All rights reserved. 2 | # 3 | # NVIDIA CORPORATION & AFFILIATES and its licensors retain all intellectual property 4 | # and proprietary rights in and to this software, related documentation 5 | # and any modifications thereto. Any use, reproduction, disclosure or 6 | # distribution of this software and related documentation without an express 7 | # license agreement from NVIDIA CORPORATION & AFFILIATES is strictly prohibited. 8 | -------------------------------------------------------------------------------- /third-party/kaolin-wisp/wisp/renderer/gui/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2022, NVIDIA CORPORATION & AFFILIATES. All rights reserved. 2 | # 3 | # NVIDIA CORPORATION & AFFILIATES and its licensors retain all intellectual property 4 | # and proprietary rights in and to this software, related documentation 5 | # and any modifications thereto. Any use, reproduction, disclosure or 6 | # distribution of this software and related documentation without an express 7 | # license agreement from NVIDIA CORPORATION & AFFILIATES is strictly prohibited. 8 | 9 | from .imgui.widget_cameras import * 10 | from .imgui.widget_dictionary_octree_grid import * 11 | from .imgui.widget_gpu_stats import * 12 | from .imgui.widget_imgui import * 13 | from .imgui.widget_octree_grid import * 14 | from .imgui.widget_optimization import * 15 | from .imgui.widget_property_editor import * 16 | from .imgui.widget_radiance_pipeline import * 17 | from .imgui.widget_radiance_pipeline_renderer import * 18 | from .imgui.widget_renderer_properties import * 19 | from .imgui.widget_scene_graph import * 20 | from .imgui.widget_sdf_pipeline import * 21 | from .imgui.widget_sdf_pipeline_renderer import * 22 | from .imgui.widget_triplanar_grid import * 23 | -------------------------------------------------------------------------------- /third-party/kaolin-wisp/wisp/renderer/gui/imgui/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2022, NVIDIA CORPORATION & AFFILIATES. All rights reserved. 2 | # 3 | # NVIDIA CORPORATION & AFFILIATES and its licensors retain all intellectual property 4 | # and proprietary rights in and to this software, related documentation 5 | # and any modifications thereto. Any use, reproduction, disclosure or 6 | # distribution of this software and related documentation without an express 7 | # license agreement from NVIDIA CORPORATION & AFFILIATES is strictly prohibited. 8 | -------------------------------------------------------------------------------- /third-party/kaolin-wisp/wisp/renderer/gui/imgui/widget_imgui.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2022, NVIDIA CORPORATION & AFFILIATES. All rights reserved. 2 | # 3 | # NVIDIA CORPORATION & AFFILIATES and its licensors retain all intellectual property 4 | # and proprietary rights in and to this software, related documentation 5 | # and any modifications thereto. Any use, reproduction, disclosure or 6 | # distribution of this software and related documentation without an express 7 | # license agreement from NVIDIA CORPORATION & AFFILIATES is strictly prohibited. 8 | 9 | from abc import ABC, abstractmethod 10 | from wisp.framework import WispState 11 | 12 | 13 | class WidgetImgui(ABC): 14 | def __init__(self): 15 | pass 16 | 17 | @abstractmethod 18 | def paint(self, state: WispState, *args, **kwargs): 19 | raise NotImplementedError('imgui widgets must implement the paint method.') 20 | -------------------------------------------------------------------------------- /third-party/kaolin-wisp/wisp/renderer/gui/imgui/widget_triplanar_grid.py: -------------------------------------------------------------------------------- 1 | import numpy as np 2 | import imgui 3 | from wisp.framework import WispState 4 | from wisp.models.grids import TriplanarGrid 5 | from .widget_imgui import WidgetImgui 6 | from .widget_property_editor import WidgetPropertyEditor 7 | 8 | 9 | class WidgetTriplanarGrid(WidgetImgui): 10 | def __init__(self): 11 | super().__init__() 12 | self.properties_widget = WidgetPropertyEditor() 13 | 14 | def paint(self, state: WispState, triplanar_grid: TriplanarGrid = None, *args, **kwargs): 15 | if triplanar_grid is not None: 16 | properties = { 17 | "Feature Dims": triplanar_grid.feature_dim, 18 | "Total LODs": triplanar_grid.max_lod, 19 | "Active feature LODs": ', '.join([str(x) for x in triplanar_grid.active_lods]), 20 | "Interpolation": triplanar_grid.interpolation_type, 21 | "Multiscale aggregation": triplanar_grid.multiscale_type 22 | } 23 | self.properties_widget.paint(state=state, properties=properties) 24 | 25 | # pyramid = triplanar_grid.blas.pyramid 26 | # if pyramid is not None and pyramid.shape[1] > 1: 27 | # points_per_lod = pyramid[0, :-2].cpu().numpy() 28 | # imgui.text(f"Occupancy per LOD (%):") 29 | # occupancy_hist = [occupied_cells / 8**lod for lod, occupied_cells in enumerate(points_per_lod)] 30 | # width, height = imgui.get_content_region_available() 31 | # imgui.plot_histogram(label="##octree_grid", values=np.array(occupancy_hist, dtype=np.float32), 32 | # graph_size=(width, 20)) -------------------------------------------------------------------------------- /third-party/kaolin-wisp/wisp/tracers/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2022, NVIDIA CORPORATION & AFFILIATES. All rights reserved. 2 | # 3 | # NVIDIA CORPORATION & AFFILIATES and its licensors retain all intellectual property 4 | # and proprietary rights in and to this software, related documentation 5 | # and any modifications thereto. Any use, reproduction, disclosure or 6 | # distribution of this software and related documentation without an express 7 | # license agreement from NVIDIA CORPORATION & AFFILIATES is strictly prohibited. 8 | 9 | from .base_tracer import BaseTracer 10 | from .packed_rf_tracer import PackedRFTracer 11 | from .packed_sdf_tracer import PackedSDFTracer 12 | from .packed_spc_tracer import PackedSPCTracer 13 | -------------------------------------------------------------------------------- /third-party/kaolin-wisp/wisp/trainers/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2022, NVIDIA CORPORATION & AFFILIATES. All rights reserved. 2 | # 3 | # NVIDIA CORPORATION & AFFILIATES and its licensors retain all intellectual property 4 | # and proprietary rights in and to this software, related documentation 5 | # and any modifications thereto. Any use, reproduction, disclosure or 6 | # distribution of this software and related documentation without an express 7 | # license agreement from NVIDIA CORPORATION & AFFILIATES is strictly prohibited. 8 | 9 | from .base_trainer import BaseTrainer, log_metric_to_wandb, log_images_to_wandb 10 | from .multiview_trainer import MultiviewTrainer 11 | from .sdf_trainer import SDFTrainer 12 | -------------------------------------------------------------------------------- /third-party/kaolin-wisp/wisp/utils/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2022, NVIDIA CORPORATION & AFFILIATES. All rights reserved. 2 | # 3 | # NVIDIA CORPORATION & AFFILIATES and its licensors retain all intellectual property 4 | # and proprietary rights in and to this software, related documentation 5 | # and any modifications thereto. Any use, reproduction, disclosure or 6 | # distribution of this software and related documentation without an express 7 | # license agreement from NVIDIA CORPORATION & AFFILIATES is strictly prohibited. 8 | 9 | from .helper_classes import DotDict 10 | from .debug import PsDebugger 11 | from .perf import PerfTimer, print_gpu_memory 12 | -------------------------------------------------------------------------------- /third-party/kaolin-wisp/wisp/utils/helper_classes.py: -------------------------------------------------------------------------------- 1 | class DotDict(dict): 2 | """ 3 | from https://stackoverflow.com/questions/13520421/recursive-dotdict 4 | 5 | a dictionary that supports dot notation 6 | as well as dictionary access notation 7 | usage: d = DotDict() or d = DotDict({'val1':'first'}) 8 | set attributes: d.val2 = 'second' or d['val2'] = 'second' 9 | get attributes: d.val2 or d['val2'] 10 | """ 11 | 12 | __getattr__ = dict.__getitem__ 13 | __setattr__ = dict.__setitem__ 14 | __delattr__ = dict.__delitem__ 15 | 16 | def __init__(self, dct=None): 17 | if dct is not None: 18 | for key, value in dct.items(): 19 | if hasattr(value, "keys"): 20 | value = DotDict(value) 21 | self[key] = value 22 | -------------------------------------------------------------------------------- /third-party/kaolin/.dockerignore: -------------------------------------------------------------------------------- 1 | **/.git 2 | ci 3 | .gitlab-ci.yml 4 | **/.gitignore 5 | **/.gitmodules 6 | -------------------------------------------------------------------------------- /third-party/kaolin/.drone.yml: -------------------------------------------------------------------------------- 1 | kind: pipeline 2 | type: docker 3 | name: default 4 | 5 | environment: 6 | CUDA_VERSION: "10.1" 7 | PYTORCH_VERSION: "1.6" 8 | CUDNN_VERSION: "7" 9 | TORCH_CUDA_ARCH_LIST: "5.2 6.0 6.1 7.0 7.5+PTX" 10 | KAOLIN_INSTALL_EXPERIMENTAL: "1" 11 | 12 | steps: 13 | - name: submodules 14 | image: nvidia/cuda:10.1-cudnn7-devel-ubuntu18.04 15 | commands: 16 | - apt-get update && apt-get install -y git 17 | - git submodule update --init --recursive 18 | 19 | - name: flake8 20 | image: nvidia/cuda:10.1-cudnn7-devel-ubuntu18.04 21 | commands: 22 | - > 23 | apt-get update && apt-get install -y --no-install-recommends 24 | python3-pip 25 | - pip3 install --upgrade pip>=19.3 26 | - pip install -r tools/ci_requirements.txt 27 | - flake8 --config=.flake8 . 28 | 29 | - name: pytest 30 | image: nvidia/cuda:10.1-cudnn7-devel-ubuntu18.04 31 | commands: 32 | - > 33 | apt-get update && apt-get install -y --no-install-recommends 34 | build-essential 35 | curl 36 | && apt-get clean 37 | && rm -rf /var/lib/apt/lists/* 38 | - > 39 | curl -o ~/miniconda.sh https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh && 40 | sh ~/miniconda.sh -b -p /opt/conda && 41 | /opt/conda/bin/conda install -y python=3.7 && 42 | /opt/conda/bin/conda clean -ya 43 | - export PATH=/opt/conda/bin:$PATH 44 | - pip install --upgrade pip>=19.3 45 | - conda install -y pytorch==1.6 cudatoolkit=10.1 -c pytorch 46 | - conda install -c conda-forge nodejs 47 | - > 48 | apt-get update && apt-get install -y --no-install-recommends 49 | libgtk2.0-0 libgtk-3-0 libgbm-dev libnotify-dev libgconf-2-4 libnss3 libxss1 libasound2 libxtst6 xauth xvfb 50 | - npm install 51 | - python setup.py develop 52 | - pip install -r tools/ci_requirements.txt 53 | - pytest --cov=kaolin/ tests/python tests/integration && pytest --doctest-modules kaolin/ 54 | -------------------------------------------------------------------------------- /third-party/kaolin/.flake8: -------------------------------------------------------------------------------- 1 | [flake8] 2 | select = B,C,E,F,P,T4,W,B9 3 | max-line-length = 120 4 | # C408 ignored because we like the dict keyword argument syntax 5 | # E501 is not flexible enough, we're using B950 instead 6 | ignore = 7 | E203,E305,E402,E501,E721,E741,F403,F405,F821,F841,F999,W503,W504,C408,E302,W291,E303, 8 | # these ignores are from flake8-bugbear; please fix! 9 | B007,B008, 10 | # these ignores are from flake8-comprehensions; please fix! 11 | C400,C401,C402,C403,C404,C405,C407,C411 12 | per-file-ignores = __init__.py: F401 13 | exclude = .git, tests/, build/, _build/, .eggs/ 14 | -------------------------------------------------------------------------------- /third-party/kaolin/.readthedocs.yml: -------------------------------------------------------------------------------- 1 | version: 2 2 | 3 | python: 4 | version: 3.7 5 | system_packages: true 6 | install: 7 | - requirements: docs/readthedocs_requirements.txt 8 | - requirements: tools/doc_requirements.txt 9 | - method: setuptools 10 | path: '.' 11 | 12 | sphinx: 13 | configuration: docs/conf.py 14 | fail_on_warning: true 15 | -------------------------------------------------------------------------------- /third-party/kaolin/COPYRIGHT: -------------------------------------------------------------------------------- 1 | Copyright (c) 2019, NVIDIA CORPORATION. All rights reserved. 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. -------------------------------------------------------------------------------- /third-party/kaolin/MANIFEST.in: -------------------------------------------------------------------------------- 1 | recursive-include kaolin/experimental/dash3d/static * 2 | recursive-include kaolin/experimental/dash3d/templates * -------------------------------------------------------------------------------- /third-party/kaolin/docs/Makefile: -------------------------------------------------------------------------------- 1 | # Minimal makefile for Sphinx documentation 2 | # 3 | 4 | # You can set these variables from the command line, and also 5 | # from the environment for the first two. 6 | SPHINXOPTS ?= 7 | SPHINXBUILD ?= sphinx-build 8 | SOURCEDIR = . 9 | BUILDDIR = _build 10 | 11 | # Put it first so that "make" without argument is like "make help". 12 | help: 13 | @$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) 14 | 15 | .PHONY: help Makefile 16 | 17 | # Catch-all target: route all unknown targets to Sphinx using the new 18 | # "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS). 19 | %: Makefile 20 | @$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) 21 | -------------------------------------------------------------------------------- /third-party/kaolin/docs/index.rst: -------------------------------------------------------------------------------- 1 | Welcome to Kaolin Library Documentation 2 | ======================================= 3 | 4 | .. image:: ../assets/kaolin.png 5 | 6 | NVIDIA Kaolin library provides a PyTorch API for working with a variety of 3D representations and includes a growing collection of GPU-optimized operations such as modular differentiable rendering, fast conversions between representations, data loading, 3D checkpoints and more. 7 | See :ref:`Installation `, :ref:`API Overview ` and :ref:`Tutorials ` to get started! 8 | 9 | Kaolin library is part of a larger suite of tools for 3D deep learning research. For example, `Omniverse Kaolin app `_ allows interactive visualization of 3D checkpoints. To find out more about the Kaolin ecosystem, visit the `NVIDIA Kaolin Dev Zone page `_. 10 | 11 | 12 | .. toctree:: 13 | :titlesonly: 14 | :maxdepth: 1 15 | :caption: Tutorials: 16 | 17 | notes/tutorial_index 18 | notes/checkpoints 19 | notes/diff_render 20 | notes/spc_summary 21 | 22 | .. toctree:: 23 | :titlesonly: 24 | :maxdepth: 1 25 | :caption: API Reference: 26 | 27 | modules/kaolin.ops 28 | modules/kaolin.metrics 29 | modules/kaolin.io 30 | modules/kaolin.render 31 | modules/kaolin.rep 32 | modules/kaolin.utils 33 | modules/kaolin.visualize 34 | -------------------------------------------------------------------------------- /third-party/kaolin/docs/make.bat: -------------------------------------------------------------------------------- 1 | @ECHO OFF 2 | 3 | pushd %~dp0 4 | 5 | REM Command file for Sphinx documentation 6 | 7 | set KAOLIN_ROOT=%~dp0.. 8 | echo "%KAOLIN_ROOT%\docs\modules\" 9 | 10 | REM not to be used by end users 11 | set EXCLUDE_PATHS="%KAOLIN_ROOT%\kaolin\packed\ %KAOLIN_ROOT%\kaolin\padded\ %KAOLIN_ROOT%\kaolin\unbatched\ \kaolin\*_cuda.*" 12 | REM Those files are unused since we already have index.rst and conf.py 13 | set EXCLUDE_GEN_RST=%KAOLIN_ROOT%\docs\modules\setup.rst %KAOLIN_ROOT%\docs\modules\kaolin.rst %KAOLIN_ROOT%\docs\modules\kaolin.version.rst 14 | 15 | sphinx-apidoc -eT -d 2 --templatedir=%KAOLIN_ROOT%\docs\modules\ -o %KAOLIN_ROOT%\docs\modules\ %KAOLIN_ROOT% %EXCLUDE_PATHS% 16 | 17 | echo %EXCLUDE_GEN_RST% 18 | del %EXCLUDE_GEN_RST% 19 | 20 | 21 | if "%SPHINXBUILD%" == "" ( 22 | set SPHINXBUILD=sphinx-build 23 | ) 24 | set SOURCEDIR=. 25 | set BUILDDIR=_build 26 | 27 | if "%1" == "" goto help 28 | 29 | %SPHINXBUILD% >NUL 2>NUL 30 | if errorlevel 9009 ( 31 | echo. 32 | echo.The 'sphinx-build' command was not found. Make sure you have Sphinx 33 | echo.installed, then set the SPHINXBUILD environment variable to point 34 | echo.to the full path of the 'sphinx-build' executable. Alternatively you 35 | echo.may add the Sphinx directory to PATH. 36 | echo. 37 | echo.If you don't have Sphinx installed, grab it from 38 | echo.http://sphinx-doc.org/ 39 | exit /b 1 40 | ) 41 | 42 | %SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O% 43 | goto end 44 | 45 | :help 46 | %SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O% 47 | 48 | :end 49 | popd 50 | -------------------------------------------------------------------------------- /third-party/kaolin/docs/modules/kaolin.io.materials.rst: -------------------------------------------------------------------------------- 1 | .. _kaolin.io.materials: 2 | 3 | kaolin.io.materials 4 | =================== 5 | 6 | .. currentmodule:: kaolin.io.materials 7 | 8 | API 9 | --- 10 | 11 | Functions 12 | 13 | =================== 14 | 15 | API 16 | --- 17 | 18 | .. automodule:: kaolin.io.materials 19 | :members: 20 | :exclude-members: 21 | MaterialError, 22 | MaterialLoadError, 23 | MaterialFileError, 24 | MaterialNotFoundError 25 | 26 | Exceptions 27 | ---------- 28 | 29 | .. autoclass:: MaterialError 30 | .. autoclass:: MaterialLoadError 31 | .. autoclass:: MaterialFileError 32 | .. autoclass:: MaterialNotFoundError 33 | -------------------------------------------------------------------------------- /third-party/kaolin/docs/modules/kaolin.io.obj.rst: -------------------------------------------------------------------------------- 1 | .. _kaolin.io.obj: 2 | 3 | kaolin.io.obj 4 | ============= 5 | 6 | .. currentmodule:: kaolin.io.obj 7 | 8 | API 9 | --- 10 | 11 | Functions 12 | --------- 13 | 14 | .. automodule:: kaolin.io.obj 15 | :members: 16 | :exclude-members: 17 | return_type, 18 | ignore_error_handler, 19 | skip_error_handler, 20 | default_error_handler, 21 | MaterialError, 22 | MaterialLoadError, 23 | MaterialFileError, 24 | MaterialNotFoundError 25 | 26 | Error Handler 27 | ------------- 28 | 29 | .. autofunction:: ignore_error_handler 30 | .. autofunction:: skip_error_handler 31 | .. autofunction:: default_error_handler 32 | -------------------------------------------------------------------------------- /third-party/kaolin/docs/modules/kaolin.io.rst: -------------------------------------------------------------------------------- 1 | .. _kaolin.io: 2 | 3 | kaolin.io 4 | ========= 5 | 6 | IO directory contains all the functionalities to interact with data files. 7 | 8 | :ref:`obj module` and :ref:`usd module ` contains importer to .obj and o, importers / exporters to .usd(a) files, 9 | :ref:`dataset module` contains helper features for caching data, and preprocessing whole datasets, 10 | and :ref:`materials module` contains Materials definition that should be used throughout Kaolin. 11 | 12 | .. toctree:: 13 | :maxdepth: 2 14 | :titlesonly: 15 | 16 | kaolin.io.dataset 17 | kaolin.io.materials 18 | kaolin.io.obj 19 | kaolin.io.off 20 | kaolin.io.render 21 | kaolin.io.shapenet 22 | kaolin.io.usd 23 | kaolin.io.modelnet 24 | kaolin.io.shrec 25 | kaolin.io.utils 26 | -------------------------------------------------------------------------------- /third-party/kaolin/docs/modules/kaolin.io.shapenet.rst: -------------------------------------------------------------------------------- 1 | kaolin.io.shapenet 2 | ================== 3 | 4 | API 5 | --- 6 | 7 | .. automodule:: kaolin.io.shapenet 8 | :members: 9 | :undoc-members: 10 | :show-inheritance: 11 | -------------------------------------------------------------------------------- /third-party/kaolin/docs/modules/kaolin.metrics.rst: -------------------------------------------------------------------------------- 1 | .. _kaolin.metrics: 2 | 3 | kaolin.metrics 4 | ============== 5 | 6 | Metrics are differentiable operators that can be used to compute loss or accuracy. 7 | 8 | We currently provide an IoU for voxelgrid, sided distance based metrics such as chamfer distance, 9 | point_to_mesh_distance and other simple regularization such as uniform_laplacian_smoothing. 10 | For tetrahedral mesh, we support the equivolume and AMIPS losses. 11 | 12 | .. toctree:: 13 | :maxdepth: 2 14 | :titlesonly: 15 | 16 | kaolin.metrics.pointcloud 17 | kaolin.metrics.render 18 | kaolin.metrics.trianglemesh 19 | kaolin.metrics.voxelgrid 20 | kaolin.metrics.tetmesh 21 | -------------------------------------------------------------------------------- /third-party/kaolin/docs/modules/kaolin.metrics.tetmesh.rst: -------------------------------------------------------------------------------- 1 | .. _kaolin.metrics.tetmesh: 2 | 3 | kaolin.metrics.tetmesh 4 | ====================== 5 | 6 | API 7 | --- 8 | 9 | .. automodule:: kaolin.metrics.tetmesh 10 | :members: 11 | :undoc-members: 12 | :show-inheritance: 13 | -------------------------------------------------------------------------------- /third-party/kaolin/docs/modules/kaolin.ops.conversions.rst: -------------------------------------------------------------------------------- 1 | .. _kaolin.ops.conversions: 2 | 3 | kaolin.ops.conversions 4 | ====================== 5 | 6 | API 7 | --- 8 | 9 | .. automodule:: kaolin.ops.conversions 10 | :members: 11 | :undoc-members: 12 | :show-inheritance: 13 | -------------------------------------------------------------------------------- /third-party/kaolin/docs/modules/kaolin.ops.mesh.rst: -------------------------------------------------------------------------------- 1 | .. _kaolin.ops.mesh: 2 | 3 | kaolin.ops.mesh 4 | *********************** 5 | 6 | A mesh is a 3D object representation consisting of a collection of vertices and polygons. 7 | 8 | Triangular meshes 9 | ================== 10 | 11 | Triangular meshes comprise of a set of triangles that are connected by their common edges or corners. In Kaolin, they are usually represented as a set of two tensors: 12 | 13 | * ``vertices``: A :class:`torch.Tensor`, of shape :math:`(\text{batch_size}, \text{num_vertices}, 3)`, contains the vertices coordinates. 14 | 15 | * ``faces``: A :class:`torch.LongTensor`, of shape :math:`(\text{batch_size}, \text{num_faces}, 3)`, contains the mesh topology, by listing the vertices index for each face. 16 | 17 | Both tensors can be combined using :func:`kaolin.ops.mesh.index_vertices_by_faces`, to form ``face_vertices``, of shape :math:`(\text{batch_size}, \text{num_faces}, 3, 3)`, listing the vertices coordinate for each face. 18 | 19 | 20 | Tetrahedral meshes 21 | ================== 22 | 23 | A tetrahedron or triangular pyramid is a polyhedron composed of four triangular faces, six straight edges, and four vertex corners. Tetrahedral meshes inside Kaolin are composed of two tensors: 24 | 25 | * ``vertices``: A :class:`torch.Tensor`, of shape :math:`(\text{batch_size}, \text{num_vertices}, 3)`, contains the vertices coordinates. 26 | 27 | * ``tet``: A :class:`torch.LongTensor`, of shape :math:`(\text{batch_size}, \text{num_tet}, 4)`, contains the tetrahedral mesh topology, by listing the vertices index for each tetrahedron. 28 | 29 | Both tensors can be combined, to form ``tet_vertices``, of shape :math:`(\text{batch_size}, \text{num_tet}, 4, 3)`, listing the tetrahedrons vertices coordinates for each face. 30 | 31 | 32 | API 33 | --- 34 | 35 | .. automodule:: kaolin.ops.mesh 36 | :members: 37 | :undoc-members: 38 | :show-inheritance: 39 | -------------------------------------------------------------------------------- /third-party/kaolin/docs/modules/kaolin.ops.rst: -------------------------------------------------------------------------------- 1 | .. _kaolin.ops: 2 | 3 | kaolin.ops 4 | ========== 5 | 6 | Operators are primitive processing functions for batched 3D models (:ref:`meshes`, :ref:`voxelgrids` and point clouds). 7 | 8 | Tensor batching operators are in :ref:`kaolin.ops.batch`, conversions of 3D models between different representations are in :ref:`kaolin.ops.conversions`. 9 | 10 | .. toctree:: 11 | :maxdepth: 2 12 | :titlesonly: 13 | 14 | kaolin.ops.batch 15 | kaolin.ops.coords 16 | kaolin.ops.conversions 17 | kaolin.ops.gcn 18 | kaolin.ops.mesh 19 | kaolin.ops.random 20 | kaolin.ops.reduction 21 | kaolin.ops.spc 22 | kaolin.ops.voxelgrid 23 | -------------------------------------------------------------------------------- /third-party/kaolin/docs/modules/kaolin.ops.spc.rst: -------------------------------------------------------------------------------- 1 | .. _kaolin.ops.spc: 2 | 3 | kaolin.ops.spc 4 | ############## 5 | 6 | API 7 | --- 8 | 9 | .. automodule:: kaolin.ops.spc 10 | :members: 11 | :undoc-members: 12 | :show-inheritance: 13 | -------------------------------------------------------------------------------- /third-party/kaolin/docs/modules/kaolin.render.camera.camera.rst: -------------------------------------------------------------------------------- 1 | :orphan: 2 | 3 | .. _kaolin.render.camera.Camera: 4 | 5 | kaolin.render.camera.Camera 6 | =========================== 7 | 8 | API 9 | --- 10 | 11 | .. autoclass:: kaolin.render.camera.Camera 12 | :members: 13 | :undoc-members: 14 | :show-inheritance: 15 | 16 | -------------------------------------------------------------------------------- /third-party/kaolin/docs/modules/kaolin.render.camera.camera_extrinsics.rst: -------------------------------------------------------------------------------- 1 | :orphan: 2 | 3 | .. _kaolin.render.camera.CameraExtrinsics: 4 | 5 | kaolin.render.camera.CameraExtrinsics 6 | ===================================== 7 | 8 | API 9 | --- 10 | 11 | .. autoclass:: kaolin.render.camera.CameraExtrinsics 12 | :members: 13 | :undoc-members: 14 | :show-inheritance: 15 | -------------------------------------------------------------------------------- /third-party/kaolin/docs/modules/kaolin.render.camera.camera_intrinsics.rst: -------------------------------------------------------------------------------- 1 | :orphan: 2 | 3 | .. _kaolin.render.camera.CameraIntrinsics: 4 | 5 | kaolin.render.camera.CameraIntrinsics 6 | ===================================== 7 | 8 | API 9 | --- 10 | 11 | .. autoclass:: kaolin.render.camera.CameraIntrinsics 12 | :members: 13 | :undoc-members: 14 | :show-inheritance: 15 | -------------------------------------------------------------------------------- /third-party/kaolin/docs/modules/kaolin.render.camera.extrinsics_rep.rst: -------------------------------------------------------------------------------- 1 | :orphan: 2 | 3 | .. _kaolin.render.camera.ExtrinsicsRep: 4 | 5 | kaolin.render.camera.ExtrinsicsRep 6 | ================================== 7 | 8 | API 9 | --- 10 | 11 | .. autoclass:: kaolin.render.camera.ExtrinsicsRep 12 | :members: 13 | :undoc-members: 14 | :show-inheritance: 15 | -------------------------------------------------------------------------------- /third-party/kaolin/docs/modules/kaolin.render.camera.orthographic_intrinsics.rst: -------------------------------------------------------------------------------- 1 | :orphan: 2 | 3 | .. _kaolin.render.camera.OrthographicIntrinsics: 4 | 5 | kaolin.render.camera.OrthographicIntrinsics 6 | =========================================== 7 | 8 | API 9 | --- 10 | 11 | .. autoclass:: kaolin.render.camera.OrthographicIntrinsics 12 | :members: 13 | :undoc-members: 14 | :show-inheritance: 15 | -------------------------------------------------------------------------------- /third-party/kaolin/docs/modules/kaolin.render.camera.pinhole_intrinsics.rst: -------------------------------------------------------------------------------- 1 | :orphan: 2 | 3 | .. _kaolin.render.camera.PinholeIntrinsics: 4 | 5 | kaolin.render.camera.PinholeIntrinsics 6 | ====================================== 7 | 8 | API 9 | --- 10 | 11 | .. autoclass:: kaolin.render.camera.PinholeIntrinsics 12 | :members: 13 | :undoc-members: 14 | :show-inheritance: 15 | -------------------------------------------------------------------------------- /third-party/kaolin/docs/modules/kaolin.render.camera.rst: -------------------------------------------------------------------------------- 1 | .. _kaolin.render.camera: 2 | 3 | kaolin.render.camera 4 | ==================== 5 | 6 | API 7 | --- 8 | 9 | Classes 10 | ^^^^^^^ 11 | 12 | * :ref:`Camera ` 13 | * :ref:`CameraExtrinsics ` 14 | * :ref:`CameraIntrinsics ` 15 | * :ref:`PinholeIntrinsics ` 16 | * :ref:`OrthographicIntrinsics ` 17 | * :ref:`ExtrinsicsRep ` 18 | 19 | Functions 20 | ^^^^^^^^^ 21 | 22 | .. automodule:: kaolin.render.camera 23 | :members: 24 | :exclude-members: 25 | Camera, 26 | CameraExtrinsics, 27 | CameraIntrinsics, 28 | PinholeIntrinsics, 29 | OrthographicIntrinsics, 30 | ExtrinsicsRep 31 | :undoc-members: 32 | :show-inheritance: 33 | 34 | 35 | -------------------------------------------------------------------------------- /third-party/kaolin/docs/modules/kaolin.render.rst: -------------------------------------------------------------------------------- 1 | .. _kaolin.render: 2 | 3 | kaolin.render 4 | ============= 5 | 6 | .. toctree:: 7 | :maxdepth: 2 8 | :titlesonly: 9 | 10 | kaolin.render.mesh 11 | kaolin.render.camera 12 | kaolin.render.spc 13 | -------------------------------------------------------------------------------- /third-party/kaolin/docs/modules/kaolin.render.spc.rst: -------------------------------------------------------------------------------- 1 | .. _kaolin.render.spc: 2 | 3 | kaolin.render.spc 4 | ================= 5 | 6 | API 7 | --- 8 | 9 | .. automodule:: kaolin.render.spc 10 | :members: 11 | :undoc-members: 12 | :show-inheritance: 13 | -------------------------------------------------------------------------------- /third-party/kaolin/docs/modules/kaolin.utils.rst: -------------------------------------------------------------------------------- 1 | .. _kaolin.utils: 2 | 3 | kaolin.utils 4 | ============ 5 | 6 | .. toctree:: 7 | :maxdepth: 2 8 | :titlesonly: 9 | 10 | kaolin.utils.testing 11 | -------------------------------------------------------------------------------- /third-party/kaolin/docs/modules/kaolin.visualize.rst: -------------------------------------------------------------------------------- 1 | .. _kaolin.visualize: 2 | 3 | kaolin.visualize 4 | ================ 5 | 6 | API 7 | --- 8 | 9 | .. automodule:: kaolin.visualize 10 | :members: 11 | :undoc-members: 12 | :show-inheritance: 13 | 14 | -------------------------------------------------------------------------------- /third-party/kaolin/docs/modules/module.rst_t: -------------------------------------------------------------------------------- 1 | {%- if show_headings -%} 2 | .. _{{ basename }}: 3 | 4 | {{ basename | e | heading }} 5 | {%- endif %} 6 | 7 | API 8 | --- 9 | 10 | .. automodule:: {{ qualname }} 11 | {%- for option in automodule_options %} 12 | :{{ option }}: 13 | {%- endfor %} 14 | 15 | -------------------------------------------------------------------------------- /third-party/kaolin/docs/modules/package.rst_t: -------------------------------------------------------------------------------- 1 | {%- macro automodule(modname, options) -%} 2 | API 3 | --- 4 | 5 | .. automodule:: {{ modname }} 6 | {%- for option in options %} 7 | :{{ option }}: 8 | {%- endfor %} 9 | {%- endmacro %} 10 | 11 | {%- macro unfoldtree(docnames) -%} 12 | {%- for docname in docnames %} 13 | {{ docname }} 14 | {%- endfor %} 15 | {%- endmacro -%} 16 | 17 | {%- if is_namespace %} 18 | {{- [pkgname, "namespace"] | join(" ") | e | heading }} 19 | {% else -%} 20 | .. _{{ pkgname }}: 21 | 22 | {{ pkgname | e | heading }} 23 | {%- endif -%} 24 | 25 | {%- if subpackages or submodules %} 26 | .. toctree:: 27 | :maxdepth: {{ maxdepth }} 28 | :titlesonly: 29 | {% endif -%} 30 | {{ unfoldtree(subpackages + submodules) }} 31 | 32 | {% if not is_namespace -%} 33 | {{ automodule(pkgname, automodule_options) }} 34 | {% endif %} 35 | -------------------------------------------------------------------------------- /third-party/kaolin/docs/modules/toc.rst_t: -------------------------------------------------------------------------------- 1 | {{ header | heading }} 2 | 3 | .. toctree:: 4 | :maxdepth: {{ maxdepth }} 5 | {% for docname in docnames %} 6 | {{ docname }} 7 | {%- endfor %} 8 | 9 | -------------------------------------------------------------------------------- /third-party/kaolin/docs/notes/diff_render.rst: -------------------------------------------------------------------------------- 1 | .. _diff_render: 2 | 3 | Differentiable Rendering 4 | ======================== 5 | 6 | .. image:: ../img/clock.gif 7 | 8 | Differentiable rendering can be used to optimize the underlying 3D properties, like geometry and lighting, by backpropagating gradients from the loss in the image space. We provide an end-to-end tutorial for using the :mod:`kaolin.render.mesh` API in a Jupyter notebook: 9 | 10 | `examples/tutorial/dibr_tutorial.ipynb `_ 11 | 12 | In addition to the rendering API, the tutorial uses Omniverse Kaolin App `Data Generator `_ to create training data, :class:`kaolin.visualize.Timelapse` to write checkpoints, and 13 | Omniverse Kaolin App `Training Visualizer `_ to visualize them. -------------------------------------------------------------------------------- /third-party/kaolin/docs/readthedocs_requirements.txt: -------------------------------------------------------------------------------- 1 | -f https://download.pytorch.org/whl/lts/1.8/torch_lts.html 2 | torch==1.8.2+cpu 3 | -------------------------------------------------------------------------------- /third-party/kaolin/examples/recipes/README.md: -------------------------------------------------------------------------------- 1 | # Quick Start: Kaolin Recipes 2 |
3 | 4 | For a quick start with Kaolin, see the example snippets included below.
5 | In depth guides are available in the [tutorials](https://kaolin.readthedocs.io/en/latest/notes/tutorial_index.html) section. 6 | 7 | ## Data 8 | 9 | ### Converting Data 10 |
11 | 12 | * [Point cloud to SPC]("https://github.com/NVIDIAGameWorks/kaolin/blob/master/examples/recipes/dataload/spc_from_pointcloud.py") 13 | 14 | ## 3D Formats 15 | ### SPC / Octree based Ops 16 |
17 | 18 | * [SPC: Basic Usage]("https://github.com/NVIDIAGameWorks/kaolin/blob/master/examples/recipes/spc/spc_basics.py") 19 | -------------------------------------------------------------------------------- /third-party/kaolin/examples/recipes/camera/camera_coordinate_systems.py: -------------------------------------------------------------------------------- 1 | # ============================================================================================================== 2 | # The following snippet demonstrates how to change the coordinate system of the camera. 3 | # ============================================================================================================== 4 | 5 | import math 6 | import torch 7 | import numpy as np 8 | from kaolin.render.camera import Camera, blender_coords 9 | 10 | device = 'cuda' 11 | 12 | camera = Camera.from_args( 13 | eye=torch.tensor([4.0, 4.0, 4.0]), 14 | at=torch.tensor([0.0, 0.0, 0.0]), 15 | up=torch.tensor([0.0, 1.0, 0.0]), 16 | fov=30 * np.pi / 180, # In radians 17 | width=800, height=800, 18 | device=device 19 | ) 20 | 21 | print(camera.basis_change_matrix) 22 | camera.change_coordinate_system(blender_coords()) 23 | print(camera.basis_change_matrix) 24 | camera.reset_coordinate_system() 25 | print(camera.basis_change_matrix) 26 | -------------------------------------------------------------------------------- /third-party/kaolin/examples/recipes/camera/camera_movement.py: -------------------------------------------------------------------------------- 1 | # ============================================================================================================== 2 | # The following snippet demonstrates how to manipulate kaolin's camera. 3 | # ============================================================================================================== 4 | 5 | import torch 6 | from kaolin.render.camera import Camera 7 | 8 | 9 | camera = Camera.from_args( 10 | eye=torch.tensor([0.0, 0.0, -1.0]), 11 | at=torch.tensor([0.0, 0.0, 0.0]), 12 | up=torch.tensor([0.0, 1.0, 0.0]), 13 | width=800, height=600, 14 | fov=1.0, 15 | device='cuda' 16 | ) 17 | 18 | # Extrinsic rigid transformations managed by CameraExtrinsics 19 | camera.move_forward(amount=10.0) # Translate forward in world coordinates (this is wisp's mouse zoom) 20 | camera.move_right(amount=-5.0) # Translate left in world coordinates 21 | camera.move_up(amount=5.0) # Translate up in world coordinates 22 | camera.rotate(yaw=0.1, pitch=0.02, roll=1.0) # Rotate the camera 23 | 24 | # Intrinsic lens transformations managed by CameraIntrinsics 25 | # Zoom in to decrease field of view - for Orthographic projection the internal implementation differs 26 | # as there is no acual fov or depth concept (hence we use a "made up" fov distance parameter, see the projection matrix) 27 | camera.zoom(amount=0.5) 28 | -------------------------------------------------------------------------------- /third-party/kaolin/examples/recipes/camera/camera_properties.py: -------------------------------------------------------------------------------- 1 | # ============================================================================================================== 2 | # The following snippet demonstrates various camera properties 3 | # ============================================================================================================== 4 | 5 | import math 6 | import torch 7 | import numpy as np 8 | from kaolin.render.camera import Camera 9 | 10 | device = 'cuda' 11 | 12 | camera = Camera.from_args( 13 | eye=torch.tensor([4.0, 4.0, 4.0]), 14 | at=torch.tensor([0.0, 0.0, 0.0]), 15 | up=torch.tensor([0.0, 1.0, 0.0]), 16 | fov=30 * np.pi / 180, # In radians 17 | width=800, height=800, 18 | dtype=torch.float32, 19 | device=device 20 | ) 21 | 22 | print(camera.width) 23 | print(camera.height) 24 | print(camera.lens_type) 25 | 26 | print(camera.device) 27 | camera = camera.cpu() 28 | print(camera.device) 29 | 30 | # Create a batched camera and view single element 31 | camera = Camera.cat((camera, camera)) 32 | print(camera) 33 | camera = camera[0] 34 | print(camera) 35 | 36 | print(camera.dtype) 37 | camera = camera.half() 38 | print(camera.dtype) 39 | camera = camera.double() 40 | print(camera.dtype) 41 | camera = camera.float() 42 | print(camera.dtype) 43 | 44 | print(camera.extrinsics.requires_grad) 45 | print(camera.intrinsics.requires_grad) 46 | 47 | print(camera.to('cuda', torch.float64)) 48 | -------------------------------------------------------------------------------- /third-party/kaolin/examples/recipes/camera/camera_transforms.py: -------------------------------------------------------------------------------- 1 | # ============================================================================================================== 2 | # The following snippet demonstrates how to use the camera transform directly on vectors 3 | # ============================================================================================================== 4 | 5 | import math 6 | import torch 7 | import numpy as np 8 | from kaolin.render.camera import Camera 9 | 10 | device = 'cuda' 11 | 12 | camera = Camera.from_args( 13 | eye=torch.tensor([4.0, 4.0, 4.0]), 14 | at=torch.tensor([0.0, 0.0, 0.0]), 15 | up=torch.tensor([0.0, 1.0, 0.0]), 16 | fov=30 * np.pi / 180, # In radians 17 | width=800, height=800, 18 | dtype=torch.float32, 19 | device=device 20 | ) 21 | 22 | print('View projection matrix') 23 | print(camera.view_projection_matrix()) 24 | 25 | print('View matrix: world2cam') 26 | print(camera.view_matrix()) 27 | 28 | print('Inv View matrix: cam2world') 29 | print(camera.inv_view_matrix()) 30 | 31 | print('Projection matrix') 32 | print(camera.projection_matrix()) 33 | 34 | vectors = torch.randn(10, 3).to(camera.device, camera.dtype) # Create a batch of points 35 | 36 | # For ortho and perspective: this is equivalent to multiplying camera.projection_matrix() @ vectors 37 | # and then dividing by the w coordinate (perspective division) 38 | print(camera.transform(vectors)) 39 | 40 | # For ray tracing we have camera.inv_transform_rays which performs multiplication with inv_view_matrix() 41 | # (just for the extrinsics part) 42 | 43 | # Can also access properties directly: 44 | # -- 45 | # View matrix components (camera space) 46 | print(camera.R) 47 | print(camera.t) 48 | 49 | # Camera axes and position in world coordinates 50 | print(camera.cam_pos()) 51 | print(camera.cam_right()) 52 | print(camera.cam_pos()) 53 | print(camera.cam_forward()) 54 | 55 | print(camera.focal_x) 56 | print(camera.focal_y) 57 | print(camera.x0) 58 | print(camera.y0) 59 | 60 | -------------------------------------------------------------------------------- /third-party/kaolin/examples/samples/128_tets_0.npz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yuxuan1206/NF-Atlas/b7fc99fe752222f3c7f1b969f30f0dd01d7abe81/third-party/kaolin/examples/samples/128_tets_0.npz -------------------------------------------------------------------------------- /third-party/kaolin/examples/samples/128_tets_1.npz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yuxuan1206/NF-Atlas/b7fc99fe752222f3c7f1b969f30f0dd01d7abe81/third-party/kaolin/examples/samples/128_tets_1.npz -------------------------------------------------------------------------------- /third-party/kaolin/examples/samples/128_tets_2.npz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yuxuan1206/NF-Atlas/b7fc99fe752222f3c7f1b969f30f0dd01d7abe81/third-party/kaolin/examples/samples/128_tets_2.npz -------------------------------------------------------------------------------- /third-party/kaolin/examples/samples/128_tets_3.npz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yuxuan1206/NF-Atlas/b7fc99fe752222f3c7f1b969f30f0dd01d7abe81/third-party/kaolin/examples/samples/128_tets_3.npz -------------------------------------------------------------------------------- /third-party/kaolin/examples/samples/128_verts.npz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yuxuan1206/NF-Atlas/b7fc99fe752222f3c7f1b969f30f0dd01d7abe81/third-party/kaolin/examples/samples/128_verts.npz -------------------------------------------------------------------------------- /third-party/kaolin/examples/samples/bbox.mtl: -------------------------------------------------------------------------------- 1 | # Blender MTL File: 'None' 2 | # Material Count: 1 3 | 4 | newmtl Material 5 | Ns 323.999994 6 | Ka 1.000000 1.000000 1.000000 7 | Kd 0.800000 0.800000 0.800000 8 | Ks 0.500000 0.500000 0.500000 9 | Ke 0.000000 0.000000 0.000000 10 | Ni 1.450000 11 | d 1.000000 12 | illum 2 13 | -------------------------------------------------------------------------------- /third-party/kaolin/examples/samples/bear_pointcloud.usd: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yuxuan1206/NF-Atlas/b7fc99fe752222f3c7f1b969f30f0dd01d7abe81/third-party/kaolin/examples/samples/bear_pointcloud.usd -------------------------------------------------------------------------------- /third-party/kaolin/examples/samples/colored_sphere.obj.mtl: -------------------------------------------------------------------------------- 1 | # 2 | # Wavefront material file 3 | # Converted by Meshlab Group 4 | # 5 | 6 | newmtl material_0 7 | Ka 0.200000 0.200000 0.200000 8 | Kd 0.752941 0.752941 0.752941 9 | Ks 1.000000 1.000000 1.000000 10 | Tr 1.000000 11 | illum 2 12 | Ns 0.000000 13 | map_Kd sphere_mtl.jpg 14 | 15 | -------------------------------------------------------------------------------- /third-party/kaolin/examples/samples/rendered_clock.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yuxuan1206/NF-Atlas/b7fc99fe752222f3c7f1b969f30f0dd01d7abe81/third-party/kaolin/examples/samples/rendered_clock.zip -------------------------------------------------------------------------------- /third-party/kaolin/kaolin/__init__.py: -------------------------------------------------------------------------------- 1 | from . import io 2 | from . import metrics 3 | from . import ops 4 | from . import render 5 | from . import rep 6 | from . import utils 7 | from . import visualize 8 | 9 | try: 10 | from .version import __version__ # noqa: F401 11 | except ImportError: 12 | pass 13 | -------------------------------------------------------------------------------- /third-party/kaolin/kaolin/csrc/metrics/sided_distance.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2019,20-21 NVIDIA CORPORATION & AFFILIATES. 2 | // All rights reserved. 3 | 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | 16 | #ifndef KAOLIN_METRICS_SIDED_DISTANCE_H_ 17 | #define KAOLIN_METRICS_SIDED_DISTANCE_H_ 18 | 19 | #include 20 | 21 | namespace kaolin { 22 | 23 | std::vector sided_distance_forward_cuda( 24 | const at::Tensor p1, 25 | const at::Tensor p2); 26 | 27 | std::vector sided_distance_backward_cuda( 28 | const at::Tensor grad_output, 29 | const at::Tensor p1, 30 | const at::Tensor p2, 31 | const at::Tensor idx); 32 | 33 | } // namespace kaolin 34 | 35 | #endif // KAOLIN_METRICS_SIDED_DISTANCE_H_ 36 | -------------------------------------------------------------------------------- /third-party/kaolin/kaolin/csrc/metrics/unbatched_triangle_distance.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2021 NVIDIA CORPORATION & AFFILIATES. 2 | // All rights reserved. 3 | 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | 16 | #ifndef KAOLIN_METRICS_UNBATCHED_TRIANGLE_DISTANCE_H_ 17 | #define KAOLIN_METRICS_UNBATCHED_TRIANGLE_DISTANCE_H_ 18 | 19 | #include 20 | 21 | namespace kaolin { 22 | 23 | void unbatched_triangle_distance_forward_cuda( 24 | at::Tensor points, 25 | at::Tensor face_vertices, 26 | at::Tensor dist, 27 | at::Tensor face_idx, 28 | at::Tensor dist_type); 29 | 30 | void unbatched_triangle_distance_backward_cuda( 31 | at::Tensor grad_dist, 32 | at::Tensor points, 33 | at::Tensor face_vertices, 34 | at::Tensor face_idx, 35 | at::Tensor dist_type, 36 | at::Tensor grad_points, 37 | at::Tensor grad_face_vertices); 38 | 39 | } // namespace kaolin 40 | 41 | #endif // KAOLIN_METRICS_UNBATCHED_TRIANGLE_DISTANCE_H_ 42 | -------------------------------------------------------------------------------- /third-party/kaolin/kaolin/csrc/ops/conversions/mesh_to_spc/mesh_to_spc.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2021 NVIDIA CORPORATION & AFFILIATES. 2 | // All rights reserved. 3 | 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | 16 | #ifndef KAOLIN_OPS_CONVERSIONS_MESH_TO_SPC_MESH_TO_SPC_H_ 17 | #define KAOLIN_OPS_CONVERSIONS_MESH_TO_SPC_MESH_TO_SPC_H_ 18 | 19 | #ifdef WITH_CUDA 20 | #include "../../../spc_math.h" 21 | #endif 22 | 23 | #include 24 | 25 | namespace kaolin { 26 | 27 | at::Tensor points_to_octree( 28 | at::Tensor points, 29 | uint32_t level); 30 | 31 | at::Tensor mesh_to_spc( 32 | at::Tensor vertices, 33 | at::Tensor triangles, 34 | uint32_t Level) ; 35 | 36 | } // namespace kaolin 37 | 38 | #endif // KAOLIN_OPS_CONVERSIONS_MESH_TO_SPC_H_ 39 | -------------------------------------------------------------------------------- /third-party/kaolin/kaolin/csrc/ops/conversions/unbatched_mcube/defines.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 1993-2020 NVIDIA Corporation. All rights reserved. 3 | * 4 | * Please refer to the NVIDIA end user license agreement (EULA) associated 5 | * with this source code for terms and conditions that govern your use of 6 | * this software. Any use, reproduction, disclosure, or distribution of 7 | * this software and related documentation outside the terms of the EULA 8 | * is strictly prohibited. 9 | * 10 | */ 11 | 12 | #ifndef KAOLIN_OPS_CONVERSIONS_UNBATCHED_MCUBE_DEFINES_H_ 13 | #define KAOLIN_OPS_CONVERSIONS_UNBATCHED_MCUBE_DEFINES_H_ 14 | 15 | namespace kaolin { 16 | 17 | typedef unsigned int uint; 18 | typedef unsigned char uchar; 19 | 20 | } // namespace kaolin 21 | 22 | // if SAMPLE_VOLUME is 0, an implicit dataset is generated. If 1, a voxelized 23 | // dataset is loaded from file 24 | #define SAMPLE_VOLUME 1 25 | 26 | // Using shared to store computed vertices and normals during triangle generation 27 | // improves performance 28 | #define USE_SHARED 1 29 | 30 | // The number of threads to use for triangle generation (limited by shared memory size) 31 | #define NTHREADS 32 32 | 33 | #define SKIP_EMPTY_VOXELS 1 34 | 35 | #endif // KAOLIN_OPS_CONVERSIONS_UNBATCHED_MCUBE_DEFINES_H_ 36 | -------------------------------------------------------------------------------- /third-party/kaolin/kaolin/csrc/ops/conversions/unbatched_mcube/unbatched_mcube.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2019-2020, NVIDIA CORPORATION. All rights reserved. 2 | 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | 16 | #include 17 | 18 | namespace kaolin { 19 | 20 | #if WITH_CUDA 21 | std::vector unbatched_mcube_forward_cuda_kernel_launcher(const at::Tensor voxelgrid, float iso_value); 22 | #endif 23 | 24 | std::vector unbatched_mcube_forward_cuda(const at::Tensor voxelgrid, float iso_value) { 25 | #if WITH_CUDA 26 | return unbatched_mcube_forward_cuda_kernel_launcher(voxelgrid, iso_value); 27 | #else 28 | AT_ERROR("packed_simple_sum not built with CUDA"); 29 | #endif // WITH_CUDA 30 | } 31 | 32 | } // namespace kaolin 33 | -------------------------------------------------------------------------------- /third-party/kaolin/kaolin/csrc/ops/conversions/unbatched_mcube/unbatched_mcube.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2019-2021, NVIDIA CORPORATION. All rights reserved. 2 | 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #ifndef KAOLIN_OPS_CONVERSIONS_UNBATCHED_MCUBE_UNBATCHED_MCUBE_H_ 16 | #define KAOLIN_OPS_CONVERSIONS_UNBATCHED_MCUBE_UNBATCHED_MCUBE_H_ 17 | 18 | #include 19 | 20 | namespace kaolin { 21 | 22 | std::vector unbatched_mcube_forward_cuda(const at::Tensor voxelgrid, float iso_value); 23 | 24 | } // namespace kaolin 25 | 26 | #endif // KAOLIN_OPS_CONVERSIONS_UNBATCHED_MCUBE_UNBATCHED_MCUBE_H_ 27 | -------------------------------------------------------------------------------- /third-party/kaolin/kaolin/csrc/ops/mesh/mesh_intersection.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2019-2021, NVIDIA CORPORATION. All rights reserved. 2 | 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #ifndef KAOLIN_OPS_MESH_MESH_INTERSECTION_H_ 16 | #define KAOLIN_OPS_MESH_MESH_INTERSECTION_H_ 17 | 18 | #include 19 | 20 | namespace kaolin { 21 | 22 | at::Tensor unbatched_mesh_intersection_cuda( 23 | const at::Tensor points, 24 | const at::Tensor verts_1, 25 | const at::Tensor verts_2, 26 | const at::Tensor verts_3); 27 | 28 | } // namespace kaolin 29 | 30 | #endif // KAOLIN_OPS_MESH_MESH_INTERSECTION_H_ 31 | -------------------------------------------------------------------------------- /third-party/kaolin/kaolin/csrc/ops/packed_simple_sum.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2019-2021, NVIDIA CORPORATION. All rights reserved. 2 | 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #ifndef KAOLIN_OPS_PACKED_SIMPLE_SUM_H_ 16 | #define KAOLIN_OPS_PACKED_SIMPLE_SUM_H_ 17 | 18 | #include 19 | 20 | namespace kaolin { 21 | 22 | at::Tensor packed_simple_sum_cuda( 23 | at::Tensor packed_tensor, 24 | at::Tensor shape_per_tensor); 25 | 26 | at::Tensor packed_simple_sum_out_cuda( 27 | at::Tensor packed_tensor, 28 | at::Tensor shape_per_tensor, 29 | at::Tensor output); 30 | 31 | } // namespace kaolin 32 | 33 | #endif // KAOLIN_OPS_PACKED_SIMPLE_SUM_H_ 34 | -------------------------------------------------------------------------------- /third-party/kaolin/kaolin/csrc/ops/spc/convolution.cuh: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2021 NVIDIA CORPORATION & AFFILIATES. 2 | // All rights reserved. 3 | 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | 16 | #ifndef KAOLIN_OPS_SPC_CONVOLUTION_CUH_ 17 | #define KAOLIN_OPS_SPC_CONVOLUTION_CUH_ 18 | 19 | #include "../../spc_math.h" 20 | 21 | #include 22 | 23 | #include 24 | 25 | constexpr int MAX_GRID = 65535; 26 | 27 | template struct pVector { 28 | Itype *ptr_; 29 | int size_; 30 | 31 | pVector(Itype *ptr, int size) : ptr_(ptr), size_(size) {} 32 | int size() const { return size_; }; 33 | Itype *data() { return ptr_; }; 34 | const Itype *data() const { return ptr_; }; 35 | }; 36 | 37 | // Input index to output index mapping in ptr, sise pair 38 | // Used for device pointer and size 39 | template using pInOutMaps = std::vector>; 40 | 41 | #endif // KAOLIN_OPS_SPC_CONVOLUTION_CUH 42 | -------------------------------------------------------------------------------- /third-party/kaolin/kaolin/csrc/ops/spc/feature_grids.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2021 NVIDIA CORPORATION & AFFILIATES. 2 | // All rights reserved. 3 | 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | 16 | #ifndef KAOLIN_OPS_SPC_FEATURE_GRIDS_H_ 17 | #define KAOLIN_OPS_SPC_FEATURE_GRIDS_H_ 18 | 19 | #include 20 | 21 | namespace kaolin { 22 | 23 | at::Tensor to_dense_forward( 24 | at::Tensor points, 25 | int level, 26 | at::Tensor pyramid, 27 | at::Tensor features); 28 | 29 | at::Tensor to_dense_backward( 30 | at::Tensor points, 31 | int level, 32 | at::Tensor pyramid, 33 | at::Tensor features, 34 | at::Tensor grad_outputs); 35 | 36 | } // namespace kaolin 37 | 38 | #endif // KAOLIN_OPS_SPC_FEATURE_GRIDS_H_ 39 | 40 | -------------------------------------------------------------------------------- /third-party/kaolin/kaolin/csrc/ops/spc/point_utils.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2021,22 NVIDIA CORPORATION & AFFILIATES 3 | * All rights reserved. 4 | * 5 | * NVIDIA CORPORATION and its licensors retain all intellectual property 6 | * and proprietary rights in and to this software, related documentation 7 | * and any modifications thereto. Any use, reproduction, disclosure or 8 | * distribution of this software and related documentation without an express 9 | * license agreement from NVIDIA CORPORATION is strictly prohibited. 10 | */ 11 | 12 | #pragma once 13 | 14 | #include 15 | 16 | namespace kaolin { 17 | 18 | at::Tensor points_to_morton_cuda(at::Tensor points); 19 | 20 | at::Tensor morton_to_points_cuda(at::Tensor morton_codes); 21 | 22 | at::Tensor interpolate_trilinear_cuda( 23 | at::Tensor coords, 24 | at::Tensor pidx, 25 | at::Tensor points, 26 | at::Tensor trinkets, 27 | at::Tensor feats, 28 | int32_t level); 29 | 30 | at::Tensor coords_to_trilinear_cuda( 31 | at::Tensor coords, 32 | at::Tensor points); 33 | 34 | at::Tensor coords_to_trilinear_jacobian_cuda(at::Tensor coords); 35 | 36 | at::Tensor points_to_corners_cuda(at::Tensor points); 37 | 38 | } // namespace kaolin 39 | 40 | -------------------------------------------------------------------------------- /third-party/kaolin/kaolin/csrc/ops/spc/query.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2021 NVIDIA CORPORATION & AFFILIATES. 2 | // All rights reserved. 3 | 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | 16 | #ifndef KAOLIN_OPS_SPC_QUERY_H_ 17 | #define KAOLIN_OPS_SPC_QUERY_H_ 18 | 19 | #ifdef WITH_CUDA 20 | #include "../../spc_math.h" 21 | #endif 22 | 23 | #include 24 | 25 | namespace kaolin { 26 | 27 | at::Tensor query_cuda( 28 | at::Tensor octree, 29 | at::Tensor prefix_sum, 30 | at::Tensor query_coords, 31 | uint32_t target_level); 32 | 33 | at::Tensor query_multiscale_cuda( 34 | at::Tensor octree, 35 | at::Tensor prefix_sum, 36 | at::Tensor query_coords, 37 | uint32_t target_level); 38 | 39 | } // namespace kaolin 40 | 41 | #endif // KAOLIN_OPS_SPC_QUERY_H_ 42 | 43 | -------------------------------------------------------------------------------- /third-party/kaolin/kaolin/csrc/ops/tile_to_packed.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2019-2021, NVIDIA CORPORATION. All rights reserved. 2 | 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #ifndef KAOLIN_OPS_TILE_TO_PACKED_H_ 16 | #define KAOLIN_OPS_TILE_TO_PACKED_H_ 17 | 18 | #include 19 | 20 | namespace kaolin { 21 | 22 | at::Tensor tile_to_packed_cuda( 23 | at::Tensor values_tensor, 24 | at::Tensor shape_per_tensor, 25 | int total_numel); 26 | 27 | at::Tensor tile_to_packed_out_cuda( 28 | at::Tensor values_tensor, 29 | at::Tensor shape_per_tensor, 30 | at::Tensor output); 31 | 32 | } // namespace kaolin 33 | 34 | #endif // KAOLIN_OPS_TILE_TO_PACKED_H_ 35 | -------------------------------------------------------------------------------- /third-party/kaolin/kaolin/csrc/render/mesh/deftet.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2021,22 NVIDIA CORPORATION & AFFILIATES. 2 | // All rights reserved. 3 | 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | 16 | #ifndef KAOLIN_RENDER_MESH_DEFTET_H_ 17 | #define KAOLIN_RENDER_MESH_DEFTET_H_ 18 | 19 | #include 20 | 21 | namespace kaolin { 22 | 23 | std::vector deftet_sparse_render_forward_cuda( 24 | const at::Tensor points3d, 25 | const at::Tensor points2d, 26 | const at::Tensor pointsbbox, 27 | const at::Tensor imcoords, 28 | const at::Tensor imdeprange, 29 | const int knum, 30 | const float eps); 31 | 32 | std::vector deftet_sparse_render_backward_cuda( 33 | const at::Tensor grad_interpolated_features, 34 | const at::Tensor face_idx, 35 | const at::Tensor weights, 36 | const at::Tensor face_vertices_image, 37 | const at::Tensor face_features, 38 | const float eps); 39 | 40 | } 41 | 42 | #endif // KAOLIN_RENDER_MESH_DEFTET_H_ 43 | 44 | -------------------------------------------------------------------------------- /third-party/kaolin/kaolin/csrc/render/mesh/dibr_soft_mask.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2022 NVIDIA CORPORATION & AFFILIATES. 2 | // All rights reserved. 3 | 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | 16 | #ifndef KAOLIN_RENDER_MESH_DIBR_SOFT_MASK_H_ 17 | #define KAOLIN_RENDER_MESH_DIBR_SOFT_MASK_H_ 18 | 19 | #include 20 | 21 | namespace kaolin { 22 | 23 | std::vector dibr_soft_mask_forward_cuda( 24 | const at::Tensor face_vertices_image, // x,y coordinates of face_vertices in camera plan. 25 | const at::Tensor face_large_bboxes, // enlarged bounding boxes of faces in camera plan. 26 | const at::Tensor selected_face_idx, // indices within each mesh of selected faces. 27 | const float sigmainv, // smoothness term for soft mask, the higher the shaper. Default: 7000 28 | const int knum, // Max number of faces influencing a pixel. 29 | const float multiplier); // coordinates multiplier used to improve numerical precision. 30 | 31 | at::Tensor dibr_soft_mask_backward_cuda( 32 | const at::Tensor grad_soft_mask, 33 | const at::Tensor soft_mask, 34 | const at::Tensor selected_face_idx, 35 | const at::Tensor close_face_prob, 36 | const at::Tensor close_face_idx, 37 | const at::Tensor close_face_dist_type, 38 | const at::Tensor face_vertices_image, 39 | const float sigmainv, 40 | const float multiplier); 41 | 42 | } // namespace kaolin 43 | 44 | #endif // KAOLIN_RENDER_MESH_DIBR_SOFT_MASK_H_ 45 | -------------------------------------------------------------------------------- /third-party/kaolin/kaolin/experimental/dash3d/Makefile: -------------------------------------------------------------------------------- 1 | CORE_JS = $(wildcard src/*.js) 2 | CORE_CSS = $(wildcard src/*.css) 3 | THIRDPARTY_JS = ../../../node_modules/jquery/dist/jquery.min.js \ 4 | ../../../node_modules/three/build/three.min.js \ 5 | ../../../node_modules/three/examples/js/controls/OrbitControls.js # TODO: this needs to be minified 6 | THIRDPARTY_CSS = ../../../node_modules/mustard-ui/dist/css/mustard-ui.min.css 7 | JSMIN=uglifyjs 8 | AWK=awk 9 | 10 | all: css js 11 | 12 | js: jscore jsthirdparty 13 | 14 | css: csscore cssthirdparty 15 | 16 | info: info_jscore info_jsthirdparty info_csscore info_cssthirdparty 17 | 18 | info_jscore: $(CORE_JS) 19 | echo "core js files: " $(CORE_JS) 20 | 21 | info_jsthirdparty: $(THIRDPARTY_JS) 22 | echo "thirdparty js files: " $(THIRDPARTY_JS) 23 | 24 | info_csscore: $(CORE_CSS) 25 | echo "core css files: " $(CORE_CSS) 26 | 27 | info_cssthirdparty: $(THIRDPARTY_CSS) 28 | echo "thirdparty css files: " $(THIRDPARTY_CSS) 29 | 30 | jscore: static/core-min.js 31 | 32 | static/core-min.js: $(CORE_JS) 33 | cat src/copyright.js > static/core-min.js 34 | $(JSMIN) $^ -m >> static/core-min.js 35 | 36 | jsthirdparty: static/thirdparty.js 37 | 38 | static/thirdparty.js: $(THIRDPARTY_JS) 39 | $(AWK) 1 $^ > static/thirdparty.js 40 | 41 | csscore: static/style.css 42 | 43 | static/style.css: $(CORE_CSS) 44 | cat $^ > static/style.css 45 | 46 | cssthirdparty: static/thirdparty.css 47 | 48 | static/thirdparty.css: $(THIRDPARTY_CSS) 49 | cat $^ > static/thirdparty.css 50 | 51 | clean: 52 | rm -f static/style.css static/core-min.js static/thirdparty.js static/thirdparty.css 53 | -------------------------------------------------------------------------------- /third-party/kaolin/kaolin/experimental/dash3d/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yuxuan1206/NF-Atlas/b7fc99fe752222f3c7f1b969f30f0dd01d7abe81/third-party/kaolin/kaolin/experimental/dash3d/__init__.py -------------------------------------------------------------------------------- /third-party/kaolin/kaolin/experimental/dash3d/kaolin-dash3d: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | from kaolin.experimental.dash3d.run import run_main 4 | 5 | if __name__ == "__main__": 6 | run_main() 7 | -------------------------------------------------------------------------------- /third-party/kaolin/kaolin/experimental/dash3d/src/copyright.js: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2019-2020, NVIDIA CORPORATION. All rights reserved. 2 | 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | -------------------------------------------------------------------------------- /third-party/kaolin/kaolin/experimental/dash3d/static/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yuxuan1206/NF-Atlas/b7fc99fe752222f3c7f1b969f30f0dd01d7abe81/third-party/kaolin/kaolin/experimental/dash3d/static/favicon.ico -------------------------------------------------------------------------------- /third-party/kaolin/kaolin/experimental/dash3d/templates/render_card.html: -------------------------------------------------------------------------------- 1 |
2 |
3 |
4 | 5 |
6 |
7 | 8 |
9 |
10 |
11 |
12 |
13 |
14 | -------------------------------------------------------------------------------- /third-party/kaolin/kaolin/experimental/dash3d/templates/render_row.html: -------------------------------------------------------------------------------- 1 | {# Note: number of render cards is limited to ensure decent performance for all cases. #} 2 |
3 | {% if count == 0 %} 4 | No {{type}} content written. 5 | {% elif count == 1 %} 6 |
7 |
8 |
9 |
10 |
11 |
12 | 13 |
14 |
15 | 16 |
17 |
18 |
19 |
20 |
21 | {% else %} 22 | {% with %} 23 | {% set col=12/count %} 24 | {% for id in range(count) %} 25 |
26 | {% include 'render_card.html' %} 27 |
28 | {% endfor %} 29 | {% endwith %} 30 | {% endif %} 31 |
32 | -------------------------------------------------------------------------------- /third-party/kaolin/kaolin/experimental/dash3d/templates/view_settings.html: -------------------------------------------------------------------------------- 1 | View Settings 2 |
3 |
4 |
5 | 6 |
7 |
8 | 10 |
11 |
12 | 13 |
14 |
15 | 16 |
17 |
18 | 20 |
21 |
22 | 23 |
24 |
25 | 26 |
27 |
28 | 33 |
34 |
35 | 36 |
37 | 38 |
39 |
40 | -------------------------------------------------------------------------------- /third-party/kaolin/kaolin/io/__init__.py: -------------------------------------------------------------------------------- 1 | from . import dataset 2 | from . import materials 3 | from . import obj 4 | from . import off 5 | from . import render 6 | from . import shapenet 7 | from . import usd 8 | from . import modelnet 9 | from . import shrec 10 | from . import utils 11 | -------------------------------------------------------------------------------- /third-party/kaolin/kaolin/metrics/__init__.py: -------------------------------------------------------------------------------- 1 | from . import voxelgrid 2 | from . import trianglemesh 3 | from . import pointcloud 4 | from . import render 5 | from . import tetmesh 6 | -------------------------------------------------------------------------------- /third-party/kaolin/kaolin/metrics/render.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2021 NVIDIA CORPORATION & AFFILIATES. 2 | # All rights reserved. 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | 16 | import torch 17 | 18 | def mask_iou(lhs_mask, rhs_mask): 19 | r"""Compute the Intersection over Union of two segmentation masks. 20 | 21 | Args: 22 | lhs_mask (torch.FloatTensor): 23 | A segmentation mask, of shape 24 | :math:`(\text{batch_size}, \text{height}, \text{width})`. 25 | rhs_mask (torch.FloatTensor): 26 | A segmentation mask, of shape 27 | :math:`(\text{batch_size}, \text{height}, \text{width})`. 28 | 29 | Returns: 30 | (torch.FloatTensor): The IoU loss, as a torch scalar. 31 | """ 32 | batch_size, height, width = lhs_mask.shape 33 | assert rhs_mask.shape == lhs_mask.shape 34 | sil_mul = lhs_mask * rhs_mask 35 | sil_add = lhs_mask + rhs_mask 36 | iou_up = torch.sum(sil_mul.reshape(batch_size, -1), dim=1) 37 | iou_down = torch.sum((sil_add - sil_mul).reshape(batch_size, -1), dim=1) 38 | iou_neg = iou_up / (iou_down + 1e-10) 39 | mask_loss = 1.0 - torch.mean(iou_neg) 40 | return mask_loss 41 | -------------------------------------------------------------------------------- /third-party/kaolin/kaolin/ops/__init__.py: -------------------------------------------------------------------------------- 1 | from . import batch 2 | from . import conversions 3 | from . import coords 4 | from . import gcn 5 | from . import mesh 6 | from . import random 7 | from . import reduction 8 | from . import spc 9 | from . import voxelgrid 10 | -------------------------------------------------------------------------------- /third-party/kaolin/kaolin/ops/conversions/__init__.py: -------------------------------------------------------------------------------- 1 | from .sdf import * 2 | from .trianglemesh import * 3 | from .voxelgrid import * 4 | from .pointcloud import * 5 | from .tetmesh import * 6 | 7 | __all__ = [k for k in locals().keys() if not k.startswith('__')] 8 | -------------------------------------------------------------------------------- /third-party/kaolin/kaolin/ops/mesh/__init__.py: -------------------------------------------------------------------------------- 1 | from .mesh import * 2 | from .trianglemesh import * 3 | from .check_sign import check_sign 4 | from .tetmesh import * 5 | 6 | __all__ = [k for k in locals().keys() if not k.startswith('__')] 7 | -------------------------------------------------------------------------------- /third-party/kaolin/kaolin/ops/spc/__init__.py: -------------------------------------------------------------------------------- 1 | from .spc import * 2 | from .convolution import * 3 | from .points import * 4 | from .uint8 import * 5 | 6 | __all__ = [k for k in locals().keys() if not k.startswith('__')] 7 | -------------------------------------------------------------------------------- /third-party/kaolin/kaolin/render/__init__.py: -------------------------------------------------------------------------------- 1 | from . import camera 2 | from . import mesh 3 | from . import spc 4 | -------------------------------------------------------------------------------- /third-party/kaolin/kaolin/render/camera/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2022 NVIDIA CORPORATION & AFFILIATES. 2 | # All rights reserved. 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | 16 | from .camera import * 17 | from .extrinsics import * 18 | from .intrinsics import * 19 | from .intrinsics_pinhole import * 20 | from .intrinsics_ortho import * 21 | from .coordinates import * 22 | from .legacy import * 23 | 24 | __all__ = [k for k in locals().keys() if not k.startswith('__')] 25 | -------------------------------------------------------------------------------- /third-party/kaolin/kaolin/render/mesh/__init__.py: -------------------------------------------------------------------------------- 1 | from .utils import * 2 | from .rasterization import * 3 | from .deftet import * 4 | from .dibr import * 5 | 6 | __all__ = [k for k in locals().keys() if not k.startswith('__')] 7 | -------------------------------------------------------------------------------- /third-party/kaolin/kaolin/render/spc/__init__.py: -------------------------------------------------------------------------------- 1 | from .raytrace import * 2 | 3 | __all__ = [k for k in locals().keys() if not k.startswith('__')] 4 | -------------------------------------------------------------------------------- /third-party/kaolin/kaolin/rep/__init__.py: -------------------------------------------------------------------------------- 1 | from .spc import Spc 2 | 3 | __all__ = [k for k in locals().keys() if not k.startswith('__')] 4 | -------------------------------------------------------------------------------- /third-party/kaolin/kaolin/utils/__init__.py: -------------------------------------------------------------------------------- 1 | from . import testing 2 | -------------------------------------------------------------------------------- /third-party/kaolin/kaolin/version.py: -------------------------------------------------------------------------------- 1 | __version__ = '0.12.0' 2 | -------------------------------------------------------------------------------- /third-party/kaolin/kaolin/visualize/__init__.py: -------------------------------------------------------------------------------- 1 | from .timelapse import * 2 | 3 | __all__ = [k for k in locals().keys() if not k.startswith('__')] 4 | -------------------------------------------------------------------------------- /third-party/kaolin/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "dependencies": { 3 | "jquery": "^3.5.1", 4 | "mustard-ui": "^1.0.4", 5 | "three": "^0.137.0" 6 | }, 7 | "devDependencies": { 8 | "cypress": "^9.5.2", 9 | "mocha": "^9.2.2", 10 | "uglify-js": "^3.15.3" 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /third-party/kaolin/tests/integration/experimental/dash3d/.gitignore: -------------------------------------------------------------------------------- 1 | cypress/test_output 2 | cypress/videos 3 | cypress/screenshots -------------------------------------------------------------------------------- /third-party/kaolin/tests/integration/experimental/dash3d/cypress.json: -------------------------------------------------------------------------------- 1 | { 2 | "fileServerFolder": "tests/integration/experimental/dash3d/cypress", 3 | "componentFolder" : "tests/integration/experimental/dash3d/cypress/component", 4 | "downloadsFolder" : "tests/integration/experimental/dash3d/cypress/downloads", 5 | "fixturesFolder": "tests/integration/experimental/dash3d/cypress/fixtures", 6 | "integrationFolder": "tests/integration/experimental/dash3d/cypress/integration", 7 | "pluginsFile": "tests/integration/experimental/dash3d/cypress/plugins/index.js", 8 | "screenshotsFolder": "tests/integration/experimental/dash3d/cypress/screenshots", 9 | "supportFile": "tests/integration/experimental/dash3d/cypress/support/index.js", 10 | "videosFolder": "tests/integration/experimental/dash3d/cypress/videos" 11 | } 12 | -------------------------------------------------------------------------------- /third-party/kaolin/tests/integration/experimental/dash3d/cypress/plugins/index.js: -------------------------------------------------------------------------------- 1 | /// 2 | // *********************************************************** 3 | // This example plugins/index.js can be used to load plugins 4 | // 5 | // You can change the location of this file or turn off loading 6 | // the plugins file with the 'pluginsFile' configuration option. 7 | // 8 | // You can read more here: 9 | // https://on.cypress.io/plugins-guide 10 | // *********************************************************** 11 | 12 | // This function is called when a project is opened or re-opened (e.g. due to 13 | // the project's config changing) 14 | 15 | /** 16 | * @type {Cypress.PluginConfig} 17 | */ 18 | module.exports = (on, config) => { 19 | // `on` is used to hook into various events Cypress emits 20 | // `config` is the resolved Cypress config 21 | } 22 | -------------------------------------------------------------------------------- /third-party/kaolin/tests/integration/experimental/dash3d/cypress/support/index.js: -------------------------------------------------------------------------------- 1 | // *********************************************************** 2 | // This example support/index.js is processed and 3 | // loaded automatically before your test files. 4 | // 5 | // This is a great place to put global configuration and 6 | // behavior that modifies Cypress. 7 | // 8 | // You can change the location of this file or turn off 9 | // automatically serving support files with the 10 | // 'supportFile' configuration option. 11 | // 12 | // You can read more here: 13 | // https://on.cypress.io/configuration 14 | // *********************************************************** 15 | 16 | // Import commands.js using ES2015 syntax: 17 | import './commands' 18 | 19 | // Alternatively you can use CommonJS syntax: 20 | // require('./commands') 21 | -------------------------------------------------------------------------------- /third-party/kaolin/tests/integration/experimental/dash3d/start_dash3d.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash -e 2 | set -o nounset 3 | 4 | # Note: when run as a subprocess something is setting this 5 | # variable, which causes issues; printing for debug information 6 | # and unsetting 7 | echo "Unsetting MKL_THREADING_LAYER=$MKL_THREADING_LAYER" 8 | unset MKL_THREADING_LAYER 9 | 10 | # Get the directory where current script is located 11 | SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" 12 | KAOLIN_ROOT=$SCRIPT_DIR/../../../.. 13 | 14 | DASH3D=$KAOLIN_ROOT/kaolin/experimental/dash3d/kaolin-dash3d 15 | 16 | USAGE="$0 [log_directory] (optional: port) 17 | 18 | Runs dash3d in the background using script: 19 | $DASH3D 20 | " 21 | if [ $# -lt 1 ]; then 22 | echo "$USAGE" 23 | exit 24 | fi 25 | 26 | FLAGS="--logdir=$1 --log_level=10" # DEBUG 27 | if [ $# -gt 1 ]; then 28 | FLAGS="$FLAGS --port=$2" 29 | fi 30 | 31 | echo "Running Dash3D in the background using command: " 32 | echo "$DASH3D $FLAGS" 33 | 34 | $DASH3D $FLAGS & 35 | PID=$! 36 | 37 | sleep 2 38 | set +e 39 | kill -0 $PID # Check still runs 40 | if [ "$?" -ne "0" ]; then 41 | echo "Failed to start dash3d" 42 | exit 1 43 | fi -------------------------------------------------------------------------------- /third-party/kaolin/tests/python/kaolin/metrics/__init__.py: -------------------------------------------------------------------------------- 1 | from . import test_trianglemesh 2 | from . import test_voxelgrid -------------------------------------------------------------------------------- /third-party/kaolin/tests/python/kaolin/ops/conversions/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yuxuan1206/NF-Atlas/b7fc99fe752222f3c7f1b969f30f0dd01d7abe81/third-party/kaolin/tests/python/kaolin/ops/conversions/__init__.py -------------------------------------------------------------------------------- /third-party/kaolin/tests/samples/dibr/simple/close_face_dist_35_31_7000_0.02.pt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yuxuan1206/NF-Atlas/b7fc99fe752222f3c7f1b969f30f0dd01d7abe81/third-party/kaolin/tests/samples/dibr/simple/close_face_dist_35_31_7000_0.02.pt -------------------------------------------------------------------------------- /third-party/kaolin/tests/samples/dibr/simple/close_face_dist_35_31_7000_0.2.pt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yuxuan1206/NF-Atlas/b7fc99fe752222f3c7f1b969f30f0dd01d7abe81/third-party/kaolin/tests/samples/dibr/simple/close_face_dist_35_31_7000_0.2.pt -------------------------------------------------------------------------------- /third-party/kaolin/tests/samples/dibr/simple/close_face_dist_35_31_70_0.02.pt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yuxuan1206/NF-Atlas/b7fc99fe752222f3c7f1b969f30f0dd01d7abe81/third-party/kaolin/tests/samples/dibr/simple/close_face_dist_35_31_70_0.02.pt -------------------------------------------------------------------------------- /third-party/kaolin/tests/samples/dibr/simple/close_face_dist_35_31_70_0.2.pt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yuxuan1206/NF-Atlas/b7fc99fe752222f3c7f1b969f30f0dd01d7abe81/third-party/kaolin/tests/samples/dibr/simple/close_face_dist_35_31_70_0.2.pt -------------------------------------------------------------------------------- /third-party/kaolin/tests/samples/dibr/simple/close_face_dist_type_35_31_7000_0.02.pt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yuxuan1206/NF-Atlas/b7fc99fe752222f3c7f1b969f30f0dd01d7abe81/third-party/kaolin/tests/samples/dibr/simple/close_face_dist_type_35_31_7000_0.02.pt -------------------------------------------------------------------------------- /third-party/kaolin/tests/samples/dibr/simple/close_face_dist_type_35_31_7000_0.2.pt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yuxuan1206/NF-Atlas/b7fc99fe752222f3c7f1b969f30f0dd01d7abe81/third-party/kaolin/tests/samples/dibr/simple/close_face_dist_type_35_31_7000_0.2.pt -------------------------------------------------------------------------------- /third-party/kaolin/tests/samples/dibr/simple/close_face_dist_type_35_31_70_0.02.pt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yuxuan1206/NF-Atlas/b7fc99fe752222f3c7f1b969f30f0dd01d7abe81/third-party/kaolin/tests/samples/dibr/simple/close_face_dist_type_35_31_70_0.02.pt -------------------------------------------------------------------------------- /third-party/kaolin/tests/samples/dibr/simple/close_face_dist_type_35_31_70_0.2.pt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yuxuan1206/NF-Atlas/b7fc99fe752222f3c7f1b969f30f0dd01d7abe81/third-party/kaolin/tests/samples/dibr/simple/close_face_dist_type_35_31_70_0.2.pt -------------------------------------------------------------------------------- /third-party/kaolin/tests/samples/dibr/simple/close_face_idx_35_31_7000_0.02.pt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yuxuan1206/NF-Atlas/b7fc99fe752222f3c7f1b969f30f0dd01d7abe81/third-party/kaolin/tests/samples/dibr/simple/close_face_idx_35_31_7000_0.02.pt -------------------------------------------------------------------------------- /third-party/kaolin/tests/samples/dibr/simple/close_face_idx_35_31_7000_0.2.pt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yuxuan1206/NF-Atlas/b7fc99fe752222f3c7f1b969f30f0dd01d7abe81/third-party/kaolin/tests/samples/dibr/simple/close_face_idx_35_31_7000_0.2.pt -------------------------------------------------------------------------------- /third-party/kaolin/tests/samples/dibr/simple/close_face_idx_35_31_70_0.02.pt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yuxuan1206/NF-Atlas/b7fc99fe752222f3c7f1b969f30f0dd01d7abe81/third-party/kaolin/tests/samples/dibr/simple/close_face_idx_35_31_70_0.02.pt -------------------------------------------------------------------------------- /third-party/kaolin/tests/samples/dibr/simple/close_face_idx_35_31_70_0.2.pt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yuxuan1206/NF-Atlas/b7fc99fe752222f3c7f1b969f30f0dd01d7abe81/third-party/kaolin/tests/samples/dibr/simple/close_face_idx_35_31_70_0.2.pt -------------------------------------------------------------------------------- /third-party/kaolin/tests/samples/dibr/simple/grad_face_vertices_image_35_31_7000_0.02.pt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yuxuan1206/NF-Atlas/b7fc99fe752222f3c7f1b969f30f0dd01d7abe81/third-party/kaolin/tests/samples/dibr/simple/grad_face_vertices_image_35_31_7000_0.02.pt -------------------------------------------------------------------------------- /third-party/kaolin/tests/samples/dibr/simple/grad_face_vertices_image_35_31_7000_0.2.pt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yuxuan1206/NF-Atlas/b7fc99fe752222f3c7f1b969f30f0dd01d7abe81/third-party/kaolin/tests/samples/dibr/simple/grad_face_vertices_image_35_31_7000_0.2.pt -------------------------------------------------------------------------------- /third-party/kaolin/tests/samples/dibr/simple/grad_face_vertices_image_35_31_70_0.02.pt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yuxuan1206/NF-Atlas/b7fc99fe752222f3c7f1b969f30f0dd01d7abe81/third-party/kaolin/tests/samples/dibr/simple/grad_face_vertices_image_35_31_70_0.02.pt -------------------------------------------------------------------------------- /third-party/kaolin/tests/samples/dibr/simple/grad_face_vertices_image_35_31_70_0.2.pt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yuxuan1206/NF-Atlas/b7fc99fe752222f3c7f1b969f30f0dd01d7abe81/third-party/kaolin/tests/samples/dibr/simple/grad_face_vertices_image_35_31_70_0.2.pt -------------------------------------------------------------------------------- /third-party/kaolin/tests/samples/dibr/simple/new_face_idx_35_31.pt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yuxuan1206/NF-Atlas/b7fc99fe752222f3c7f1b969f30f0dd01d7abe81/third-party/kaolin/tests/samples/dibr/simple/new_face_idx_35_31.pt -------------------------------------------------------------------------------- /third-party/kaolin/tests/samples/dibr/simple/soft_mask_35_31_7000_0.02.pt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yuxuan1206/NF-Atlas/b7fc99fe752222f3c7f1b969f30f0dd01d7abe81/third-party/kaolin/tests/samples/dibr/simple/soft_mask_35_31_7000_0.02.pt -------------------------------------------------------------------------------- /third-party/kaolin/tests/samples/dibr/simple/soft_mask_35_31_7000_0.2.pt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yuxuan1206/NF-Atlas/b7fc99fe752222f3c7f1b969f30f0dd01d7abe81/third-party/kaolin/tests/samples/dibr/simple/soft_mask_35_31_7000_0.2.pt -------------------------------------------------------------------------------- /third-party/kaolin/tests/samples/dibr/simple/soft_mask_35_31_70_0.02.pt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yuxuan1206/NF-Atlas/b7fc99fe752222f3c7f1b969f30f0dd01d7abe81/third-party/kaolin/tests/samples/dibr/simple/soft_mask_35_31_70_0.02.pt -------------------------------------------------------------------------------- /third-party/kaolin/tests/samples/dibr/simple/soft_mask_35_31_70_0.2.pt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yuxuan1206/NF-Atlas/b7fc99fe752222f3c7f1b969f30f0dd01d7abe81/third-party/kaolin/tests/samples/dibr/simple/soft_mask_35_31_70_0.2.pt -------------------------------------------------------------------------------- /third-party/kaolin/tests/samples/dibr/sphere/close_face_dist_35_31_7000_0.01.pt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yuxuan1206/NF-Atlas/b7fc99fe752222f3c7f1b969f30f0dd01d7abe81/third-party/kaolin/tests/samples/dibr/sphere/close_face_dist_35_31_7000_0.01.pt -------------------------------------------------------------------------------- /third-party/kaolin/tests/samples/dibr/sphere/close_face_dist_35_31_7000_0.02.pt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yuxuan1206/NF-Atlas/b7fc99fe752222f3c7f1b969f30f0dd01d7abe81/third-party/kaolin/tests/samples/dibr/sphere/close_face_dist_35_31_7000_0.02.pt -------------------------------------------------------------------------------- /third-party/kaolin/tests/samples/dibr/sphere/close_face_dist_35_31_70_0.01.pt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yuxuan1206/NF-Atlas/b7fc99fe752222f3c7f1b969f30f0dd01d7abe81/third-party/kaolin/tests/samples/dibr/sphere/close_face_dist_35_31_70_0.01.pt -------------------------------------------------------------------------------- /third-party/kaolin/tests/samples/dibr/sphere/close_face_dist_35_31_70_0.02.pt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yuxuan1206/NF-Atlas/b7fc99fe752222f3c7f1b969f30f0dd01d7abe81/third-party/kaolin/tests/samples/dibr/sphere/close_face_dist_35_31_70_0.02.pt -------------------------------------------------------------------------------- /third-party/kaolin/tests/samples/dibr/sphere/close_face_dist_type_35_31_7000_0.01.pt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yuxuan1206/NF-Atlas/b7fc99fe752222f3c7f1b969f30f0dd01d7abe81/third-party/kaolin/tests/samples/dibr/sphere/close_face_dist_type_35_31_7000_0.01.pt -------------------------------------------------------------------------------- /third-party/kaolin/tests/samples/dibr/sphere/close_face_dist_type_35_31_7000_0.02.pt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yuxuan1206/NF-Atlas/b7fc99fe752222f3c7f1b969f30f0dd01d7abe81/third-party/kaolin/tests/samples/dibr/sphere/close_face_dist_type_35_31_7000_0.02.pt -------------------------------------------------------------------------------- /third-party/kaolin/tests/samples/dibr/sphere/close_face_dist_type_35_31_70_0.01.pt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yuxuan1206/NF-Atlas/b7fc99fe752222f3c7f1b969f30f0dd01d7abe81/third-party/kaolin/tests/samples/dibr/sphere/close_face_dist_type_35_31_70_0.01.pt -------------------------------------------------------------------------------- /third-party/kaolin/tests/samples/dibr/sphere/close_face_dist_type_35_31_70_0.02.pt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yuxuan1206/NF-Atlas/b7fc99fe752222f3c7f1b969f30f0dd01d7abe81/third-party/kaolin/tests/samples/dibr/sphere/close_face_dist_type_35_31_70_0.02.pt -------------------------------------------------------------------------------- /third-party/kaolin/tests/samples/dibr/sphere/close_face_idx_35_31_7000_0.01.pt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yuxuan1206/NF-Atlas/b7fc99fe752222f3c7f1b969f30f0dd01d7abe81/third-party/kaolin/tests/samples/dibr/sphere/close_face_idx_35_31_7000_0.01.pt -------------------------------------------------------------------------------- /third-party/kaolin/tests/samples/dibr/sphere/close_face_idx_35_31_7000_0.02.pt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yuxuan1206/NF-Atlas/b7fc99fe752222f3c7f1b969f30f0dd01d7abe81/third-party/kaolin/tests/samples/dibr/sphere/close_face_idx_35_31_7000_0.02.pt -------------------------------------------------------------------------------- /third-party/kaolin/tests/samples/dibr/sphere/close_face_idx_35_31_70_0.01.pt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yuxuan1206/NF-Atlas/b7fc99fe752222f3c7f1b969f30f0dd01d7abe81/third-party/kaolin/tests/samples/dibr/sphere/close_face_idx_35_31_70_0.01.pt -------------------------------------------------------------------------------- /third-party/kaolin/tests/samples/dibr/sphere/close_face_idx_35_31_70_0.02.pt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yuxuan1206/NF-Atlas/b7fc99fe752222f3c7f1b969f30f0dd01d7abe81/third-party/kaolin/tests/samples/dibr/sphere/close_face_idx_35_31_70_0.02.pt -------------------------------------------------------------------------------- /third-party/kaolin/tests/samples/dibr/sphere/grad_face_vertices_image_35_31_7000_0.01.pt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yuxuan1206/NF-Atlas/b7fc99fe752222f3c7f1b969f30f0dd01d7abe81/third-party/kaolin/tests/samples/dibr/sphere/grad_face_vertices_image_35_31_7000_0.01.pt -------------------------------------------------------------------------------- /third-party/kaolin/tests/samples/dibr/sphere/grad_face_vertices_image_35_31_7000_0.02.pt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yuxuan1206/NF-Atlas/b7fc99fe752222f3c7f1b969f30f0dd01d7abe81/third-party/kaolin/tests/samples/dibr/sphere/grad_face_vertices_image_35_31_7000_0.02.pt -------------------------------------------------------------------------------- /third-party/kaolin/tests/samples/dibr/sphere/grad_face_vertices_image_35_31_70_0.01.pt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yuxuan1206/NF-Atlas/b7fc99fe752222f3c7f1b969f30f0dd01d7abe81/third-party/kaolin/tests/samples/dibr/sphere/grad_face_vertices_image_35_31_70_0.01.pt -------------------------------------------------------------------------------- /third-party/kaolin/tests/samples/dibr/sphere/grad_face_vertices_image_35_31_70_0.02.pt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yuxuan1206/NF-Atlas/b7fc99fe752222f3c7f1b969f30f0dd01d7abe81/third-party/kaolin/tests/samples/dibr/sphere/grad_face_vertices_image_35_31_70_0.02.pt -------------------------------------------------------------------------------- /third-party/kaolin/tests/samples/dibr/sphere/soft_mask_35_31_7000_0.01.pt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yuxuan1206/NF-Atlas/b7fc99fe752222f3c7f1b969f30f0dd01d7abe81/third-party/kaolin/tests/samples/dibr/sphere/soft_mask_35_31_7000_0.01.pt -------------------------------------------------------------------------------- /third-party/kaolin/tests/samples/dibr/sphere/soft_mask_35_31_7000_0.02.pt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yuxuan1206/NF-Atlas/b7fc99fe752222f3c7f1b969f30f0dd01d7abe81/third-party/kaolin/tests/samples/dibr/sphere/soft_mask_35_31_7000_0.02.pt -------------------------------------------------------------------------------- /third-party/kaolin/tests/samples/dibr/sphere/soft_mask_35_31_70_0.01.pt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yuxuan1206/NF-Atlas/b7fc99fe752222f3c7f1b969f30f0dd01d7abe81/third-party/kaolin/tests/samples/dibr/sphere/soft_mask_35_31_70_0.01.pt -------------------------------------------------------------------------------- /third-party/kaolin/tests/samples/dibr/sphere/soft_mask_35_31_70_0.02.pt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yuxuan1206/NF-Atlas/b7fc99fe752222f3c7f1b969f30f0dd01d7abe81/third-party/kaolin/tests/samples/dibr/sphere/soft_mask_35_31_70_0.02.pt -------------------------------------------------------------------------------- /third-party/kaolin/tests/samples/model.mtl: -------------------------------------------------------------------------------- 1 | # Blender MTL File: 'None' 2 | # Material Count: 1 3 | 4 | newmtl Material.002 5 | Ns 94.117647 6 | Ka 1.000000 1.000000 1.000000 7 | Kd 0.640000 0.640000 0.640000 8 | Ks 0.500000 0.500000 0.500000 9 | Ke 0.000000 0.000000 0.000000 10 | Ni 1.000000 11 | d 1.000000 12 | illum 2 13 | map_Kd tex.png 14 | -------------------------------------------------------------------------------- /third-party/kaolin/tests/samples/simple_obj/model.mtl: -------------------------------------------------------------------------------- 1 | newmtl Material.001 2 | Ka 0.500000 0.600000 0.700000 3 | Kd 0.400000 0.300000 0.200000 4 | Ks 0.100000 0.300000 0.500000 5 | map_Ka ambient_tex_001.png 6 | map_Kd diffuse_tex_001.png 7 | map_Ks . 8 | 9 | newmtl Material.002 10 | Ka 0.700000 0.700000 0.700000 11 | Kd 0.200000 0.200000 0.200000 12 | Ks 0.100000 0.100000 0.100000 13 | map_Ka ambient_tex_002.png 14 | map_Kd diffuse_tex_002.png 15 | map_Ks spec_col_tex_002.png 16 | 17 | newmtl Material.003 18 | Ka 0.000000 0.000000 0.000000 19 | Kd 0.000000 0.000000 0.000000 20 | Ks 0.000000 0.000000 0.000000 21 | -------------------------------------------------------------------------------- /third-party/kaolin/tests/samples/simple_off/model.off: -------------------------------------------------------------------------------- 1 | OFF 2 | # this is an example model 3 | 4 | 6 2 5 | # those are the vertices 6 | -0.100000 -0.100000 -0.100000 #Those are still vertices 7 | 0.100000 -0.100000 -0.100000 8 | -0.100000 0.100000 -0.100000 9 | 0.100000 0.100000 -0.100000 10 | -0.100000 -0.100000 0.100000 11 | 0.100000 -0.100000 0.100000 12 | 13 | #those are the faces followed by the face colors 14 | 4 1 2 4 3 128 128 128 #those are still faces 15 | 4 2 1 5 6 0 0 255 16 | -------------------------------------------------------------------------------- /third-party/kaolin/tests/samples/synthetic/0_depth_linear.npy: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yuxuan1206/NF-Atlas/b7fc99fe752222f3c7f1b969f30f0dd01d7abe81/third-party/kaolin/tests/samples/synthetic/0_depth_linear.npy -------------------------------------------------------------------------------- /third-party/kaolin/tests/samples/synthetic/0_instance.npy: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yuxuan1206/NF-Atlas/b7fc99fe752222f3c7f1b969f30f0dd01d7abe81/third-party/kaolin/tests/samples/synthetic/0_instance.npy -------------------------------------------------------------------------------- /third-party/kaolin/tests/samples/synthetic/0_semantic.npy: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yuxuan1206/NF-Atlas/b7fc99fe752222f3c7f1b969f30f0dd01d7abe81/third-party/kaolin/tests/samples/synthetic/0_semantic.npy -------------------------------------------------------------------------------- /third-party/kaolin/tests/samples/timelapse/notexture/ground_truth/mesh_0.usd: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yuxuan1206/NF-Atlas/b7fc99fe752222f3c7f1b969f30f0dd01d7abe81/third-party/kaolin/tests/samples/timelapse/notexture/ground_truth/mesh_0.usd -------------------------------------------------------------------------------- /third-party/kaolin/tests/samples/timelapse/notexture/ground_truth/mesh_1.usd: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yuxuan1206/NF-Atlas/b7fc99fe752222f3c7f1b969f30f0dd01d7abe81/third-party/kaolin/tests/samples/timelapse/notexture/ground_truth/mesh_1.usd -------------------------------------------------------------------------------- /third-party/kaolin/tests/samples/timelapse/notexture/input/pointcloud_0.usd: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yuxuan1206/NF-Atlas/b7fc99fe752222f3c7f1b969f30f0dd01d7abe81/third-party/kaolin/tests/samples/timelapse/notexture/input/pointcloud_0.usd -------------------------------------------------------------------------------- /third-party/kaolin/tests/samples/timelapse/notexture/input/pointcloud_1.usd: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yuxuan1206/NF-Atlas/b7fc99fe752222f3c7f1b969f30f0dd01d7abe81/third-party/kaolin/tests/samples/timelapse/notexture/input/pointcloud_1.usd -------------------------------------------------------------------------------- /third-party/kaolin/tests/samples/timelapse/notexture/output/mesh_0.usd: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yuxuan1206/NF-Atlas/b7fc99fe752222f3c7f1b969f30f0dd01d7abe81/third-party/kaolin/tests/samples/timelapse/notexture/output/mesh_0.usd -------------------------------------------------------------------------------- /third-party/kaolin/tests/samples/timelapse/notexture/output/mesh_1.usd: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yuxuan1206/NF-Atlas/b7fc99fe752222f3c7f1b969f30f0dd01d7abe81/third-party/kaolin/tests/samples/timelapse/notexture/output/mesh_1.usd -------------------------------------------------------------------------------- /third-party/kaolin/tests/samples/timelapse/notexture/output/pointcloud_0.usd: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yuxuan1206/NF-Atlas/b7fc99fe752222f3c7f1b969f30f0dd01d7abe81/third-party/kaolin/tests/samples/timelapse/notexture/output/pointcloud_0.usd -------------------------------------------------------------------------------- /third-party/kaolin/tests/samples/timelapse/notexture/output/pointcloud_1.usd: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yuxuan1206/NF-Atlas/b7fc99fe752222f3c7f1b969f30f0dd01d7abe81/third-party/kaolin/tests/samples/timelapse/notexture/output/pointcloud_1.usd -------------------------------------------------------------------------------- /third-party/kaolin/tests/samples/timelapse/notexture/output/voxelgrid_0.usd: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yuxuan1206/NF-Atlas/b7fc99fe752222f3c7f1b969f30f0dd01d7abe81/third-party/kaolin/tests/samples/timelapse/notexture/output/voxelgrid_0.usd -------------------------------------------------------------------------------- /third-party/kaolin/tests/samples/timelapse/notexture/output/voxelgrid_1.usd: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yuxuan1206/NF-Atlas/b7fc99fe752222f3c7f1b969f30f0dd01d7abe81/third-party/kaolin/tests/samples/timelapse/notexture/output/voxelgrid_1.usd -------------------------------------------------------------------------------- /third-party/kaolin/tools/check_torchlibs_versions.py: -------------------------------------------------------------------------------- 1 | import sys 2 | from pkg_resources import parse_version 3 | 4 | import torch, torchvision 5 | 6 | assert parse_version(torch.__version__).public == sys.argv[1], \ 7 | f"torch version should be {sys.argv[1]} but found {parse_version(torch.__version__).public}." 8 | assert parse_version(torchvision.__version__).public == sys.argv[2], \ 9 | f"torchvision version should be {sys.argv[2]} but found {parse_version(torchvision.__version__).public}." 10 | assert torch.version.cuda == sys.argv[3], \ 11 | f"torch cuda version should be {sys.argv[3]} but found {torch.version.cuda}." 12 | 13 | -------------------------------------------------------------------------------- /third-party/kaolin/tools/ci_requirements.txt: -------------------------------------------------------------------------------- 1 | flake8==3.7.9 2 | flake8-bugbear==20.1.4 3 | flake8-comprehensions==3.2.2 4 | flake8-mypy==17.8.0 5 | flake8-pyi==19.3.0 6 | pytest==7.1.0 7 | pytest-cov==3.0.0 8 | jupyter 9 | tornado==6.1 -------------------------------------------------------------------------------- /third-party/kaolin/tools/doc_requirements.txt: -------------------------------------------------------------------------------- 1 | setuptools>=50.3 2 | sphinx>=3.5.4,<5.1.0 3 | sphinx_rtd_theme==1.0.0 4 | -------------------------------------------------------------------------------- /third-party/kaolin/tools/get_torchvision_ver.sh: -------------------------------------------------------------------------------- 1 | if [ "$#" -ne 1 ]; then 2 | printf "Illegal number of parameters provided\n" >&2 3 | exit 2 4 | fi 5 | 6 | case $1 in 7 | 8 | "1.8.0") 9 | echo "0.9.0" 10 | ;; 11 | 12 | "1.8.1") 13 | echo "0.9.1" 14 | ;; 15 | 16 | "1.9.0") 17 | echo "0.10.0" 18 | ;; 19 | 20 | "1.9.1") 21 | echo "0.10.1" 22 | ;; 23 | 24 | "1.10.0") 25 | echo "0.11.0" 26 | ;; 27 | 28 | "1.10.1") 29 | echo "0.11.2" 30 | ;; 31 | 32 | "1.10.2") 33 | echo "0.11.3" 34 | ;; 35 | 36 | "1.11.0") 37 | echo "0.12.0" 38 | ;; 39 | 40 | "1.12.0") 41 | echo "0.13.0" 42 | ;; 43 | 44 | "1.12.1") 45 | echo "0.13.1" 46 | ;; 47 | 48 | "1.13.0") 49 | echo "0.14.0" 50 | ;; 51 | 52 | *) 53 | printf "ERROR $1 unsupported torch version\n" >&2 54 | exit 3 55 | ;; 56 | esac 57 | -------------------------------------------------------------------------------- /third-party/kaolin/tools/linux/Dockerfile.base_cpuonly: -------------------------------------------------------------------------------- 1 | #ARG CUDA_VERSION=11.3.1 2 | #ARG CUDNN_VERSION=8 3 | #FROM nvidia/cuda:${CUDA_VERSION}-cudnn${CUDNN_VERSION}-devel-ubuntu18.04 4 | FROM ubuntu:18.04 5 | # used for cross-compilation in docker build 6 | # 7 | ARG PYTHON_VERSION=3.9 8 | ENV PYTHON_VERSION=${PYTHON_VERSION} 9 | ARG PYTORCH_VERSION=1.10.2 10 | ENV PYTORCH_VERSION=${PYTORCH_VERSION} 11 | 12 | #RUN sed -i -e 's|^deb http://[^.]*[.]ubuntu[.]com/ubuntu|deb https://urm.nvidia.com/artifactory/ubuntu-remote|' /etc/apt/sources.list \ 13 | RUN echo "Acquire { https::Verify-Peer false }" > /etc/apt/apt.conf.d/99verify-peer.conf \ 14 | && apt-get update \ 15 | && DEBIAN_FRONTEND=noninteractive apt-get install -y --allow-unauthenticated ca-certificates \ 16 | && rm /etc/apt/apt.conf.d/99verify-peer.conf \ 17 | && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \ 18 | build-essential curl git unzip gfortran libopenblas-dev liblapack-dev \ 19 | libgtk2.0-0 libgtk-3-0 libgbm-dev libnotify-dev libgconf-2-4 \ 20 | libnss3 libxss1 libasound2 libxtst6 xauth xvfb \ 21 | && apt-get clean \ 22 | && rm -rf /var/lib/apt/lists/* 23 | 24 | 25 | RUN curl -o ~/miniconda.sh https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh 26 | RUN sh ~/miniconda.sh -b -p /opt/conda 27 | RUN rm ~/miniconda.sh 28 | RUN /opt/conda/bin/conda install -y python=${PYTHON_VERSION} 29 | RUN /opt/conda/bin/conda clean -ya 30 | 31 | ENV PATH /opt/conda/bin:$PATH 32 | 33 | RUN pip install torch==${PYTORCH_VERSION}+cpu -f https://download.pytorch.org/whl/torch_stable.html 34 | 35 | RUN conda install -c conda-forge nodejs==16.13.0 \ 36 | && conda clean --all --force-pkgs-dirs 37 | 38 | RUN conda list > conda_build.txt 39 | 40 | ### Install Dash3D Requirements ### 41 | WORKDIR /tmp 42 | RUN npm install -g npm@8.5.4 43 | COPY package.json package-lock.json ./ 44 | RUN npm install 45 | 46 | RUN pip install ninja setuptools==46.4.0 numpy==1.18.0 47 | -------------------------------------------------------------------------------- /third-party/kaolin/tools/linux/Dockerfile.install: -------------------------------------------------------------------------------- 1 | ARG BASE_IMAGE 2 | FROM ${BASE_IMAGE} 3 | 4 | # used for cross-compilation in docker build 5 | ARG FORCE_CUDA=1 6 | ENV FORCE_CUDA=${FORCE_CUDA} 7 | 8 | RUN if [ -f /etc/apt/sources.list.d/cuda.list ]; then \ 9 | rm /etc/apt/sources.list.d/cuda.list; \ 10 | fi \ 11 | && if [ -f /etc/apt/sources.list.d/nvidia-ml.list ]; then \ 12 | rm /etc/apt/sources.list.d/nvidia-ml.list; \ 13 | fi 14 | 15 | WORKDIR /kaolin 16 | 17 | COPY . . 18 | 19 | RUN apt-get -y update \ 20 | && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \ 21 | libgl1-mesa-dev \ 22 | libgles2-mesa-dev \ 23 | libegl1-mesa-dev \ 24 | git \ 25 | pkg-config \ 26 | libglvnd0 \ 27 | libgl1 \ 28 | libglx0 \ 29 | libegl1 \ 30 | libgles2 \ 31 | libglvnd-dev \ 32 | cmake \ 33 | && apt-get clean \ 34 | && rm -rf /var/lib/apt/lists/* 35 | 36 | 37 | ENV PYTHONDONTWRITEBYTECODE=1 38 | ENV PYTHONUNBUFFERED=1 39 | 40 | # for GLEW 41 | ENV LD_LIBRARY_PATH /usr/lib64:$LD_LIBRARY_PATH 42 | 43 | # nvidia-container-runtime 44 | ENV NVIDIA_VISIBLE_DEVICES all 45 | ENV NVIDIA_DRIVER_CAPABILITIES compute,utility,graphics 46 | 47 | ## Install Dash3D Requirements ### 48 | RUN conda install -c conda-forge nodejs==16.13.0 \ 49 | && conda clean --all --force-pkgs-dirs 50 | RUN npm install -g npm@8.5.4 51 | RUN npm install 52 | 53 | RUN pip install --upgrade pip && \ 54 | pip install --no-cache-dir setuptools==58.0.0 ninja cython==0.29.20 \ 55 | imageio imageio-ffmpeg 56 | # 57 | #ENV TORCH_CUDA_ARCH_LIST="6.0;6.1;6.2;7.0;7.5;8.0;8.6" 58 | 59 | RUN cd /tmp && \ 60 | git clone https://github.com/NVlabs/nvdiffrast && \ 61 | cd nvdiffrast && \ 62 | cp ./docker/10_nvidia.json /usr/share/glvnd/egl_vendor.d/10_nvidia.json && \ 63 | pip install . 64 | 65 | ENV KAOLIN_INSTALL_EXPERIMENTAL "1" 66 | ENV IGNORE_TORCH_VER "1" 67 | RUN python setup.py develop 68 | -------------------------------------------------------------------------------- /third-party/kaolin/tools/linux/Dockerfile.install_wheel: -------------------------------------------------------------------------------- 1 | ARG BASE_IMAGE 2 | FROM ${BASE_IMAGE} 3 | 4 | RUN if [ -f /etc/apt/sources.list.d/cuda.list ]; then \ 5 | rm /etc/apt/sources.list.d/cuda.list; \ 6 | fi \ 7 | && if [ -f /etc/apt/sources.list.d/nvidia-ml.list ]; then \ 8 | rm /etc/apt/sources.list.d/nvidia-ml.list; \ 9 | fi 10 | 11 | WORKDIR /kaolin 12 | 13 | ARG WHEEL_NAME 14 | 15 | COPY ./package.json ./package-lock.json ./${WHEEL_NAME} ./ 16 | COPY ./examples ./examples 17 | COPY ./tests ./tests 18 | COPY ./tools ./tools 19 | RUN apt-get -y update \ 20 | && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \ 21 | libgl1-mesa-dev \ 22 | libgles2-mesa-dev \ 23 | libegl1-mesa-dev \ 24 | git \ 25 | pkg-config \ 26 | libglvnd0 \ 27 | libgl1 \ 28 | libglx0 \ 29 | libegl1 \ 30 | libgles2 \ 31 | libglvnd-dev \ 32 | cmake \ 33 | && apt-get clean \ 34 | && rm -rf /var/lib/apt/lists/* 35 | 36 | 37 | ENV PYTHONDONTWRITEBYTECODE=1 38 | ENV PYTHONUNBUFFERED=1 39 | 40 | # for GLEW 41 | ENV LD_LIBRARY_PATH /usr/lib64:$LD_LIBRARY_PATH 42 | 43 | # nvidia-container-runtime 44 | #ENV NVIDIA_VISIBLE_DEVICES all 45 | ENV NVIDIA_DRIVER_CAPABILITIES compute,utility,graphics 46 | 47 | # Default pyopengl to EGL for good headless rendering support 48 | ENV PYOPENGL_PLATFORM egl 49 | 50 | ## Install Dash3D Requirements ### 51 | RUN conda install -c conda-forge nodejs==16.13.0 \ 52 | && conda clean --all --force-pkgs-dirs 53 | RUN npm install -g npm@8.5.4 54 | RUN npm install 55 | 56 | RUN pip install --upgrade pip && \ 57 | pip install --no-cache-dir imageio imageio-ffmpeg 58 | 59 | RUN cd /tmp && \ 60 | git clone https://github.com/NVlabs/nvdiffrast && \ 61 | cd nvdiffrast && \ 62 | cp ./docker/10_nvidia.json /usr/share/glvnd/egl_vendor.d/10_nvidia.json && \ 63 | pip install . 64 | 65 | RUN pip install ./${WHEEL_NAME} 66 | -------------------------------------------------------------------------------- /third-party/kaolin/tools/requirements.txt: -------------------------------------------------------------------------------- 1 | cython==0.29.20 2 | torch>=1.5.0 3 | -------------------------------------------------------------------------------- /third-party/kaolin/tools/windows/SetupDriver.ps1: -------------------------------------------------------------------------------- 1 | $Env:driver_store=$(ls $($($(Get-WmiObject Win32_VideoController).InstalledDisplayDrivers | sort -Unique).ToString().Split(',')| sort -Unique).ToString().Replace("\DriverStore\", "\HostDriverStore\")).Directory.FullName 2 | 3 | cp "$Env:driver_store\nvcuda64.dll" C:\Windows\System32\nvcuda.dll 4 | cp "$Env:driver_store\nvapi64.dll" C:\Windows\System32\nvapi64.dll 5 | 6 | -------------------------------------------------------------------------------- /third-party/kaolin/tools/windows/Test.ps1: -------------------------------------------------------------------------------- 1 | echo "******** Running Device Query ********" 2 | c:\data\deviceQuery.exe 3 | echo "******** DONE ********" 4 | echo "******** Running Bandwidth Test ********" 5 | c:\data\bandwidthTest.exe 6 | echo "******** DONE ********" -------------------------------------------------------------------------------- /third-party/kaolin/tools/windows/bandwidthTest.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yuxuan1206/NF-Atlas/b7fc99fe752222f3c7f1b969f30f0dd01d7abe81/third-party/kaolin/tools/windows/bandwidthTest.exe -------------------------------------------------------------------------------- /third-party/kaolin/tools/windows/deviceQuery.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yuxuan1206/NF-Atlas/b7fc99fe752222f3c7f1b969f30f0dd01d7abe81/third-party/kaolin/tools/windows/deviceQuery.exe -------------------------------------------------------------------------------- /third-party/kaolin/tools/windows/main.ps1: -------------------------------------------------------------------------------- 1 | c:\data\SetupDriver.ps1 2 | c:\data\Test.ps1 3 | -------------------------------------------------------------------------------- /third-party/kaolin/version.txt: -------------------------------------------------------------------------------- 1 | 0.12.0 2 | -------------------------------------------------------------------------------- /third-party/setup.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | cd kaolin 4 | python setup.py develop 5 | 6 | cd - 7 | cd kaolin-wisp 8 | python setup.py develop 9 | 10 | cd - 11 | git clone --recursive https://github.com/princeton-vl/lietorch.git 12 | cd lietorch 13 | python setup.py install 14 | 15 | cd - 16 | git clone https://github.com/fogleman/sdf.git 17 | cd sdf 18 | pip install -e . 19 | 20 | cd - 21 | git clone https://github.com/autonomousvision/kitti360Scripts.git 22 | cd kitti360Scripts 23 | CYTHONIZE_EVAL= python setup.py build_ext --inplace 24 | CYTHONIZE_EVAL= python setup.py install 25 | 26 | -------------------------------------------------------------------------------- /tools/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yuxuan1206/NF-Atlas/b7fc99fe752222f3c7f1b969f30f0dd01d7abe81/tools/__init__.py -------------------------------------------------------------------------------- /tools/draw_line.py: -------------------------------------------------------------------------------- 1 | 2 | import numpy as np 3 | from matplotlib import pyplot as plt 4 | import torch 5 | from lietorch import SE3 6 | # from pytorch3d import transforms 7 | from scipy.spatial.transform import Rotation as R 8 | import os 9 | 10 | 11 | def plot_traj(path, vec_es_init, frame_position, t_gt, t_loam, t_es, vec_loam, step, key_idx, i, color): 12 | # w2g = w2g.cpu().numpy() 13 | # scale_ = w2g[0,0] 14 | frame_position = frame_position.cpu().numpy() 15 | 16 | fig = plt.figure(figsize=(20, 20)) 17 | ax = plt.axes(projection='3d') 18 | # ax.scatter(odom_p_[:,0].numpy(), odom_p_[:,1].numpy(), odom_p_[:,2].numpy(), c='b') 19 | 20 | ax.plot(t_gt[:,0], t_gt[:,1], t_gt[:,2], c='y') 21 | # ax.plot(t_loam[:,0], t_loam[:,1], t_loam[:,2], c='y') 22 | if vec_loam!=None: 23 | ax.scatter(vec_loam[:,0], vec_loam[:,1], vec_loam[:,2], c='k') 24 | if vec_es_init!=None: 25 | ax.scatter(vec_es_init[:,0], vec_es_init[:,1], vec_es_init[:,2], c='g') 26 | ax.scatter(t_es[:,0], t_es[:,1], t_es[:,2], c=color) 27 | ax.scatter(frame_position[:,0], frame_position[:,1], frame_position[:,2], c='r') 28 | # plt.axis('off') 29 | 30 | ax.set_xlim3d([-330, 30]) #14 31 | ax.set_ylim3d([-30, 330]) 32 | ax.set_zlim3d([-80, 100]) #6 33 | 34 | ax.set_xlabel("x") 35 | ax.set_ylabel("y") 36 | ax.set_zlabel("z") 37 | # ax.view_init(elev=48, azim=-167) #44 -149 38 | ax.view_init(elev=40, azim=-80) 39 | 40 | os.makedirs(path, exist_ok=True) 41 | plt.savefig(os.path.join(path,"pose_img/%d_%d.png" % (step,i))) #key_idx 42 | plt.close('all') 43 | # plt.show() 44 | -------------------------------------------------------------------------------- /utils/loop/UtilsPointcloud.py: -------------------------------------------------------------------------------- 1 | import os 2 | import random 3 | import numpy as np 4 | 5 | def random_sampling(orig_points, num_points): 6 | assert orig_points.shape[0] > num_points 7 | 8 | points_down_idx = random.sample(range(orig_points.shape[0]), num_points) 9 | down_points = orig_points[points_down_idx, :] 10 | 11 | return down_points 12 | 13 | def readScan(bin_path, dataset='KITTI'): 14 | if(dataset == 'KITTI'): 15 | return readKittiScan(bin_path) 16 | 17 | 18 | def readKittiScan(bin_path): 19 | scan = np.fromfile(bin_path, dtype=np.float32) 20 | scan = scan.reshape((-1, 4)) 21 | ptcloud_xyz = scan[:, :-1] 22 | return ptcloud_xyz 23 | 24 | 25 | class KittiScanDirManager: 26 | def __init__(self, scan_dir): 27 | self.scan_dir = scan_dir 28 | 29 | self.scan_names = os.listdir(scan_dir) 30 | self.scan_names.sort() 31 | 32 | self.scan_fullpaths = [os.path.join(self.scan_dir, name) for name in self.scan_names] 33 | 34 | self.num_scans = len(self.scan_names) 35 | 36 | def __repr__(self): 37 | return ' ' + str(self.num_scans) + ' scans in the sequence (' + self.scan_dir + '/)' 38 | 39 | def getScanNames(self): 40 | return self.scan_names 41 | def getScanFullPaths(self): 42 | return self.scan_fullpaths 43 | def printScanFullPaths(self): 44 | return print("\n".join(self.scan_fullpaths)) 45 | 46 | -------------------------------------------------------------------------------- /utils/scannet_data_tools/write_evo_data.py: -------------------------------------------------------------------------------- 1 | import os 2 | import torch 3 | import numpy as np 4 | from dataset.kitti360.init_kitti360_pose import read_time 5 | 6 | 7 | def record_evo_data(train_list_key_frame, vec_es, vecs_gt_mask, prodir, savedir, device, name): 8 | os.makedirs(savedir, exist_ok=True) 9 | with torch.no_grad(): 10 | time_stamp = torch.from_numpy(read_time(prodir)[train_list_key_frame]).to(device) 11 | vec_result = torch.zeros(1,8).to(device) 12 | vec_gt_result = torch.zeros(1,8).to(device) 13 | for i in range(len(train_list_key_frame)): 14 | vec_result = torch.vstack((vec_result, torch.hstack((time_stamp[i], vec_es[f"{train_list_key_frame[i]}"])) )) 15 | vec_gt_result = torch.vstack((vec_gt_result, torch.hstack((time_stamp[i], vecs_gt_mask[f"{train_list_key_frame[i]}"])) )) 16 | np.savetxt(os.path.join(savedir, f"pose/{name}_pose_es.txt"), np.array(vec_result[1:,:].cpu()), fmt='%.5f %.5f %.5f %.5f %.5f %.5f %.5f %.5f',delimiter='\t') 17 | np.savetxt(os.path.join(savedir, f"pose/{name}_pose_gt.txt"), np.array(vec_gt_result[1:,:].cpu()), fmt='%.5f %.5f %.5f %.5f %.5f %.5f %.5f %.5f',delimiter='\t') --------------------------------------------------------------------------------