feat: raycasting architecture with analytic primitives and quiver mesh BVH#5
Open
mtao wants to merge 5 commits into
Open
feat: raycasting architecture with analytic primitives and quiver mesh BVH#5mtao wants to merge 5 commits into
mtao wants to merge 5 commits into
Conversation
…ndency()
Switch zipper consumption from subproject().get_variable() to
dependency() with [provide] section in wrap file. Add
meson.override_dependency() for art and art-headers so downstream
projects can consume them via dependency().
Remove dead code: unused dl_lib (cc.find_library('dl')) and unused
TBB_dep (dependency('tbb')) that were declared but never referenced.
Add viewer option to meson_options.txt for future balsa::visualization
integration.
# Conflicts: # meson_options.txt
…gle primitives Phase 1 — Core type enrichment: - Ray gains mutable Rational tMax for PBRT-style closest-hit pruning - Intersection enriched with geometric_normal, uv, dpdu/dpdv tangent vectors, geometry pointer, and primitive_index - Vector2d alias added to zipper_types.hpp - Sphere/Box intersect() updated with full field population and tMax - SceneNode transforms normals (inverse-transpose) and tangent vectors - Camera::render() resets tMax per pixel, uses normal-based coloring - Fix mdspan.wrap (standalone instead of broken wrap-redirect) Phase 2 — New analytic primitives: - Plane: infinite z=0 plane with UV=(x,y) and constant normal - Disk: unit disk at z=0 with polar UV and radius check - Cylinder: z-axis unit cylinder z∈[0,1] r=1, quadratic intersection - Triangle: Moller-Trumbore with optional per-vertex normals/UVs, PBRT dpdu/dpdv formula from UV differentials All 64 tests pass (62 passed, 2 skipped for optional EXR/PNG).
…asting Add MeshGeometry class wrapping quiver::Mesh<2> with AABB BVH for fast ray-triangle intersection. Bridges ART's rational/homogeneous types to quiver's double-precision spatial queries at the intersection boundary. - MeshGeometry: quiver mesh + BVH wrapper implementing Geometry::intersect() - mesh_utils: convenience factories (make_cube_mesh, make_tetrahedron_mesh, make_single_triangle_mesh, make_mesh_geometry) - 9 test cases covering hit/miss, tMax pruning, bounding box, construction - quiver added as hard dependency via subprojects/quiver.wrap
…ne graph Separate spatial acceleration from the logical scene tree following the PBRT Primitive/Aggregate pattern. SceneNode is now pure logical grouping (transforms + hierarchy). Scene traversal and ray intersection are handled by SceneAccelerator, which flattens the tree into ScenePrimitives with world-space transforms. - Add ScenePrimitive (geometry + world transform), SceneAccelerator (abstract), LinearAccelerator (brute-force), BVHAccelerator (quiver AABB BVH) - Add intersect_primitive() free function for transform-aware ray-geometry tests - Strip SceneNode of bounding box and intersection logic - Add Object::geometry_ptr() and InternalSceneNode::children() accessors - Update Camera::render() to accept SceneAccelerator instead of SceneNode - Add test_accelerator.cpp with flattening, Linear vs BVH agreement, and transform hierarchy tests
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Implements a raycasting architecture for ART with two geometry backends and a PBRT-inspired scene accelerator:
Enriched core types + analytic primitives — Ray gains mutable
tMaxfor closest-hit pruning (PBRT-style). Intersection enriched with geometric normal, UV, tangent vectors, geometry pointer, and primitive index. New primitives: Plane, Disk, Cylinder, Triangle. Camera renders with normal-based coloring.Quiver mesh raycasting via BVH — New
MeshGeometryclass wrapsquiver::Mesh<2>with an AABB BVH for fast ray-triangle intersection. Bridges ART's rational/homogeneous types to quiver's double-precision spatial queries at the intersection boundary. Convenience factories for cube, tetrahedron, and single-triangle meshes.Scene accelerator refactor — Separates spatial acceleration from the logical scene tree following the PBRT Primitive/Aggregate pattern. SceneNode is now pure logical grouping (transforms + hierarchy). New
SceneAcceleratorabstract base withLinearAccelerator(brute-force ground truth) andBVHAccelerator(quiver AABB BVH over world-space bounding boxes).Changes
Phase 1: Core Type Enrichment
Ray: addedmutable Rational tMax(reset per-pixel, updated by intersect)Intersection:geometric_normal,uv(Vector2d),dpdu/dpdv,geometry*,primitive_indexzipper_types.hpp: addedVector2daliasSphere/Box: updated with spherical/face-local UV, tangent vectors, tMax semanticsSceneNode: transforms normals by inverse-transpose, tangent vectors by linear partCamera::render(): tMax reset per pixel, normal-based coloringPhase 2: New Analytic Primitives
Plane,Disk,Cylinder,Triangle— full intersection with UV, tangent vectors, tMaxPhase 3: Quiver Mesh Raycasting
MeshGeometry: quiver mesh + AABB BVH wrapper implementingGeometry::intersect()mesh_utils:make_mesh_geometry(),make_cube_mesh(),make_tetrahedron_mesh(),make_single_triangle_mesh()subprojects/quiver.wrapScene Accelerator Refactor
ScenePrimitive(flattened leaf: geometry + world transform),SceneAccelerator(abstract base),LinearAccelerator,BVHAcceleratorintersect_primitive()free function — shared helper for transform-aware ray-geometry intersectionSceneNodeof bounding box and intersection logic — now pure logical groupingObject::geometry_ptr()andInternalSceneNode::children()accessorsCamera::render()takesconst SceneAccelerator&instead ofSceneNode&Infrastructure
mdspan.wrap(standalone instead of broken wrap-redirect into zipper subproject)Test Results
All 79 test cases pass (77 passed, 2 skipped for optional EXR/PNG deps).
Dependencies
feature/image-and-iowithrefactor/meson-modernizemerged inmainbranch (fetched viasubprojects/quiver.wrap)