Re:WebAssembly Raytracer
by sniklaus on Saturday December 16, 2017 @04:29PM
(#15942242)
I initially wrote the raytracer in more idiomatic way. However, I wanted to show my students a side-by-side comparison, demonstrating that the program logic is pretty much the same. Take it as you will, I understand your critique though.
[ Parent
| on HN ]
Re:WebAssembly Raytracer
by djellybeans on Saturday December 16, 2017 @06:32PM
(#15942911)
Idiomatic will probably entail a lot of objects for the pixel data, I'm assuming? I've seen some raytracers written with arrays of simple "bags" of numbers, which would increase performance.
I wrote a real-time 3D polygonal rasterizer in JS that supports texture mapping. After switching from regular arrays to Float32array to store coordinates, it got a huge (~50%) jump in performance.