Giter Site home page Giter Site logo

saidm96 / minirt42 Goto Github PK

View Code? Open in Web Editor NEW
5.0 2.0 1.0 16.83 MB

This project is an introduction to the beautiful world of Raytracing. the miniRT is my first ray tracer coded in C, normed and humble but functionnal.

Makefile 1.69% C 73.70% Swift 16.88% Roff 7.74%
algorithms-and-data-structures clanguage mlx phong-model raytracing

minirt42's Introduction

miniRT

Project at 1337. A minimal raytracing engine wrote in C and MiniLibX.

Index

Description

Summary: This project is an introduction to the beautiful world of Raytracing. the miniRT is my first ray tracer coded in C, normed and humble but functionnal.

Raytracing

Ray tracing is a rendering technique that can produce incredibly realistic lighting effects. Essentially, an algorithm can trace the path of light, and then simulate the way that the light interacts with the virtual objects it ultimately hits in the computer-generated world.

Installation

  1. Clone the repo:
https://github.com/SaidM96/Minirt42.git
  1. cd into it and make bonus to compile it:
cd minirt && make bonus
  1. Now ./miniRT_bonus ./maps/aladin_room.rt

There are some scenes in the maps folder that showcase minirt.

Definitions

Ambient lighting: A {ratio} {color}

  • Ambient lighting ratio in range [0.0,1.0].
  • R,G,B colors in range [0-255].

Camera: C {position} {orientation} {FOV}

  • X,y,z coordinates of the view point.
  • A vector with the the x,y,z axis in the range [-1,1].
  • Horizontal field of view in degrees in range [0,180].

Light: L {position} {ratio} {color}

  • X,y,z coordinates of the light point.
  • The light brightness ratio in range [0.0,1.0].
  • R,G,B colors in range [0-255].

Sphere: sp {position} {diameter} {color}

  • X,y,z coordinates of the sphere center.
  • The sphere diameter.
  • R,G,B colors in range [0-255].

Plane: pl {position} {orientation} {color}

  • X,y,z coordinates.
  • A vector with the the x,y,z axis in the range [-1,1].
  • R,G,B colors in range [0-255].

Cylinder: cy {position} {orientation} {diameter} {height} {color}

  • X,y,z coordinates for the cylinder center.
  • A vector with the the x,y,z axis in the range [-1,1].
  • The cylinder diameter.
  • The cylinder height.
  • R,G,B colors in range [0-255].

Cone: {position} {orientation} {diameter} {height} {angle} {color}

  • X,y,z coordinates for the cone center.
  • A vector with the the x,y,z axis in the range [-1,1].
  • The cone diameter.
  • The cone height.
  • is the tangent of half angle of the cone
  • R,G,B colors in range [0-255].

Example maps/columns.rt file:

A 0.2      255,255,255

l     -12,7,-10      0.6      255,255,255
l      12,7,-10      0.6      255,255,255
l      0,7,-10      0.6      255,255,255

C     0,5,-14      0,0,1      70

sp      0,1,-1      1.2          125,25,25

cy      -5,0,-2      0,1,0      2.8     20        140,140,140

cy      -5,0,10      0,1,0      2.8     20         140,140,140

cy      5,0,-2      0,1,0      2.8      20         140,140,140

cy      5,0,10      0,1,0      2.8      20        140,140,140

sp      -5,0,10      4.2         140,140,140

sp      5,0,10      4.2                140,140,140

sp      -5,0,-2      4.2         140,140,140

sp      5,0,-2      4.2          140,140,140

sp      -5,10,10      4.2         140,140,140

sp      5,10,10      4.2         140,140,140

sp      -5,10,-2      4.2         140,140,140

sp      5,10,-2      4.2         140,140,140

pl      0,0,0      0,1,0            104,104,104      

pl      0,0,16      0,0,-1           25,25,178      

pl      0,10,0      0,-1,0            128,0,0

Images

scene image

scene1.rt image

scene8.rt image

scene2 image

scene2 image



Ressources

https://www.gabrielgambetta.com/computer-graphics-from-scratch/basic-ray-tracing.html
https://www.youtube.com/watch?v=1HYhrx9bzP8
https://computergraphicsguide.blogspot.com/2015/08/raycasting-and-phong-shading.html
https://www.youtube.com/playlist?list=PLAqGIYgEAxrUO6ODA0pnLkM2UOijerFPv
http://hugi.scene.org/online/hugi24/coding%20graphics%20chris%20dragan%20raytracing%20shapes.htm
https://www.youtube.com/watch?v=gGKup9tUSrU&ab_channel=CemYuksel
https://www.scratchapixel.com/lessons/3d-basic-rendering/introduction-to-ray-tracing
http://raytracerchallenge.com/

minirt42's People

Contributors

saidm96 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

medyth

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.