Thanks to visit codestin.com
Credit goes to github.com

Skip to content

xmarano/RayTracer

Repository files navigation

Raytracer

unitest criterion

🌟 Overview

The RayTracer is a 3D rendering engine that simulates the physical behavior of light to create photorealistic images. This project implements the ray tracing algorithm to generate renders of 3D scenes with complex visual effects.

Render Animation

🔗 Resources

✨ Features

  • High-fidelity Rendering

    • Physically accurate calculation of shadows, reflections, and refractions
    • Anti-aliasing for sharper images
    • Support for different output formats
  • Geometric Primitives

    • Spheres, planes, cones, cylinders, and triangles
    • Precise positioning and rotation of objects
    • Extensible system for adding new shapes
  • Advanced Lighting System

    • Ambient light for global illumination
    • Directional lights simulating the sun
    • Point lights for localized sources
    • Soft and hard shadows
  • Customizable Materials

    • Color and texture properties
    • Ambient, diffuse, and specular coefficients
    • Configurable reflection and transparency
  • Modular Architecture

    • Plugin system to extend functionality
    • Clear and documented programming interface
    • Easy addition of new materials and primitives

🛠️ Installation

Prerequisites

macOS

brew install imagemagick

Linux

sudo apt update
sudo apt install -y build-essential libsfml-dev libconfig++-dev imagemagick

Compilation

make

🚀 Usage

Rendering a Scene

./raytracer scenes/demo.cfg

Creating Animations

python3.10 create_animation.py [--shpere] [--cone] [--cylinder]

📋 Configuration File Format

The RayTracer uses .cfg files to define scenes to render. Here is a simplified example:

camera : {
    resolution = { width = 0; height = 0; };
    position   = { x = 0; y = 0; z = 0; };
    rotation   = { x = 0; y = 0; z = 0; };
    fieldOfView = 90.0;
};

primitives : {
    spheres = ();
    cylinders = ();
    cones = ();
    triangles = ();
    planes = ();
};

lights : {
    ambient = 0.0;
    diffuse = 0.0;
    point = ();
    directional = ();
};

🖼️ Available Scenes

The project includes several predefined scenes that you can use to test the RayTracer:

  • scenes/easy.cfg: Simple scene for beginners
  • scenes/test.cfg: Test scene with multiple primitives
  • scenes/demo.cfg: Demonstration of the engine's capabilities
  • scenes/artistic.cfg: Artistic composition
  • scenes/space.cfg: Space scene

🔌 Web Platform

The project also includes a web interface for testing the RayTracer online:

cd web
python app.py

Or visit directly https://raytracer.tektests.ovh

📁 Project Structure

├── include/         # Headers and interfaces
├── src/             # Engine source code
├── plugins/         # Extensible primitives and materials
├── scenes/          # Scene configuration files
├── screenshots/     # Render screenshots
├── docs/            # Documentation generated by Doxygen
└── web/             # Web interface for testing the RayTracer

👨‍💻 Extending the RayTracer

To add new primitives or materials, implement the IPrimitive or IMaterial interfaces and place your plugins in the plugins/ folder.

Project made by Epitech students. Here is a list of the contributors:

About

Multithreaded C++ RayTracer with real-time SFML visualization

Topics

Resources

Stars

Watchers

Forks

Contributors 4

  •  
  •  
  •  
  •