News for hackers. Stuff that matters.
Re:Ask HN: What is the coding exercise you use to explore a ... by rychco on Wednesday September 14, 2022 @09:24AM (#32836832)
I typically write a raytracer while attempting to stick to a small set of "best-practices" for the language I'm trying to learn. I also use this exercise from time-to-time to test new language features (for example C++20 ranges/coroutines recently).

I also recommend this same exercise to others through the book "The Ray Tracer Challenge" [1] by Jamis Buck, because it describes an entire implementation of a raytracer in pseudocode. Beginners mostly just need to plug-in their language of choice & still end up with a satisfying visual result. Experienced programmers can extend it by adding the ability to load non-trivial .obj models, which will necessarily motivate adding concurrency, bounding volumes, & other general performance improvements.

I'm planning on tackling it again in Elixir soon, which should be fun & interesting.

EDIT: Almost forgot to mention the free bonus chapters [2] that get you started on bounding volumes (AABB), soft area lights, and texture mapping.

[1] https://pragprog.com/titles/jbtracer/the-ray-tracer-challeng...

[2] http://www.raytracerchallenge.com/#bonus

Re:Ask HN: What is the coding exercise you use to explore a ... by bick_nyers on Wednesday September 14, 2022 @12:57PM (#32839947)
I use: https://raytracing.github.io/books/RayTracingInOneWeekend.ht...

I second the advice of loading .obj, it's a good exercise.

Implementing Octrees is another good one that will speed up your code while exploring tree structures in that language.

Re:Ask HN: What is the coding exercise you use to explore a ... by nvarsj on Wednesday September 14, 2022 @11:48AM (#32838854)
Great suggestion! And you earned them a sale from me. Going to try this out to bring my rustlang knowledge up to speed.
Re:Ask HN: What is the coding exercise you use to explore a ... by rychco on Wednesday September 14, 2022 @01:08PM (#32840092)
In that case, you might be interested in this youtube playlist [1]. The uploader claims to be new to Rust and implements the entire book in it. I haven't watched it myself, but had it bookmarked at the recommendation of a friend.

[1] https://youtube.com/playlist?list=PLy68GuC77sUTyOUvDhVboQoOl...

Re:Ask HN: What is the coding exercise you use to explore a ... by bhub on Thursday September 15, 2022 @11:14AM (#32853276)
Thank you for this. A while ago I was doing a fair bit of Elixir in my spare time, so this has given me a reason to pick it up again. Going to give it a go myself
Re:Ask HN: What is the coding exercise you use to explore a ... by andnand on Wednesday September 14, 2022 @10:15AM (#32837523)
I'm currently going through this book and it's amazing. Any tips on where to go once I finish it?
Re:Ask HN: What is the coding exercise you use to explore a ... by rychco on Wednesday September 14, 2022 @10:38AM (#32837877)
Once you finish the main book, there's a few free bonus chapters provided [1] that help you implement soft area lights, bounding boxes (AABB in this case), and texture mapping. Beyond that, you might be interested in the "One Weekend" series [2], which is all C++ but is mostly general enough for other languages. There's also PBRT [3] which is an open source textbook/documentation for the pbrt-v3 renderer [4], but this is beyond the scope of "small exercise" territory. Good luck!

[1] http://www.raytracerchallenge.com/#bonus

[2] https://raytracing.github.io/

[3] https://pbr-book.org/3ed-2018/contents

[4] https://github.com/mmp/pbrt-v3

Re:Ask HN: What is the coding exercise you use to explore a ... by sam345 on Wednesday September 14, 2022 @09:30AM (#32836903)
Wow. That looks really cool.