How raumgears/rtz01 works
This is a CPU ray tracer: the program builds a scene and camera, samples camera rays in parallel, recursively traces hits and material scattering, then gamma-corrects and writes PPM pixels. The graph preserves the documented primitive and material families as well as the rendering stages. Source excerpts show the main render calls and several implementations; some scene-dispatch relationships are documented but not visible in sampled implementation code.
Main entry points: main.rs Render orchestration · hittable_list.rs Hittable world · material.rs Material contract · cylinder.rs Cylinders
Components 21
Rendering
- Render orchestration
rt/src/main.rs - Perspective camera
rt/src/camera.rs - PPM image
Scene geometry
- Hittable world
rt/src/volumes/hittable_list.rs - Spheres
rt/src/volumes/sphere.rs - Planes
rt/src/volumes/plane.rs - Disk surfaces
rt/src/volumes/subplane_d.rs - Square surfaces
rt/src/volumes/subplane_s.rs - Cubes
rt/src/volumes/cube.rs - Cylinders
rt/src/volumes/cylinder.rs - Cylinder tube
rt/src/volumes/cylinder_t.rs
Materials and traits
- Hit records
rt/src/traits/hittable.rs - Material contract
rt/src/traits/material.rs - Lambertian
rt/src/materials/lambertian.rs - Metal
rt/src/materials/metal.rs - Dielectric
rt/src/materials/dielectric.rs - Diffuse light
rt/src/materials/light.rs
Math and output
- Vector math
rt/src/basics/vec3.rs - Color encoding
rt/src/basics/color.rs - Sampling utilities
rt/src/utils.rs
Other components
- Image consumer
Connections 31
- Image consumer → Render orchestration: runs
README.md - Render orchestration → Perspective camera: requests rays
rt/src/main.rs - Render orchestration → Hittable world: traces hits
rt/src/main.rs - Render orchestration → Planes: constructs
rt/src/main.rs - Render orchestration → Spheres: constructs
rt/src/main.rs - Render orchestration → Cubes: constructs
rt/src/main.rs - Render orchestration → Cylinders: constructs
rt/src/main.rs - Render orchestration → Lambertian: creates
rt/src/main.rs - Render orchestration → Metal: creates
rt/src/main.rs - Render orchestration → Dielectric: creates
rt/src/main.rs - Render orchestration → Diffuse light: creates
rt/src/main.rs - Render orchestration → Color encoding: writes pixels
rt/src/main.rs - Render orchestration → Sampling utilities: samples rays
rt/src/main.rs - Hittable world → Hit records: implements
- Hittable world → Spheres: dispatches hits
- Hittable world → Planes: dispatches hits
- Hittable world → Disk surfaces: dispatches hits
- Hittable world → Square surfaces: dispatches hits
- Hittable world → Cubes: dispatches hits
- Hittable world → Cylinders: dispatches hits
- Cylinders → Cylinder tube: composes
README.md - Hit records → Material contract: stores material
rt/src/traits/hittable.rs - Render orchestration → Material contract: scatters hits
rt/src/main.rs - Lambertian → Material contract: implements
rt/src/materials/lambertian.rs - Metal → Material contract: implements
rt/src/materials/metal.rs - Dielectric → Material contract: implements
rt/src/materials/dielectric.rs - Diffuse light → Material contract: implements
rt/src/materials/light.rs - Render orchestration → Vector math: uses
rt/src/main.rs - Vector math → Sampling utilities: samples vectors
rt/src/basics/vec3.rs - Color encoding → Vector math: uses
rt/src/basics/color.rs - Render orchestration → PPM image: emits PPM
rt/src/main.rs