Hacker News new | ask | show | jobs
by qbasic_forever 1952 days ago
Build a raytracer from scratch. It's a couple hundred lines of very straightforward C code, or much, much less with a higher level language. You will learn _a ton_ about the rendering pipeline, transformations, lighting, shading surfaces, etc. It is super satisfying the very first time you run and finally get some colorful shaded spheres floating in space--you'll remember that moment for a long time. This is just one of many resources to help get started with a raytracer: https://www.realtimerendering.com/raytracing/Ray%20Tracing%2...
3 comments

Peter Shirley's one is nice too!

But he has 2 more:

https://gamephysicsweekend.github.io/

And you can do a very simple one in much less than 30 lines in C. ;)

Edit: Oops, it was the wrong one... This is the right one:

https://raytracing.github.io/

Sorry!

To get a quick feel for ray tracing, I would also suggest https://rayground.com/. It has a lot of ray tracing projects, ranging from basic samples to complicated scenes. They can all be run in your browser.
> It's a couple hundred lines of very straightforward C code

Or a business card's worth of space:

https://fabiensanglard.net/rayTracing_back_of_business_card/