Hacker News new | ask | show | jobs
by Tunabrain 3866 days ago
Unfortunately, that's not possible in the current version - originally I had a demo with larger scope in mind, but WebGL turned out to be a lot more limited than I expected.

I wasn't able to implement an acceleration structure in WebGL, so the amount of primitives it can trace in real-time are quite limited, and all scenes had to be hardcoded in GLSL. This makes modifying scenes a real pain, since adding a new primitive amounts to generating and compiling new shader code.

The original C++ version just constructs the scene from very small (~1px long) line segments and then builds a BVH acceleration structure over them, so you have practically unlimited freedom in the type and number of primitives. Unfortunately traversing a BVH inside a shader in WebGL is almost not doable, so I had to improvise.

1 comments

(I assume you're Benedikt.)

This is beautiful work. Especially the write-up. I think we all understand the urge to code, but your desire to take the next step and describe what you've done is fantastic. Thanks for the gift.

This reminds me of those optics tables you see in museums, in the hands-on section for kids. Where they'll have a table with a rectangular inset, and in it will be light sources and prismatic pieces of Plexiglas that you can move around. You see the light tracing paths and scattering.

I've played with these setups and find them disappointing. If these museums instead had tables with touch displays, they could run software like yours. Of course they could also run other apps and anything that runs on a phone, so maybe that ruins the whole "this is special because it's in a museum" feel.