Skip to content

Getting Started

This guide will help you run your first render in 5 minutes.

Requirements

ComponentVersion
CUDA Toolkit11.0+
C++ CompilerC++17 support
CMake3.18+
GPUCompute Capability 7.5+ (Turing+)

Installation

1. Clone the Repository

bash
git clone https://github.com/AICL-Lab/ray-tracer.git
cd ray-tracer

2. Build

bash
# Configure
cmake -S . -B build -DCMAKE_BUILD_TYPE=Release

# Compile
cmake --build build -j$(nproc)

3. Run

bash
# Blinn-Phong shading (fast preview)
./build/bin/ray_tracer -o output.ppm

# Path tracing (high quality)
./build/bin/ray_tracer --scene cornell -p -s 128 -o cornell.ppm

View Results

The output is in PPM format. Convert to PNG:

bash
# Using ImageMagick
convert output.ppm output.png

# Using Python
python -c "from PIL import Image; Image.open('output.ppm').save('output.png')"

Next Steps

Troubleshooting

CUDA Version Mismatch

Ensure CUDA Toolkit matches your GPU driver:

bash
nvcc --version
nvidia-smi

CUDA Not Found

Set the CUDA_PATH environment variable:

bash
export CUDA_PATH=/usr/local/cuda
export PATH=$CUDA_PATH/bin:$PATH

Out of Memory

Reduce resolution or sample count:

bash
./build/bin/ray_tracer -w 640 -h 480 -s 32 -o output.ppm

Technical Whitepaper · Built with VitePress