Re:Show HN: 3D Raycasting Engine in JavaScript
by MuffinFlavored on Tuesday March 31, 2020 @06:31PM
(#22743449)
What was performance like js-raycast vs emcc-raycast?
Re:Show HN: 3D Raycasting Engine in JavaScript
by akdas on Thursday April 02, 2020 @01:29AM
(#22756482)
At the time I wrote those, I was actually surprised because I didn't see much improvement using emcc-raycast. In both implementations, you can see that I'm allocating objects/structs all over the place, so that probably brings down the performance.
A couple of years ago, I wrote a Javascript implementation myself: https://github.com/avik-das/js-raycast
And then, when asm.js (precursor to WebAssembly) became a thing, I rewrote it in C and compiled it to asm.js: https://github.com/avik-das/emcc-raycast
I'd already written a ray tracer (so a fully 3D renderer) prior to that in college, so it was fun to learn about a more limited algorithm that was better suited to older hardware.