The current version of BVH construction is written in a ~150 lines of TypeScript code. This code works well for small models, but for larger models, the page hangs for a bit and becomes unresponsive.
There are a few options I've considered to move forward:
Move the existing TypeScript code to a Web Worker: This would free up the main thread and not cause locking. It wouldn't really make the process go faster, but might avoid some crashes
Rewrite the code in a more efficient language like C++ or Rust and compile to WASM: We can take advantage of compiler optimizations and eke out a bit more performance.
Context
The current version of BVH construction is written in a ~150 lines of TypeScript code. This code works well for small models, but for larger models, the page hangs for a bit and becomes unresponsive.
There are a few options I've considered to move forward:
Existing Code
https://github.com/umar-ahmed/webgpu-pathtracer/blob/main/src%2Fpasses%2Fraytrace.ts#L511-L631