rayd 0.2.1__tar.gz → 0.2.2__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (135) hide show
  1. {rayd-0.2.1 → rayd-0.2.2}/PKG-INFO +1 -1
  2. {rayd-0.2.1 → rayd-0.2.2}/pyproject.toml +1 -1
  3. {rayd-0.2.1 → rayd-0.2.2}/src/rayd.cpp +55 -0
  4. {rayd-0.2.1 → rayd-0.2.2}/tests/drjit/test_geometry.py +40 -0
  5. {rayd-0.2.1 → rayd-0.2.2}/.github/constraints/drjit-build.txt +0 -0
  6. {rayd-0.2.1 → rayd-0.2.2}/.github/workflows/pypi.yml +0 -0
  7. {rayd-0.2.1 → rayd-0.2.2}/.gitignore +0 -0
  8. {rayd-0.2.1 → rayd-0.2.2}/CMakeLists.txt +0 -0
  9. {rayd-0.2.1 → rayd-0.2.2}/LICENSE +0 -0
  10. {rayd-0.2.1 → rayd-0.2.2}/README.md +0 -0
  11. {rayd-0.2.1 → rayd-0.2.2}/cmake/embed_ptx.cmake +0 -0
  12. {rayd-0.2.1 → rayd-0.2.2}/docs/api_reference.md +0 -0
  13. {rayd-0.2.1 → rayd-0.2.2}/docs/build_optimization.md +0 -0
  14. {rayd-0.2.1 → rayd-0.2.2}/docs/edge_bvh_bottleneck_analysis.md +0 -0
  15. {rayd-0.2.1 → rayd-0.2.2}/docs/edge_bvh_lbvh_treelet_improvement_plan.md +0 -0
  16. {rayd-0.2.1 → rayd-0.2.2}/docs/edge_bvh_optimization_log.md +0 -0
  17. {rayd-0.2.1 → rayd-0.2.2}/docs/edge_bvh_stage3_preparation.md +0 -0
  18. {rayd-0.2.1 → rayd-0.2.2}/docs/multi_bounce_reflection_trace.md +0 -0
  19. {rayd-0.2.1 → rayd-0.2.2}/docs/performance_benchmark.json +0 -0
  20. {rayd-0.2.1 → rayd-0.2.2}/docs/performance_benchmark.png +0 -0
  21. {rayd-0.2.1 → rayd-0.2.2}/docs/reflection_trace_gpu_dedup.md +0 -0
  22. {rayd-0.2.1 → rayd-0.2.2}/docs/slang_interop.md +0 -0
  23. {rayd-0.2.1 → rayd-0.2.2}/examples/README.md +0 -0
  24. {rayd-0.2.1 → rayd-0.2.2}/examples/basics/camera_edge_sampling_gradient.py +0 -0
  25. {rayd-0.2.1 → rayd-0.2.2}/examples/basics/nearest_edge_query.py +0 -0
  26. {rayd-0.2.1 → rayd-0.2.2}/examples/basics/ray_mesh_intersection.py +0 -0
  27. {rayd-0.2.1 → rayd-0.2.2}/examples/renderer/README.md +0 -0
  28. {rayd-0.2.1 → rayd-0.2.2}/examples/renderer/cornell_box.png +0 -0
  29. {rayd-0.2.1 → rayd-0.2.2}/examples/renderer/cornell_box.py +0 -0
  30. {rayd-0.2.1 → rayd-0.2.2}/examples/renderer/rfdt.png +0 -0
  31. {rayd-0.2.1 → rayd-0.2.2}/include/rayd/camera.h +0 -0
  32. {rayd-0.2.1 → rayd-0.2.2}/include/rayd/constants.h +0 -0
  33. {rayd-0.2.1 → rayd-0.2.2}/include/rayd/edge.h +0 -0
  34. {rayd-0.2.1 → rayd-0.2.2}/include/rayd/fwd.h +0 -0
  35. {rayd-0.2.1 → rayd-0.2.2}/include/rayd/intersection.h +0 -0
  36. {rayd-0.2.1 → rayd-0.2.2}/include/rayd/mesh.h +0 -0
  37. {rayd-0.2.1 → rayd-0.2.2}/include/rayd/optix.h +0 -0
  38. {rayd-0.2.1 → rayd-0.2.2}/include/rayd/ray.h +0 -0
  39. {rayd-0.2.1 → rayd-0.2.2}/include/rayd/rayd.h +0 -0
  40. {rayd-0.2.1 → rayd-0.2.2}/include/rayd/reflection.h +0 -0
  41. {rayd-0.2.1 → rayd-0.2.2}/include/rayd/scene/scene.h +0 -0
  42. {rayd-0.2.1 → rayd-0.2.2}/include/rayd/scene/scene_edge.h +0 -0
  43. {rayd-0.2.1 → rayd-0.2.2}/include/rayd/scene/scene_optix.h +0 -0
  44. {rayd-0.2.1 → rayd-0.2.2}/include/rayd/slang/interop.h +0 -0
  45. {rayd-0.2.1 → rayd-0.2.2}/include/rayd/slang/interop_types.h +0 -0
  46. {rayd-0.2.1 → rayd-0.2.2}/include/rayd/slang/rayd.slang +0 -0
  47. {rayd-0.2.1 → rayd-0.2.2}/include/rayd/transform.h +0 -0
  48. {rayd-0.2.1 → rayd-0.2.2}/include/rayd/types.h +0 -0
  49. {rayd-0.2.1 → rayd-0.2.2}/include/rayd/utils.h +0 -0
  50. {rayd-0.2.1 → rayd-0.2.2}/include/rayd_slang.slang +0 -0
  51. {rayd-0.2.1 → rayd-0.2.2}/rayd/__init__.py +0 -0
  52. {rayd-0.2.1 → rayd-0.2.2}/rayd/slang/__init__.py +0 -0
  53. {rayd-0.2.1 → rayd-0.2.2}/rayd/torch/__init__.py +0 -0
  54. {rayd-0.2.1 → rayd-0.2.2}/rayd/torch/_convert.py +0 -0
  55. {rayd-0.2.1 → rayd-0.2.2}/rayd/torch/_env.py +0 -0
  56. {rayd-0.2.1 → rayd-0.2.2}/rayd/torch/_interop_patch.py +0 -0
  57. {rayd-0.2.1 → rayd-0.2.2}/rayd/torch/_native.py +0 -0
  58. {rayd-0.2.1 → rayd-0.2.2}/rayd/torch/_state.py +0 -0
  59. {rayd-0.2.1 → rayd-0.2.2}/rayd/torch/_util.py +0 -0
  60. {rayd-0.2.1 → rayd-0.2.2}/rayd/torch/camera.py +0 -0
  61. {rayd-0.2.1 → rayd-0.2.2}/rayd/torch/mesh.py +0 -0
  62. {rayd-0.2.1 → rayd-0.2.2}/rayd/torch/scene.py +0 -0
  63. {rayd-0.2.1 → rayd-0.2.2}/rayd/torch/types.py +0 -0
  64. {rayd-0.2.1 → rayd-0.2.2}/src/camera.cpp +0 -0
  65. {rayd-0.2.1 → rayd-0.2.2}/src/mesh.cpp +0 -0
  66. {rayd-0.2.1 → rayd-0.2.2}/src/multipath/reflection_dedup.cu +0 -0
  67. {rayd-0.2.1 → rayd-0.2.2}/src/multipath/reflection_dedup.h +0 -0
  68. {rayd-0.2.1 → rayd-0.2.2}/src/multipath/reflection_trace.cu +0 -0
  69. {rayd-0.2.1 → rayd-0.2.2}/src/multipath/reflection_trace_host.cpp +0 -0
  70. {rayd-0.2.1 → rayd-0.2.2}/src/multipath/reflection_trace_host.h +0 -0
  71. {rayd-0.2.1 → rayd-0.2.2}/src/multipath/reflection_trace_params.h +0 -0
  72. {rayd-0.2.1 → rayd-0.2.2}/src/multipath/reflection_trace_ptx.h +0 -0
  73. {rayd-0.2.1 → rayd-0.2.2}/src/native_launch_audit.cpp +0 -0
  74. {rayd-0.2.1 → rayd-0.2.2}/src/native_launch_audit.h +0 -0
  75. {rayd-0.2.1 → rayd-0.2.2}/src/optix.cpp +0 -0
  76. {rayd-0.2.1 → rayd-0.2.2}/src/scene/edge_bvh.cu +0 -0
  77. {rayd-0.2.1 → rayd-0.2.2}/src/scene/edge_bvh.h +0 -0
  78. {rayd-0.2.1 → rayd-0.2.2}/src/scene/edge_bvh_config.h +0 -0
  79. {rayd-0.2.1 → rayd-0.2.2}/src/scene/experimental/edge_bvh_ploc.h +0 -0
  80. {rayd-0.2.1 → rayd-0.2.2}/src/scene/experimental/edge_bvh_ploc_build.inc +0 -0
  81. {rayd-0.2.1 → rayd-0.2.2}/src/scene/experimental/edge_bvh_ploc_kernels.inc +0 -0
  82. {rayd-0.2.1 → rayd-0.2.2}/src/scene/experimental/scene_edge_ploc.inc +0 -0
  83. {rayd-0.2.1 → rayd-0.2.2}/src/scene/scene.cpp +0 -0
  84. {rayd-0.2.1 → rayd-0.2.2}/src/scene/scene_edge.cpp +0 -0
  85. {rayd-0.2.1 → rayd-0.2.2}/src/scene/scene_optix.cpp +0 -0
  86. {rayd-0.2.1 → rayd-0.2.2}/src/slang_interop.cpp +0 -0
  87. {rayd-0.2.1 → rayd-0.2.2}/tests/__init__.py +0 -0
  88. {rayd-0.2.1 → rayd-0.2.2}/tests/baseline_cases.py +0 -0
  89. {rayd-0.2.1 → rayd-0.2.2}/tests/baseline_utils.py +0 -0
  90. {rayd-0.2.1 → rayd-0.2.2}/tests/baselines/drjit_v0_4_6/camera/perspective_fov.json +0 -0
  91. {rayd-0.2.1 → rayd-0.2.2}/tests/baselines/drjit_v0_4_6/camera/perspective_intrinsic.json +0 -0
  92. {rayd-0.2.1 → rayd-0.2.2}/tests/baselines/drjit_v0_4_6/camera/sample_primary_ray.json +0 -0
  93. {rayd-0.2.1 → rayd-0.2.2}/tests/baselines/drjit_v0_4_6/camera/sample_to_world.json +0 -0
  94. {rayd-0.2.1 → rayd-0.2.2}/tests/baselines/drjit_v0_4_6/camera/world_to_sample.json +0 -0
  95. {rayd-0.2.1 → rayd-0.2.2}/tests/baselines/drjit_v0_4_6/edges/primary_edge_sampling.json +0 -0
  96. {rayd-0.2.1 → rayd-0.2.2}/tests/baselines/drjit_v0_4_6/edges/secondary_edges.json +0 -0
  97. {rayd-0.2.1 → rayd-0.2.2}/tests/baselines/drjit_v0_4_6/geometry/batched_hits.json +0 -0
  98. {rayd-0.2.1 → rayd-0.2.2}/tests/baselines/drjit_v0_4_6/geometry/constant_hit.json +0 -0
  99. {rayd-0.2.1 → rayd-0.2.2}/tests/baselines/drjit_v0_4_6/geometry/degenerate.json +0 -0
  100. {rayd-0.2.1 → rayd-0.2.2}/tests/baselines/drjit_v0_4_6/geometry/miss.json +0 -0
  101. {rayd-0.2.1 → rayd-0.2.2}/tests/baselines/drjit_v0_4_6/geometry/multi_mesh.json +0 -0
  102. {rayd-0.2.1 → rayd-0.2.2}/tests/baselines/drjit_v0_4_6/geometry/uv.json +0 -0
  103. {rayd-0.2.1 → rayd-0.2.2}/tests/baselines/drjit_v0_4_6/gradients/transform_gradients.json +0 -0
  104. {rayd-0.2.1 → rayd-0.2.2}/tests/baselines/drjit_v0_4_6/gradients/vertex_gradients.json +0 -0
  105. {rayd-0.2.1 → rayd-0.2.2}/tests/baselines/drjit_v0_4_6/manifest.json +0 -0
  106. {rayd-0.2.1 → rayd-0.2.2}/tests/baselines/drjit_v0_4_6/stress/repeated_run_summary.json +0 -0
  107. {rayd-0.2.1 → rayd-0.2.2}/tests/baselines/drjit_v0_4_6/transforms/composition_left_right.json +0 -0
  108. {rayd-0.2.1 → rayd-0.2.2}/tests/baselines/drjit_v0_4_6/transforms/direction_transform_checks.json +0 -0
  109. {rayd-0.2.1 → rayd-0.2.2}/tests/baselines/drjit_v0_4_6/transforms/matrix_entry_checks.json +0 -0
  110. {rayd-0.2.1 → rayd-0.2.2}/tests/baselines/drjit_v0_4_6/transforms/point_transform_checks.json +0 -0
  111. {rayd-0.2.1 → rayd-0.2.2}/tests/benchmark_edge_bvh_cutoff_compare.py +0 -0
  112. {rayd-0.2.1 → rayd-0.2.2}/tests/benchmark_edge_bvh_pressure.py +0 -0
  113. {rayd-0.2.1 → rayd-0.2.2}/tests/benchmark_edge_bvh_stages.py +0 -0
  114. {rayd-0.2.1 → rayd-0.2.2}/tests/benchmark_edge_queries.py +0 -0
  115. {rayd-0.2.1 → rayd-0.2.2}/tests/benchmark_support.py +0 -0
  116. {rayd-0.2.1 → rayd-0.2.2}/tests/drjit/__init__.py +0 -0
  117. {rayd-0.2.1 → rayd-0.2.2}/tests/drjit/test_baseline.py +0 -0
  118. {rayd-0.2.1 → rayd-0.2.2}/tests/profile_kernel_launches.py +0 -0
  119. {rayd-0.2.1 → rayd-0.2.2}/tests/slang/__init__.py +0 -0
  120. {rayd-0.2.1 → rayd-0.2.2}/tests/slang/cases/load_module_error.py +0 -0
  121. {rayd-0.2.1 → rayd-0.2.2}/tests/slang/cases/slang_ad_autograd.py +0 -0
  122. {rayd-0.2.1 → rayd-0.2.2}/tests/slang/cases/slang_ad_multi_param.py +0 -0
  123. {rayd-0.2.1 → rayd-0.2.2}/tests/slang/cases/slang_ad_optimize.py +0 -0
  124. {rayd-0.2.1 → rayd-0.2.2}/tests/slang/cases/slang_ad_struct_return.py +0 -0
  125. {rayd-0.2.1 → rayd-0.2.2}/tests/slang/cases/slang_rayd_intersect.py +0 -0
  126. {rayd-0.2.1 → rayd-0.2.2}/tests/slang/cases/slang_rayd_nearest_edge.py +0 -0
  127. {rayd-0.2.1 → rayd-0.2.2}/tests/slang/shaders/rayd_query.slang +0 -0
  128. {rayd-0.2.1 → rayd-0.2.2}/tests/slang/shaders/rayd_query_ad.slang +0 -0
  129. {rayd-0.2.1 → rayd-0.2.2}/tests/slang/test_interop.slang +0 -0
  130. {rayd-0.2.1 → rayd-0.2.2}/tests/slang/test_slang.py +0 -0
  131. {rayd-0.2.1 → rayd-0.2.2}/tests/test_project_metadata.py +0 -0
  132. {rayd-0.2.1 → rayd-0.2.2}/tests/test_torch_interop_patch.py +0 -0
  133. {rayd-0.2.1 → rayd-0.2.2}/tests/torch/__init__.py +0 -0
  134. {rayd-0.2.1 → rayd-0.2.2}/tests/torch/test_edge_bvh_pressure.py +0 -0
  135. {rayd-0.2.1 → rayd-0.2.2}/tests/torch/test_geometry.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: rayd
3
- Version: 0.2.1
3
+ Version: 0.2.2
4
4
  Summary: RayD: minimalist differentiable ray tracing package wrapping Dr.Jit and OptiX.
5
5
  Author-Email: Xingyu Chen <xic063@ucsd.edu>
6
6
  License: BSD-3-Clause
@@ -5,7 +5,7 @@ build-backend = "scikit_build_core.build"
5
5
 
6
6
  [project]
7
7
  name = "rayd"
8
- version = "0.2.1"
8
+ version = "0.2.2"
9
9
  description = "RayD: minimalist differentiable ray tracing package wrapping Dr.Jit and OptiX."
10
10
  readme = "README.md"
11
11
  authors = [{ name = "Xingyu Chen", email = "xic063@ucsd.edu" }]
@@ -502,6 +502,61 @@ NB_MODULE(rayd, m) {
502
502
  bind_section("mesh", [&]() {
503
503
  nb::class_<Mesh>(m, "Mesh")
504
504
  .def(nb::init<>())
505
+ .def("__init__",
506
+ [](Mesh *mesh,
507
+ nb::handle v_obj,
508
+ const Vector3iDetached &f,
509
+ nb::handle uv_obj,
510
+ const Vector3iDetached &f_uv,
511
+ bool verbose) {
512
+ const std::string v_module_name =
513
+ nb::cast<std::string>(v_obj.type().attr("__module__"));
514
+ const std::string v_type_name =
515
+ nb::cast<std::string>(v_obj.type().attr("__name__"));
516
+ const std::string uv_module_name =
517
+ nb::cast<std::string>(uv_obj.type().attr("__module__"));
518
+ const std::string uv_type_name =
519
+ nb::cast<std::string>(uv_obj.type().attr("__name__"));
520
+
521
+ const bool has_live_v =
522
+ v_module_name == "drjit.cuda.ad" && v_type_name == "Array3f";
523
+ const bool has_live_uv =
524
+ uv_module_name == "drjit.cuda.ad" && uv_type_name == "Array2f";
525
+ if (!has_live_v && !has_live_uv) {
526
+ throw nb::next_overload();
527
+ }
528
+
529
+ Vector3fDetached v_detached;
530
+ if (has_live_v) {
531
+ const Vector3f v_live = nb::cast<Vector3f>(v_obj);
532
+ v_detached = detach<false>(v_live);
533
+ } else if (!drjit_try_load<Vector3fDetached>(v_obj, v_detached, true)) {
534
+ throw nb::next_overload();
535
+ }
536
+
537
+ Vector2fDetached uv_detached;
538
+ if (has_live_uv) {
539
+ const Vector2f uv_live = nb::cast<Vector2f>(uv_obj);
540
+ uv_detached = detach<false>(uv_live);
541
+ } else if (!drjit_try_load<Vector2fDetached>(uv_obj, uv_detached, true)) {
542
+ throw nb::next_overload();
543
+ }
544
+
545
+ new (mesh) Mesh(v_detached, f, uv_detached, f_uv, verbose);
546
+ if (has_live_v) {
547
+ const Vector3f v_live = nb::cast<Vector3f>(v_obj);
548
+ mesh->set_vertex_positions(v_live);
549
+ }
550
+ if (has_live_uv) {
551
+ const Vector2f uv_live = nb::cast<Vector2f>(uv_obj);
552
+ mesh->set_vertex_uv(uv_live);
553
+ }
554
+ },
555
+ "v"_a,
556
+ "f"_a,
557
+ "uv"_a = Vector2fDetached(),
558
+ "f_uv"_a = Vector3iDetached(),
559
+ "verbose"_a = false)
505
560
  .def("__init__",
506
561
  [](Mesh *mesh,
507
562
  const Vector3fDetached &v,
@@ -654,6 +654,46 @@ class GeometryCoreTests(unittest.TestCase):
654
654
  self.assertAlmostEqual(data["t"], 1.0, places=5)
655
655
  self.assertGreater(data["grad_z_sum"], 0.0)
656
656
 
657
+ def test_trace_reflections_preserves_gradients_for_ad_mesh_constructor_inputs(self):
658
+ data = run_json_case(
659
+ """
660
+ import json
661
+ import rayd as pj
662
+ import drjit as dr
663
+ import drjit.cuda as cuda
664
+ import drjit.cuda.ad as ad
665
+
666
+ verts = ad.Array3f([0.0, 1.0, 0.0],
667
+ [0.0, 0.0, 1.0],
668
+ [0.0, 0.0, 0.0])
669
+ dr.enable_grad(verts)
670
+
671
+ mesh = pj.Mesh(verts, cuda.Array3i([0], [1], [2]))
672
+
673
+ scene = pj.Scene()
674
+ scene.add_mesh(mesh)
675
+ scene.build()
676
+
677
+ ray = pj.Ray(ad.Array3f([0.25], [0.25], [-1.0]),
678
+ ad.Array3f([0.0], [0.0], [1.0]))
679
+ chain = scene.trace_reflections(ray, max_bounces=1, symbolic=False)
680
+ dr.backward(dr.sum(chain.t))
681
+ grad = dr.grad(verts)
682
+
683
+ print(json.dumps({
684
+ "bounce_count": int(chain.bounce_count[0]),
685
+ "valid": bool(chain.is_valid()[0]),
686
+ "t": float(chain.t[0]),
687
+ "grad_z_sum": float(grad[2][0] + grad[2][1] + grad[2][2]),
688
+ }))
689
+ """
690
+ )
691
+
692
+ self.assertEqual(data["bounce_count"], 1)
693
+ self.assertTrue(data["valid"])
694
+ self.assertAlmostEqual(data["t"], 1.0, places=5)
695
+ self.assertGreater(data["grad_z_sum"], 0.0)
696
+
657
697
  def test_trace_reflections_supports_multi_bounce_symbolic_trace(self):
658
698
  data = run_json_case(
659
699
  """
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes