How c3viche/skewer works
Project type and purpose
• This is Skewer, a native C++ physically‐based ray tracer library with three executable entry points:
• A command‐line renderer (apps/cli)
• A placeholder GUI renderer (apps/gui)
• A worker for distributed or batch rendering (apps/worker)
• Its purpose is to load scenes (meshes, materials), build acceleration structures, perform deep and layered path‐traced rendering, composite layers, and write image files.
File structure and architectural patterns
• Top-level “apps” directory holds each executable’s main.cc.
• “src” is organized by module:
• core – fundamental types (Vec3, Ray, Spectrum, RNG)
• io – file formats (PPM, OBJ via tiny_obj_loader, stb_image)
• scene – scene construction and camera
• materials – BSDF definitions, textures
• geometry – primitives, intersection tests
• accelerators – BVH spatial hierarchy
• integrators – rendering strategies (path tracing, normal visualization)
• film – image buffer and compositing
• session – orchestration: options, multi-threaded render loop
• compositor – deep‐data compositing (folders stubbed)
• Build is driven by CMake; external libraries are included via “external” or fetched (nlohmann/json).
Extracted runtime flow from README and code
• CLI app parses flags (–name, –help)
• Calls into RenderSession to load scene and options
• RenderSession builds BVH via the accelerator module
• For each pixel: integrator traces rays; on each hit, queries material.scatter, core RNG, geometry.intersect
• Samples accumulate in film/image_buffer
• Final film is written via io/image_io
Components
• CLI Frontend (apps/cli)
• RenderSession Manager (src/session)
• Scene Loader (src/io + src/scene)
• Accelerator (BVH builder/query)
• Geometry & Materials (src/geometry + src/materials)
• Integrator (path_trace, normals)
• Film & Compositor (src/film + src/compositor)
• I/O Layer (image_io, obj_loader)
• External Libraries (stb_image, tiny_obj_loader, nlohmann/json)
• (Optional) Worker & GUI frontends
b. Relationships / data flow:
1. CLI → RenderSession: pass RenderOptions
2. RenderSession → Scene Loader & Accelerator: load geometry, build BVH
3. RenderSession → Integrator: drive render loop
4. Integrator ↔ Accelerator/Geometry: ray intersection queries
5. Integrator ↔ Materials: shading
6. Integrator → Film Buffer: write samples
7. After all pixels: RenderSession → Compositor (for deep layers)
8. Compositor → I/O Layer: write final image (PPM/PNG)
c. Architectural patterns:
• Layered architecture: CLI → Session → Core modules → I/O
• Modular service boundaries per responsibility
• Data‐oriented flow: scene data → BVH → ray loops → buffer
d. Key technologies & frameworks:
• CMake for build orchestration
• std::thread or custom threading in session (inferred)
• stb_image(.h), tiny_obj_loader(.h) for asset I/O
• nlohmann/json for scene metadata (optional)