Skip to content

This project is an introduction to the beautiful world of Raytracing.

Notifications You must be signed in to change notification settings

KonstantinosLamprakis/42_miniRT

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

miniRT

Score: 125/100
Finished: 11.07.2024

miniRT

This project is an introduction to the beautiful world of Raytracing.

42 scene

Compiling

  • Use make to compile the project.
  • For higher resolution use make hd.

Running

  • Run the program with ./miniRT [scene.rt].
  • Example scenes are in the scenes directory.

Scenes

Every scene needs to have a .rt extension. A detailed Explanation of the object Configuration can be found here: Object Syntax

# simple example scene
A	0.5			255,255,255
L	-50,40,0	0.6				255,255,255
C	0,0,-10		0,0,1			70.0
sp	0,0,0		5				255,255,255

Supported Objects

  • Camera
  • Lights: Point, Ambient
  • Solids: Sphere, Plane, Triangle, Cylinder, Cone
  • Materials (for all Objects)
  • Textures:
    • Checkered (for all Objects)
    • UV Checkerboard (Spheres)
    • Image Textures (Spheres)
  • Bump Maps (Spheres)

Features

  • Multithreading (number of threads as optional paramter on the camera object)
  • Anti-Aliasing (number of samples as optional parameter on the camera object)
  • Shadows
  • Reflections
  • Full Phong Shading

Examples

Basic

spheres scene ice scene

Advanced

Checkerboard Texture

Left: Checkered using global coordinates, Right: Checkered using UV coordinates. Colors can be defined in the scene file.

TC checkered 255,255,255 0,0,0 1
TUC uvcheckered 0,0,0 255,255,255 40

checkered scene

Reflections

All objects can have a reflection value between 0 and 1. Also there is a maximum recursion depth for reflections that can be set as an optional parameter on the camera object.

reflection scene

Rendering Complex Objects using Triangles

Using the mini-rt-mesh-converter to convert .obj files to .rt files, you can render complex objects. Make sure your .obj file is triangulated.

triangle scene

Image Textures & Bump Maps

For spheres you can use image textures and bump maps. The bump map is a greyscale image that will be used to displace the normals of the sphere. The image texture is a regular image that will be mapped onto the sphere.

TF earth scenes/assets/earth.png
B bump scenes/assets/earth_bump.png

earth scene

Anti-Aliasing

Anti-Aliasing can be enabled by setting the number of samples on the camera object. The more samples, the smoother the edges. Left: No Anti-Aliasing, Right: Anti-Aliasing with 100 samples.

anti aliasing scene

Multiple Lights

You can have multiple lights in the scene. The color and intensity of the light can be set in the scene file.

multiple lights scene

Colored Lights

colored lights scene

About

This project is an introduction to the beautiful world of Raytracing.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C 96.2%
  • Makefile 3.8%