https://github.com/ab-gh/rtsim
ray tracing simulation
https://github.com/ab-gh/rtsim
cpp raytracing renderer
Last synced: over 1 year ago
JSON representation
ray tracing simulation
- Host: GitHub
- URL: https://github.com/ab-gh/rtsim
- Owner: ab-gh
- Created: 2021-11-23T13:20:21.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2021-12-13T21:04:07.000Z (over 4 years ago)
- Last Synced: 2025-03-06T08:37:45.562Z (over 1 year ago)
- Topics: cpp, raytracing, renderer
- Language: C++
- Homepage:
- Size: 4.34 MB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# rtsim
C++ implementation of a ray tracing simulator
```cpp
// Initialise a scene and camera
Camera cam;
Scene scn;
// Add a floor
scn.addObject(new InfinitePlane(Vector(0, -2, 0), Vector(0, 1, 0), RGB(0.1, 0.1, 0.6), 0));
// Add some objects on the floor
scn.addObject(new Sphere(Vector(-1, -1, -4), 1, RGB(1, 0, 0), 0.2));
scn.addObject(new Sphere(Vector(0, -1.8, -3.9), 0.2, RGB(0, 1, 0), 0));
scn.addObject(new Cone(Vector(1, 0.5, -5.3), Vector(1, -2, -5.3), 1.3, RGB(0.3, 0.5, 0.7), 0.7));
// Add some background walls
scn.addObject(new InfinitePlane(Vector(-6, -6, -6), Vector(1.5, 0, 1), RGB(0.6, 0.6, 0.6), 0.1));
scn.addObject(new InfinitePlane(Vector(-10, -10, -10), Vector(0, 0, 1), RGB(0.6, 0.6, 0.6), 0.1));
// Add some walls behind the camera
scn.addObject(new InfinitePlane(Vector(25, 25, 25), Vector(-1.5, 0, - 1), RGB(0.3, 0.3, 0.3), 0));
scn.addObject(new InfinitePlane(Vector(25, 25, 25), Vector(0, 0, -1), RGB(0.3, 0.3, 0.3), 0));
// Add a shiny disk under the objects
scn.addObject(new Disc(Vector(0, -1.99, -4.5), Vector(0, 1, 0), 2.4, RGB(0.7, 0.7, 0.7), 0.1));
// Add a front and key light
scn.addSource(new Source(Vector(-1, 5, -2.5), 0.8));
scn.addSource(new Source(Vector(0, 0, 1), 0.01));
// Render the scene with a maximum reflection depth of 2
render(cam, scn, 2);
return 0;
```

## Features
- Objects
- Spheres
- Cones
- Infinite Planes
- Discs
- Materials
- Colour
- Reflectivity
- Light sources
- Point light
- Scene illumination types
- Ambient (constant)
- Diffuse
- Specular
- Reflection
## Roadmap
- [ ] More objects
- [ ] Cylinders
- [ ] Cuboids
- [ ] Triangles for meshing
- [ ] Shape file import
- [ ] Rendering
- [ ] Specify file name
- [ ] Scene file import
- [ ] Free camera
- [ ] DoF and focal distance
- [ ] Anti-aliasing/supersampling
- [ ] Materials
- [ ] Shadows
- [ ] Refraction
- [ ] Transparent/translucent
- [ ] Emissive objects (volume lights)