Sphere Full (1000x562) | Sphere + Pyramid Full (1000x562) |
---|---|
best.mp4
Still trying to learn Rust and thought this would be a great way to crate (pun intended) stuff using Rust but also learn a bit more about graphics programming. Good portion of the work learned from the classic Raytracing In A Weekend article.
Currently, it works pretty well, as you can see from the above photo. We have our Spheres with both diffuse and metallic material, as well as the shadows underneath each. I have implemented the Triangle class and in a couple of the animations below I have shown them being rotated around, however I want to also apply those materials to the triangle to see how it turns out.
On the interlaced_multithreading branch, it increases the speed by a ton. Changed from mpsc
to crossbeam
channels
because it allows for multiple receivers (issue with mpsc). This enabled my program to use all 3 threads.
Outside libs: File, Write, Rand, Crossbeam,
- Use BufWriter in Rust to write to .ppm file as it seems the best way to do it evidence.
- Test current multithreading branch vs. Method where 3 threads interlace through the scanlines (non-chunks) ==> Make a Job Queue and have threads read off this channel to do work maybe? ✔️ Improves time by 2x
- Implement some degree of SIMD (here) and Intel Intrinsics.
- Reduce number of FLOPs (precompute some stuff for intersections).
Support for basic vector implementations, including dot product, cross product, rotations (just used for camera animations). Additionally, I didn't feel like making Vectors any different than Points (could've done homegenous coordinates), but they were practically the same so for example, when defining rays, the origin of the ray is a Vec3 and the direction is also a Vec3.
I also provide a basic ray implementation, of course used in raytracing. At current moment of development, it is able to shoot rays out and render objects in our scene. As stated above, created from the Vec3 struct.
Supports camera animation and rendering.
output6.mp4
output4.mp4
For both above, the camera rotates around the sphere. There's not that many objects nor has the best lighting to provide an explicit perspective. But it is rotating around the sphere.
- Spheres
- Triangles ray-triangle insided-ness
pyramid-full.mp4
- ..... (maybe I'll do more; we'll see)
ffmpeg -framerate 30 -i output%03d.ppm -vf "scale=400:224" -c:v libx264 -pix_fmt yuv420p ../examples/output3.mp4
- Vecs and Rays
- Basic raytracing (no shaders)
- Camera animations + rotations
- Diffuse material + Higher Resolution (years to render) --> I could try and do some async programming.
scaled.mp4
- Colors + Lambertian Materials!
colored.mp4
- Metallica
- On the multithreading branch, there is a working multithreaded version of this raytracer!