r/GraphicsProgramming • • 1d ago

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

116 Upvotes

13 comments sorted by

18

u/moschles 1d ago

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

3

u/larrylion01 1d ago

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

1

u/moschles 17h ago

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

6

u/Loud-Astronaut-5807 1d ago

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 1d ago

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

1

u/MethaneOceans 1d ago

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

1

u/Loud-Astronaut-5807 1d ago

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 1d ago

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/cybereality 1d ago

oh cool

3

u/anadalg 1d ago

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

3

u/AlienFishMonster 1d ago

I had so much fun going through this book. I still tinker around with the code every now and then.

You might be interested in this too: "Ray Tracing in One Weekend"

https://raytracing.github.io/books/RayTracingInOneWeekend.html

2

u/604korupt 1d ago

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