Skip to content

ipersids/ray-tracing

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

48 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

MiniRT Unit Tests

MiniRT

Example of simple scene.

Introduction

MiniRT is a rendering program that uses ray tracing technology to create realistic images with a given configuration.

Table of Contents

Features

  • Scene description parsed from .rt files.
  • Custom math, matrix and vector utilities.
  • Real-time rendering with MLX42 graphical library.
  • Simple ray tracer supporting spheres, planes, cylinders, and cones.
  • Point and ambient lighting with basic shading.
  • Camera with field of view and orientation control.
  • Shading, shadows and patterns.
  • Reflection.
  • Refraction.
  • Sphere texture and bump mapping.
  • Different materials support.

Controls

Action Key / Mouse Description
Move camera W / A / S / D Move camera forward, left, back, right
Rotate camera Left Mouse Drag Rotate camera view
Reset camera R Reset camera to default position/orientation
Zoom camera Mouse Scroll Zoom in/out (FOV)
Select & manipulate object Right Mouse Button Select object under cursor for manipulation
Move selected object Right Mouse Drag Move object in screen plane
Move selected object (depth) Ctrl + Right Mouse Drag Move object along view direction
Rotate selected object W / A / S / D (object selected) Rotate object (pitch/yaw)
Scale selected object + / - (object selected) Scale object up/down
Exit ESC Exit program

Project structure

ray-tracing/
│
├── include/                   # Header files
│   ├── minirt_data.h
│   ├── minirt_math.h
│   ├── minirt_parser.h
│   ├── minirt_renderer.h
│   └── minirt.h
│
├── lib/                       # Libraries
│   ├── libft/...              # Submodule libft
│   └── mlx42/...              # Submodule MLX42
│
├── scene/                     # Scene config files
│   ├── bonus/*.rt
│   └── mandatory/*.rt
│
├── src/                       # Source files
│   ├── calculations/          # Custom math library
│   │   ├── *.c
│   │   ├── matrices/...
│   │   └── vectors/...
│   ├── constructor/           # Initialize structures and allocate memory
│   ├── destructor/            # Free resources and handle errors
│   ├── hook/                  # Handle user input and rendering loop
│   ├── materials/             # Set up different materials and patterns
│   ├── parser/                # Parse config file '.rt' (../scene/)
│   ├── renderer/              # Handle lighting, reflections, refractions, and rays
│   ├── shapes/                # Object-related calculations
│   ├── texture-mapping/       # Apply texture and bump map to objects
│   ├── transformation/        # Calculate matrix transformations
│   └── main.c                 # Start here
│
├── LICENSE
├── Makefile                   # Project build tool
└── README.md

Installation

  1. Clone the repository and build the project using the provided Makefile:
git clone https://github.com/ipersids/ray-tracing.git
cd ray-tracing
make bonus
  1. Run the ray tracer with the path to the config file:
./miniRT_bonus scene/bonus/solar-system.rt

Other commands:
* make clean will remove all .o' files.
* make fclean will remove all .o' and executable files.
* make re will trigger the fclean command and rebuild the program.
* make will compile lite version of project

Linker dependencies:

Flag Library Purpose
-ldl libdl Dynamic linking support
-lglfw GLFW OpenGL window/context/input handling
-lm libm C math library
-lmlx42 MLX42 Cross-platform, minimal windowing graphics library
-lft libft Own customized version of the standard C library

About

Realistic image rendering with ray tracing technique

Topics

Resources

License

Stars

Watchers

Forks

Contributors 2

  •  
  •