Skip to content

yingzhan11/42_miniRT

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

304 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

42_miniRT

Let's start this epic project!
This project is trying to create a ray tracing simulator by C.
The project grade is 125/100.

Recommend to run this project in Linux.

In WSL, most functions is ok, but the color presets of light and objects cannot be displayed normally, and reset function is wrong.

This may be because our color structure store int data, not double, and it causes precision loss in WSL. However, we found this problem too late, and as the color calculated in renderer is double type, so preset color is correct when running in Linux. So we didn't modify it.

Authorship

Demo

miniRT-video.mp4

Some result image

Basic objects
Reflection && Refraction
Texture && Checkboard
Metal material

Mandatory part

Here are some of the features Mandatory part handles:

  • Basic ray tracing by diffuse reflection;
  • Basic render color and shadow for plane, sphere and cylinder;
  • Bounding volume hierarchies by aabb box and BVH tree;
  • Clear, intuitive and powerful menu system;
  • Use "fake class"(fclass) to manage the objects;
  • Adaptive render for transform, scale and rotation objects in real-time and dynamic;

Bonus part

Here are some of the features Bonus part add:

  • Complete Phong Model(ambient + diffuse + specular);
  • Color disruption: checkerboard;
  • Colored and multi-spot lights;
  • One other 2nd degree object: Cone;
  • Smooth and bump texture;
  • Reflection and refraction with each object (our bonus);
  • Multiple thread render (our bonus);
  • Frame rate control (our bonus);
  • Multi-material overlay (our bonus);

Implementation

File Name Functionality
libft/ Contains standard libft project and some of the added tools function
mandatory/ Contains all the source files for the mandatory part
scenes/ Contains all the .rt files
textures/ Contains all the texture files
bonus/ Contains all the source files for the bonus part
bonus/src/bvh/ Generate and update aabb box and BVH tree
bonus/src/color/ Contain all calculations and logics for color, checkboard and texture
bonus/src/debug/ Test program
bonus/src/entities/ Objects management
bonus/src/fclass/ Generate and manage the "fake class"
bonus/src/hook/ Menu system operate management
bonus/src/init/ Initialize data
bonus/src/intersection/ Handle intersection for different shapes
bonus/src/menu/ Menu system design management
bonus/src/parser/ Preprocess the source data
bonus/src/renderer/ Core rendering part
bonus/src/tools/ All of tools functions
bonus/src/uv/ UV coordinate calculation
bonus/src/vector/ Vector calculation

Compilation

Mandatory

To compile this project you should run make in the terminal.
To run the program needs to follow this:

$ ./miniRT scenes/scene_name 

For example: ./miniRT scenes/example.rt

Bonus

To compile this project you should run make bonus in the terminal.
To run the program needs to follow this:

$ ./miniRT scenes/bonus/scene_name 

For example: ./miniRT scenes/bonus/example.rt

Some tips

About

Let's start this epic project!

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages

  • C 98.6%
  • Makefile 1.4%