https://github.com/anirban166/rtx4269
Recursive Raycaster
https://github.com/anirban166/rtx4269
Last synced: 7 months ago
JSON representation
Recursive Raycaster
- Host: GitHub
- URL: https://github.com/anirban166/rtx4269
- Owner: Anirban166
- Created: 2022-09-02T01:25:41.000Z (about 3 years ago)
- Default Branch: main
- Last Pushed: 2022-12-03T20:28:32.000Z (almost 3 years ago)
- Last Synced: 2025-01-24T18:09:38.460Z (9 months ago)
- Language: C
- Homepage:
- Size: 12.7 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: Readme.md
Awesome Lists containing this project
README
Build the executable using `make` and run using:
```c
./raytrace [ImageWidth] [ImageHeight] [InputSceneName] [OutputFileName].ppm
```| Raytracing | Illumination | Raycasting |
|:--- | :--- | :--- |
|  |  |  |
| A sphere and a plane with reflection on both objects | Illuminating a sphere and a plane with a point light | Basic render of a sphere and plane |
|  |  |  |
| Three spheres and a plane with reflection for the sphere objects | Illuminating a cylinder along the y-axis with a point light | A lemon (the quadric is an ellipsoid along the y-axis) |
|  |  |  |
| Three spheres and a plane with reflection for the two spheres behind and refraction for the one in front | Illuminating a sphere and a plane with a spot light | Rendering two spheres, a plane, and a cone along the y-axis |Scene files used to render the above:
- Raytracing
```c
camera, width: 2.0, height: 2.0
sphere, radius: 2.0, diffuse_color: [1, 0, 0], specular_color: [1, 1, 1], position: [0, 1, -5], reflectivity: 0.85
plane, radius: 2.0, normal: [0, 1, 0], diffuse_color: [0, 1, 0], position: [0, -1, 0], reflectivity: 0.15
light, color: [4, 4, 4], theta: 0, radial-a2: 0.125, radial-a1: 0.125, radial-a0: 0.125, position: [1, 3, -1]camera, width: 2.0, height: 2.0
sphere, radius: 2.0, diffuse_color: [1, 0, 0], specular_color: [1, 1, 1], position: [-3, 1, -5], reflectivity: 0.55
sphere, radius: 2.0, diffuse_color: [0, 1, 0], specular_color: [1, 1, 1], position: [0, 1, -12], reflectivity: 0.15
sphere, radius: 2.0, diffuse_color: [0, 0, 1], specular_color: [1, 1, 1], position: [3, 1, -7], reflectivity: 0.15
plane, normal: [0, 1, 0], diffuse_color: [0.3, 0.3, 0.3], position: [0, -1, 0], reflectivity: 0.0
light, color: [4, 4, 4], radial-a2: 0.01, radial-a1: 0.0125, radial-a0: 0.0125, position: [10, 10, -5]camera, width: 2.0, height: 2.0
sphere, radius: 1.5, diffuse_color: [0, 0, 0], specular_color: [1, 1, 1], position: [0, 0, -3], refractivity: 0.8, reflectivity: 0.0, ior: 2.0
sphere, radius: 2.0, diffuse_color: [0, 1, 0], specular_color: [1, 1, 1], position: [0, 1, -12], reflectivity: 0.15
sphere, radius: 2.0, diffuse_color: [0, 0, 1], specular_color: [1, 1, 1], position: [3, 1, -7], reflectivity: 0.15
plane, normal: [0, 1, 0], diffuse_color: [0.3, 0.3, 0.3], position: [0, -1, 0], reflectivity: 0.0
light, color: [8, 8, 8], radial-a2: 0.01, radial-a1: 0.0125, radial-a0: 0.0125, position: [10, 10, -5]
```
- Illumination
```c
camera, width: 2.0, height: 2.0
plane, normal: [0, 1, 0], diffuse_color: [0, 1, 0], specular_color: [0, 0, 1], position: [0, -1, 0]
sphere, radius: 2.0, diffuse_color: [1, 0, 0], specular_color: [1, 1, 1], position: [0, 1, -5]
light, color: [2, 2, 2], theta: 0, radial-a2: 0.125, radial-a1: 0.125, radial-a0: 0.125, position: [1, 3, -1]camera, width: 3.0, height: 3.0
quadric, diffuse_color: [0.25, 0.25, 0.05], specular_color: [1, 1, 1], position: [0, 0, -2], constants: [1.0, 0, 1.0, 1.0, 0.0, 1.0, 0.0, 0.0, 8.0, 0.5]
plane, normal: [0, 1, 0], diffuse_color: [0.05, 0.25, 0.25], specular_color: [1, 1, 1], position: [0, -1, 0]
light, color: [10, 10, 10], theta: 0, radial-a2: 0.125, radial-a1: 0.125, radial-a0: 0.125, position: [0, 0, 0]camera, width: 2.0, height: 2.0
plane, normal: [0, 1, 0], diffuse_color: [0.3, 0, 0.8], specular_color: [0, 1, 1], position: [0, -1, 0]
sphere, radius: 0.5, diffuse_color: [0, 0.5, 0.3], specular_color: [1, 1, 1], position: [-0.2, -0.5, -1.5]
light, color: [10, 10, 10], theta: 20, direction: [0, -1, -5], radial-a2: 1.125, radial-a1: 1.125, radial-a0: 1.125, position: -2, 0, -1]
```
- Raycasting
```c
camera, width: 2.0, height: 2.0
sphere, color: [0.8, 0.8, 0.0], position: [0.0, 1.0, -5.0], radius: 2.0
plane, color: [0.3, 0.3, 0.3], position: [0.0, -2.0, 0.0], normal: [0.0, 1.0, 0.0]camera, width: 5.0, height: 5.0
sphere, color: [1.0, 1.0, 0.0], position: [-1.0, -3.0, -4.0], radius: 2
quadric, color: [0.0, 1.0, 0.0], position: [1.8, -1.9, -5.0], constants: [2.0, 6.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, -1.0]
quadric, color: [0.8, 0.3, 0.3], position: [0.5, -1.5, -4.0], constants: [4.0, 1.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, -0.15]camera, width: 2, height: 2
quadric, color: [0.3, 0.6, 0.5], position: [0.0, 0.0, -4.0], constants: [1.0, -1.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.5]
plane, color: [0.6, 0.9, 0.6], position: [0.0, -4.0, 5.0], normal: [0.0, 2.0, 0.0]
sphere, color: [0.0, 0.5, 0.7], position: [0.0, 0.0, -5.0], radius: 0.5
```