3 ms·
Peter Shirely's Ray Tracing in One Weekend series (https://raytracing.github.io/ https://raytracing.github.io/) is a great way to learn enough about ray tracing
by mafm 7y ago
Peter Shirely's Ray Tracing in One Weekend series (https://raytracing.github.io/ https://raytracing.github.io/) is a great way to learn enough about ray tracing to implement it yourself.
- Buttons840 7y agoIt is a great project for learning a new language. I used it to practice Rust. You get to implement vectors, with basic operations on them, this gives you a chance to practice some abstractions. It's also good to create some unit tests to ensure your vector operations are correct. There's also good reason to parallelize your code and perform benchmarks. Abstractions, unit tests, parallelism, benchmarks, you have an excuse to try them all.
- dkersten 7y agoOh, that’s a great idea! The main reason I still haven’t learned Rust is I didn’t have a project to use with it, but this tutorial is something else I’ve wanted to do, so it’s a perfect match.
- sbeckeriv 7y agoI love seeing this book listed. I picked it up 4ish years ago while learning Rust. I was converting the code to Rust and I found a small bug[1] because I could not convert the code as it was. Peter was amazingly responsive and encouraging. I highly recommend this and the second second book. [1] https://github.com/RayTracing/raytracing.github.io/blob/7e2a8a10746f6de3e08f216d7a47baf059d46d77/books/RayTracingInOneWeekend.html#L1504 https://github.com/RayTracing/raytracing.github.io/blob/7e2a...
- dkersten 7y agoOh cool, congrats on finding the bug!
- corysama 7y agoLess well known is "Rasterization in One Weekend" https://tayfunkayhan.wordpress.com/2018/11/24/rasterization-in-one-weekend-part-i/ https://tayfunkayhan.wordpress.com/2018/11/24/rasterization-...
- fesoliveira 7y agoFor rasterization I would recommend the Tiny Renderer mini-course (https://github.com/ssloy/tinyrenderer/wiki https://github.com/ssloy/tinyrenderer/wiki). It aims to teach you how OpenGL works by having you implement your own OpenGL-like software rasterizer. It is a fantastic resource and one that I enjoyed thoroughly :)
- pests 7y agoI was reading through and noticed he does not normalize his vectors for (so far) things like ray direction or surface normals for lighting. He does give warnings but I'm curious what type of bugs or rendering issues will manifest from this decision?
- BubRoss 7y agoIncorrect results will manifest. If you take the dot product of a surface normal and another vector and they aren't the same length, the dot product will be distorted by the lengths of the vectors. Ray direction and ray length might be combined into one vector that just stretches from the origin for ray tracing, but using the direction with a surface normal for dot products, reflection vectors etc. is going to give artifacts.
- daniel-thompson 7y agoWhat you say is true; however, not automatically normalizing ray directions after transformation can be useful in some cases, e.g. to avoid introducing floating point error when calculating points from t values. See http://www.pbr-book.org/3ed-2018/Shapes/Spheres.html#SurfaceInteractionInitialization http://www.pbr-book.org/3ed-2018/Shapes/Spheres.html#Surface..., the paragraph beginning "A natural question to ask..."
- BubRoss 7y agoI literally gave using the non normalized ray for ray tracing as an example. (Also in practice floating point inaccuracy doesn't become a huge problem since you have to design around floats not being exact in the first place. Spheres can also wind up being more finnicky with precision but are rarely used as primitives to trace against in production renderers. There isn't a single right way to do the tracing, but the shading does need normalized vectors for a lot of common operations.)
- hellofunk 7y ago> Spheres can also wind up being more finnicky with precision but are rarely used as primitives to trace against in production renderers. I've never heard this before! Interesting. Why is this?