Skip to content

feat: add triangle mesh ray tracing + terminal viewer tool#9

Open
mtao wants to merge 2 commits into
mainfrom
feature/triangle-mesh-term
Open

feat: add triangle mesh ray tracing + terminal viewer tool#9
mtao wants to merge 2 commits into
mainfrom
feature/triangle-mesh-term

Conversation

@mtao
Copy link
Copy Markdown
Owner

@mtao mtao commented Apr 10, 2026

Summary

  • Add Image class (PBRT Film-style pixel buffer with sample accumulation, tone mapping, progress tracking)
  • Add Image I/O layer (PPM always, EXR/PNG optional via -Dexr=true/-Dpng=true)
  • Add TriangleMesh geometry with Moller-Trumbore intersection
  • Add art_term CLI tool: loads mesh via quiver, ray-traces with auto-framed camera, outputs to terminal

Dependencies

  • quiver is now a required dependency (mesh I/O and topology)
  • balsa is an optional dependency gated behind -Dviewer=true (terminal output)
  • Depends on: balsa PR #10 for balsa::terminal::emit_auto()

Build

# Core library only (no terminal viewer)
meson setup build-debug --buildtype=debug -Dtesting=false
meson compile -C build-debug

# With terminal viewer tool
meson setup build-debug --buildtype=debug -Dviewer=true
meson compile -C build-debug

# Usage
./build-debug/tools/art_term model.obj [width] [height]

Fixes included

  • Fixed zipper/transform/transform.hpp -> zipper/transform/all.hpp (renamed upstream)
  • Fixed spdlog/fmt define conflict by building spdlog as static
  • exr.cpp/png.cpp always compiled with stub fallbacks when optional deps are absent

Known limitations

  • Linear-scan intersection (no BVH) — slow for large meshes (>1000 triangles at high resolution)
  • Camera FOV is hardcoded (~53 degrees)
  • No materials, lights, or color — headlight diffuse shading only

mtao added 2 commits April 10, 2026 17:47
Major additions:
- Image class: PBRT Film-style pixel buffer with sample accumulation,
  tone mapping (to_rgba8), progress tracking, dirty notification
- Image I/O: PPM (always), EXR (optional -Dexr=true), PNG (-Dpng=true)
  with stub fallbacks when optional deps are disabled
- TriangleMesh geometry: Moller-Trumbore intersection, precomputed face
  normals, AABB bounding box (linear scan, no BVH yet)
- Camera headlight shading: abs(N.dot(view_dir)) diffuse look
- art_term CLI tool: loads mesh via quiver, ray-traces with auto-framed
  camera, outputs to terminal via balsa::terminal (Kitty/half-block)

Build system changes:
- quiver is now a required dependency (mesh I/O and topology)
- balsa is an optional dependency gated behind -Dviewer=true
- Fixed zipper transform umbrella header include (transform.hpp -> all.hpp)
- Fixed spdlog/fmt define conflict by building spdlog as static
- exr.cpp/png.cpp always compiled (stubs when deps absent)
Meson creates wrap-redirect files in subprojects/ when resolving
transitive dependencies (quiver->fmt/mshio/sol2/lua, balsa->eigen/
cli11/nlohmann_json, zipper->mdspan). These are build artifacts
that should not be committed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant