Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

155 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

MiniRayTracer(miniRT)

miniRT is a simplified 3D raytracer project from the 42 curriculum. The program reads a scene description from a file, parses objects, lights, and camera information, and renders a 3D image using ray tracing. It supports spheres, planes, cylinders, lights, shadows, reflections, and basic camera controls.

Features

  • Scene parsing with validation for objects, lights, and camera
  • Ray tracing with shadows and lighting
  • Support for spheres, planes, and cylinders
  • Simple rendering with MiniLibX
  • Keyboard controls for camera movement and window updates
  • Memory-safe and robust against invalid input

Program Rules

  • Scene files must define at least one camera, one light, and one object
  • Only valid coordinates, directions, and colors are accepted
  • The program opens a window and renders the scene in real time
  • Actions and updates are handled via keyboard input

Build & Run

  1. Navigate to the project directory:
git clone https://github.com/Yuxin29/MiniRayTracer.git miniRT
cd miniRT
  1. Compile using the provided Makefile:
make    #Generates the executable miniRT

Available make commands:

make clean   # Remove object files
make fclean  # Remove object files and executable
make re      # Recompile everything from scratch
  1. Running the Program
./miniRT [scene.rt]
Example:
./miniRT scenes/test_scene.rt    # This reads the scene description and opens a window rendering the 3D scene.

Scene File Format (.rt)

  • Contains definitions for:
    • Camera: C x,y,z dirX,dirY,dirZ fov
    • Light: L x,y,z brightness r,g,b
    • Sphere: sp x,y,z diameter r,g,b
    • Plane: pl x,y,z normalX,normalY,normalZ r,g,b
    • Cylinder: cy x,y,z dirX,dirY,dirZ diameter height r,g,b
  • All coordinates, directions, and colors must be valid numbers.
  • The program will ignore malformed lines and print errors if necessary.

About

A small ray tracing program written in C that renders simple 3D scenes with basic lighting and shading models. The project focuses on core graphics programming concepts such as ray–object intersections, vector mathematics, color computation, and camera geometry.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages