Stream: show and tell

Topic: Raytracing in one weekend


view this post on Zulip Shritesh Bhattarai (Dec 23 2022 at 13:38):

image.ppm.png

I implemented Perter Shirley's Ray Tracing in One Weekend in Roc. This is the final image from the first book and the repo is at https://github.com/shritesh/raytrace.roc

view this post on Zulip Anton (Dec 23 2022 at 13:46):

Wow, super cool @Shritesh Bhattarai! The image looks beautiful :)

view this post on Zulip Richard Feldman (Dec 23 2022 at 14:12):

yoooo this is amazing!!! :heart_eyes:

view this post on Zulip Shritesh Bhattarai (Dec 26 2022 at 04:20):

Final-Loop.gif

I have now implemented an elm-style {init, update, render} platform. The init is called with the host provided {width, height, x,y} values for every pixel in parallel (using Rust's Rayon). Then the update and render functions are repeatedly called (again in parallel) to update the state and draw the screen. https://github.com/shritesh/raytrace.roc/blob/main/platform/main.roc

I am calling this learning exercise "complete". It was really fun and helped me understand where Roc excels at and the current limitations. The clean separation of platform and application is a huge effing deal and changes the way you think about programming. I'm doubling down on Roc+Rust being my default stack of choice.


Last updated: Jul 06 2025 at 12:14 UTC