Live data from Hacker News

Literate raytracer: a simple implementation of raytracing in Javascript

tmcw.github.io

21–26 of 26 posts

Re: Literate raytracer: a simple implementation of raytracing in Javascript

#21
post #2

Peter Shirley's Raytracing in a Weekend minibooks are another good introduction that goes beyond rendering spheres, and they are now available for free: https://twitter.com/Peter_shirley/status/1029342221139509249

Jamis Buck (wrote Mazes for Programmers) also has a pretty good one in progress. It's very TDD driven, which is an interesting approach. https://pragprog.com/book/jbtracer/the-ray-tracer-challenge

TDD is a great approach for a raytracer. They can be absolute nightmares to debug when a minor error in some calculation causes subtle artifacts in your image.

Re: Literate raytracer: a simple implementation of raytracing in Javascript

#22
I appreciate the concept of literate programming, however I think this example would be better presented in a 2-column format: All chunks of the program presented in 1 column with accompanying explanations in a second, parallel column. There would be breaks in either column to allow for either the chunk of code or prose to have different lengths.

Then, if desired, one could read the code and/or narrative straight through.

Re: Literate raytracer: a simple implementation of raytracing in Javascript

#23

I'm intrigued by the concept of literate programming and interested in exploring options for a Scala project I'm working on right now. It looks like this one was done using Docco [1]. Docco supports Scala, and it appears to be a pretty lightweight approach, largely using Markdown. I'm curious whether any literate programming veterans have tooling they prefer? [1] http://ashkenas.com/docco/

It depends on what you are looking for. Docco and friends seem to only be capable of reversing the relationship between comments and code. However, they don’t allow you to structure the program however you might like independently the need order and _nesting_ of code. In a lot of cases you can get around this through appropriate design patterns. I’ve recently taken a quite deep dive into possible tools for literate p…

I think I gonna try https://github.com/driusan/lmt

I like that it is markdown and that it has a many-to-many mapping of input to output files.

Re: Literate raytracer: a simple implementation of raytracing in Javascript

#24
Just so people don't get too hung up on speed issues, please realize that the major advantage with raytracing over rasterization is that it's trivially parallelizable. Naive implementations of ray tracing and rasterization run at O(log n) and O(n) respectively, so at some point in the near future ray tracing (or its optimized version ray marching) will likely win out. See the "Calculation effort" graph mid-page:

https://www.pcper.com/reviews/Processors/Ray-Tracing-and-Gam...

And a bit more recent writeup:

https://pharr.org/matt/blog/2018/05/27/nvidia-bound.html

Many of the Demoscene demos today use ray marching. Here are some examples of ray marching in WebGL, to show what's possible (and probably inevitable) in the next 5-10 years:

http://raymarching.com/

Re: Literate raytracer: a simple implementation of raytracing in Javascript

#25

I'm intrigued by the concept of literate programming and interested in exploring options for a Scala project I'm working on right now. It looks like this one was done using Docco [1]. Docco supports Scala, and it appears to be a pretty lightweight approach, largely using Markdown. I'm curious whether any literate programming veterans have tooling they prefer? [1] http://ashkenas.com/docco/

It depends on what you are looking for. Docco and friends seem to only be capable of reversing the relationship between comments and code. However, they don’t allow you to structure the program however you might like independently the need order and _nesting_ of code. In a lot of cases you can get around this through appropriate design patterns. I’ve recently taken a quite deep dive into possible tools for literate p…

Update: tried lmt and it works great!

Re: Literate raytracer: a simple implementation of raytracing in Javascript

#26
post #10

When I was young, graphics programming is what got me to try coding in the first place. At the time, all books I picked up for intros to graphics programming were more about teaching DirectX, and DirectX in the late 90s before IntelliSense was no fun. I found it horribly arcane and ended up a backend/web engineer. I think if I had better examples like this to follow I would've gotten a lot farther.

Visual Studio has IntelliSense since 1996, were you using DirectX 1.0?
Post reply on HN