rt-go is a small path tracer written in Go. Scenes are described with JSON and can contain spheres, boxes, quads, triangles, OBJ meshes, matte/metal/glass/plastic materials, and emissive lights.
Rendering basics:
- CPU path tracing
- Antialiasing
- Gamma correction
- Cosine-weighted diffuse sampling
- Mixture PDFs for combining material and light sampling
- Direct light sampling
- Russian roulette path termination
- Configurable image size, samples, max depth, camera, and output path
- PPM image output with live scanline updates
Scene objects:
- Spheres
- Quads
- Boxes
- Triangles
- Triangle meshes
- OBJ model loading
- MTL material loading
- Smooth OBJ normals
Materials and lights:
- Lambertian matte materials
- Texture support: solid, checker, image, noise
- sRGB image texture loading with bilinear filtering
- Texture UV scale, offset, and rotation
- OBJ texture coordinates and MTL diffuse texture maps
- Metal materials
- Textured metal materials
- Dielectric glass materials
- Tinted glass materials
- Rough/frosted glass materials
- Glossy plastic materials
- Diffuse light materials
- One-sided emissive lights
- Weighted sampling targets
Transforms:
- Translation
- Rotation
Performance:
- Parallel scanline rendering
- BVH acceleration
Tools:
- JSON scene files
- Simple browser viewer
Place an OBJ model in:
models/figurine.obj
If the model has a material file, place it in the same folder and make sure the OBJ points to it with mtllib.
Render a JSON scene:
go run . -r examples/gallery.jsonThis writes:
image.ppm
Edit a JSON scene file to change the camera, render quality, objects, materials, and lights.
Other example scenes are in examples/.
See sceneGuide.md for a guide on how to design a scene.
For the browser viewer:
go run . -v examples/gallery.jsonThen open:
http://localhost:8080
Large OBJ files can take time to load because the renderer parses the mesh and builds a BVH before rendering.
Scenes are defined with JSON files in examples/.
Increase render.samples in a JSON scene file for a cleaner image. Higher sample counts reduce noise but take more time to render.

