r/GraphicsProgramming • • Oct 03 '26

Source Code Creating a simple raytracer through The Ray Tracer Challenge

Getting an introduction to raytracing and implemented a simple renderer , so far implementing spheres, lighting and shadows. The code is written in Python

141 Upvotes

13 comments sorted by

23

u/moschles Oct 03 '26

Want to avoid Python for this kind of thing. Python lacks true threading support.

3

u/larrylion01 Oct 03 '26

I thought 3.14 allows for real threading now? They officially support free-threaded mode

1

u/moschles Oct 04 '26

That's what a google search will tell you. Have you actually tried it?

6

u/Loud-Astronaut-5807 Oct 03 '26

I've gone though this book a few times, once in cpp, once in TS and once in Rust,
I would like to go through it again but learning how to use webGPU and compute shaders.

2

u/Lucataine Oct 03 '26

You mean there's a rust version of the book or you just challenge yourself to used with a different language?

1

u/MethaneOceans Oct 03 '26

The book isn't language specific. So they used a different language every time

1

u/Loud-Astronaut-5807 Oct 03 '26

The book is just theory and pseudocode. The nice thing it is leaves the actual design and implementation choices up to you. Especially with the rust, I spent significant portions later on refactoring the code, and thinking about how to represent each element as the technical depth grew.

1

u/Mroz_Game Oct 03 '26

WebGPU is cool in the fact that it’s kinda like metal in the fact that there’s very little initial boilerplate, but not so cool the moment you start needing features it doesn’t support.

3

u/anadalg Oct 03 '26

Really good book! Some years ago I made a short video explaining the basics of Ray Tracing from what I learned reading the book. https://youtu.be/V7G9-RIhOI8

2

u/604korupt Oct 03 '26

Cool! One thing you should add next is anti-aliasing!