Hacker Newsnew | past | comments | ask | show | jobs | submitlogin
Ray Tracing in One Weekend (raytracing.github.io)
110 points by bjourne 8 months ago | hide | past | favorite | 14 comments


I can also recommend this book when looking for something fun to implement while learning a new language. There is also the follow ups to this taking things a bit further:

https://raytracing.github.io/books/RayTracingTheNextWeek.htm... https://raytracing.github.io/books/RayTracingTheRestOfYourLi...

I did this ray tracing library in Rust inspired by these books: https://github.com/DanielPettersson/solstrale-rust

And also a small UI using the lib: https://github.com/DanielPettersson/solstrale-desktop-rust

Kind of not maintained anymore.. But fun way learning Rust..


> Program files will include rtweekend.h first, so all other header files (where the bulk of our code will reside) can implicitly assume that rtweekend.h has already been included.

Not a great practice. Header files shouldn't assume anything from previous inclusions of other headers.

Sure, this works as a weekend hack, but it would be nice if book (article) would promote good conventions.


This is a normal practice for applications, and allows you to pre-compile that header for performance. I don't think it's a bad enough practice to warrant complaining, but it's good for people to know the advantages or disadvantages.


See this: https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines...

Technically, headers are just copy-paste, obviously. However, there's value to keeping them as standalone as possible.


Headers should still be self contained, although precompiled headers are used. Those things are mostly orthogonal


Wohoo, my name is in the contributors list! This helped me get in a computer graphics grad course at a top(?) school and certainly helped in further job applications.

If anyone else is interested in a graduate degree in this field, I recommend doing something similar - I simply made a few reasonable PRs to fix some issues that I found when following along the books.


One thing that's not directly related to ray-tracing proper, so makes no sense in this book series, but is still a pretty natural (and fun!) next step (or detour) is embedding e.g. a Lua interpreter so you can use that as a scene description language separate from the rendering engine proper.


It's a fun tutorial to try out new languages.

Here is the result of following the tutorial using Rhombus.

https://github.com/soegaard/miniray


I strongly approve of this. Code snippets are nice, but with new languages⁰ it's rare to have an example of a self-contained but and complete application to get a holistic view. I think a raytracer (or its equivalent) should be a standard example.

0: Or is Rhombus a dialect? Or alternative writing system for an existing language? Or just an elaborate system of shrubs?


Yes, I used as experiment for C++20 modules, C# SIMD instructions and Rust.


If you'd like to see it unfold, step by step, there's a javascript version at

https://github.com/MarquisdeGeek/six_hour_raytracer

Plus, it comes with a live demo on

https://marquisdegeek.github.io/six_hour_raytracer/


Previously:

• Show HN: Ray Tracing in One Weekend v4.0.0 (July 2024) https://news.ycombinator.com/item?id=41082425 - 69 points, 5 comments

• Raytracing in One Weekend (2016) https://news.ycombinator.com/item?id=25244301 - 316 points, 80 comments


Is there any similar content for ML/Deep learning?


Andrej Karpathy's guide to Micrograd - https://www.youtube.com/watch?v=VMj-3S1tku0 - is probably the closest equivalent, in that it covers the basic ideas of backpropagation and autodiff frameworks like PyTorch, and ends with an implementation of a very basic framework (https://github.com/karpathy/micrograd) you can train small neural networks in




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: