Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/Nuno-Jesus/42_miniRT
A small version of a Ray Tracer implemented in C
https://github.com/Nuno-Jesus/42_miniRT
42 42-minirt 42born2code 42cursus 42porto 42portugal 42projects 42school c-programming graphics-programming optimization raytracer raytracing
Last synced: about 2 months ago
JSON representation
A small version of a Ray Tracer implemented in C
- Host: GitHub
- URL: https://github.com/Nuno-Jesus/42_miniRT
- Owner: Nuno-Jesus
- Created: 2023-06-19T22:02:21.000Z (over 1 year ago)
- Default Branch: master
- Last Pushed: 2023-10-08T15:21:02.000Z (about 1 year ago)
- Last Synced: 2024-08-01T10:21:10.210Z (4 months ago)
- Topics: 42, 42-minirt, 42born2code, 42cursus, 42porto, 42portugal, 42projects, 42school, c-programming, graphics-programming, optimization, raytracer, raytracing
- Language: C
- Homepage:
- Size: 29.3 MB
- Stars: 4
- Watchers: 2
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
- 42-resources - 42_miniRT - Jesus` | (WELCOME / **Minirt**)
README
# **miniRT**
This project was graded 125/100.## đ **Authorship**
- [Mario Henriques](https://github.com/maricard18) ([**maricard**](https://profile.intra.42.fr/users/maricard))
- [Nuno Jesus](https://github.com/Nuno-Jesus) ([**ncarvalh**](https://profile.intra.42.fr/users/ncarvalh))## đ§Ŧ **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
```shell
git clone --recurse-submodules https://github.com/Nuno-Jesus/42_miniRT.git
```## đ **About**
Rendering a 3-dimensional image can be achieved using Ray Tracing, an expensive technique, which is based on casting rays from the camera into the space. If a ray intersects a shape, it illuminates it, based on both the shape's characteristics and also the environment around it as well.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.
https://github.com/Nuno-Jesus/42_miniRT/assets/93390807/7ef7cc40-ab9f-4611-bdaf-18cd1a157213
## đ¨ **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`.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` take advantage of parallel compilation to build the mandatory and bonus part, respectively.To launch the executable you should follow this syntax...
```sh
$ ./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.
> **Warning**
> On the macOS mlx version, the `mlx_destroy_display` function does not exist, which will cause a compilation error, unless you comment it (`world.c` and `world_bonus.c`)## đšī¸ **Controls**
Mandatory:
- **W** - increments the camera y coordinate
- **A** - decrements the camera x coordinate
- **S** - decrements the camera y coordinate
- **D** - increments the camera x coordinateBonus:
- **M** - toggles/untoggles the menu, which displays several other commands you can try## đ **Resources**
- [Ray Tracing primitives and their intersections](https://hugi.scene.org/online/hugi24/coding%20graphics%20chris%20dragan%20raytracing%20shapes.htm)
- [Ray Tracing books](https://raytracing.github.io)
- [Ray Tracing and global illumination](https://digitalcommons.unf.edu/cgi/viewcontent.cgi?article=1100&context=ojii_volumes)
- [Cornell University Ray Tracing slides](https://digitalcommons.unf.edu/cgi/viewcontent.cgi?article=1100&context=ojii_volumes)## đĢ **Testing**
This project was tested using self-made tests.
## đ **Contact me**
Feel free to ask me any questions through Slack (**ncarvalh**).