Skip to content

Nuno-Jesus/42_miniRT

Β 
Β 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

285 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

miniRT

This project was graded 125/100.

πŸ“ Authorship

🧬 Cloning

This repository uses a git submodule, a git repo nested in this one (the libnc folder). By default, cloning this repo will ignore the submodule, which comes out as an empty folder. To successfully clone both, use this command

git clone --recurse-submodules https://github.com/Nuno-Jesus/42_miniRT.git 

πŸ“’ About

Rendering a 3-dimensional images can be done using Ray Tracing, an expensive technique, which is based on casting rays from the camera into the space and illuminate shapes.

This isn't an advanced Ray Tracer, since it's implemented in C, but it definitely is functional and has a bit of our own bonus in it too!

Mandatory Part

Images

The mandatory part features:

- Map file parser
- Ambient and diffuse lighting
- Display of planes, spheres and cylinders
- Shapes intersections
- Hard shadows
- Ray tracing (without recursive steps)

Bonus Part

Images

The bonus part features the mandatory and also the following:

- Phong Illumination Model (ambient + diffuse + specular)
- Checkerboarded planes
- Multi-spot lights
- Colored light sources
- Multithreaded rendering (our bonus)
- Interectable menu (our bonus)

πŸŽ₯ Demo

Here's a small demo with one of our maps.

🚨 Disclaimer

At 42, the C projects are built following a bunch of rules that enforce good coding style, stated in a file called Norminette. Some of them are:

- No for, do while, switch, case or goto are allowed
- No more than 25 lines per function and 5 functions per file
- No assigns and declarations in the same line (unless static)
- No more than 5 local functions in 1 function
- No more than 4 parameters in 1 function
... 

πŸ“¦ Compilation

To compile the mandatory part of the ray tracer you should run make in the terminal.

This rule will generate a miniRT file, which is the zipped version of all the object files. Running make bonus will compile the bonus part of the ray tracer.

Note The rules make fast and make bfast use threads to compile WAAAY faster the mandatory and bonus parts, respectively.

To launch the executable you should follow this syntax...

$ ./miniRT scene_name

Where scene_name is the name of a file that represents the world map. The scene must have a .rt extension. You can find example scenes in the scenes folder.

πŸ’« Testing

This project was tested using self-made tests.

πŸ“ž Contact me

Feel free to ask me any questions through Slack (ncarvalh).