Skip to content

quinn-sasha/miniRT

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

242 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Simple Raytracing Engine

Simple Raytracing Engine is a minimalist 3D renderer written in C. It utilizes the ray-tracing algorithm to simulate the physical behavior of light, rendering realistic images with shadows, reflections, and lighting effects. This project is built using the MiniLibX graphical library.

🌟 Features

  • Primitive Objects:
    • Spheres: Perfect geometric spheres with adjustable radius.
    • Planes: Infinite surfaces for floors, walls, or ceilings.
    • Cylinders: Finite cylinders with configurable diameter and height.
  • Lighting Model:
    • Ambient Lighting: Global illumination to ensure objects are visible even in shadow.
    • Diffuse & Specular: Implementation of the Phong reflection model for realistic surface highlights.
    • Hard Shadows: Accurate shadow casting based on light source visibility.
  • Camera System: Fully adjustable camera with position, orientation, and Field of View (FOV) control.
  • Scene Description: Flexible scene configuration using .rt files.

📋 Prerequisites

To compile and run this engine, you will need:

  • Operating System: macOS or Linux.
  • Compiler: gcc or clang.
  • Libraries: MiniLibX (included) and its dependencies (X11 and associated headers).

🚀 Getting Started

Installation

  1. Clone the repository:
   git clone <your-repo-url>
   cd miniRT
  1. Compile the project:
make

This will produce an executable named simple_rt (or your configured output name).

Running the Engine Pass a scene configuration file as an argument:

Running the Engine

Pass a scene configuration file as an argument:

./simple_rt world/example.rt

Example .rt File

A 0.2 255,255,255
C -50,0,20 0,0,1 70
L -40,0,30 0.7 255,255,255
sp 0,0,20 20 255,0,0
pl 0,0,0 0,1.0,0 200,200,

🎮 Controls

  • ESC: Close the window and exit the application.
  • window Close (X): Exit the application gracefully.

📂 Project Structure

  • src/: Core logic including ray-object intersection and color calculation.
  • include/: Header files for all modules.
  • libft/: Custom utility library for string and memory management.
  • world/: Sample scene files to showcase the engine's capabilities.

📜 License

This project is developed for educational purposes. The MiniLibX library is subject to its own licensing terms.

About

Simple raytracing program

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors