Voxel rendering performance
- Dominant language
- JavaScript
- Stars
- 15.7k
- Forks
- 3.9k
- Avg merge
- 4d 6h
- Merged PRs (30d)
- 34
Description
In our current voxel implementation, frame rates can be low (~20 FPS) when rendering a large voxel dataset in a full-screen view.
We know that the fragment shader is the bottleneck, because:
- A DevTools profile shows JS time is <8ms per frame
- Shrinking the pixel area of the view improves the FPS
Within the fragment shader, a few candidate bottlenecks include:
- Intersections are sorted via bubble sort
- Octree traversal introduces a lot of divergent branching
- Property texture lookups are using a 2D "megatexture" to simulate 3D textures
Testing solutions for any of the above is not trivial, so we should start with some simple tests to confirm which one is the real bottleneck. Here are some preliminary ideas to test:
- [ ] Intersections: compare performance with a simple shape vs. one with render bounds and clipping planes (a simple shape has `INTERSECTION_COUNT == 1`, hence no sorting)
- [ ] Octree traversal: compare performance to a tileset with only 1 LOD
- [ ] 2D "megatexture": Load a 3D array to a 2D megatexture, then animate a slice moving along a coordinate axis. Do we see significant frame rate difference when sampling the "fast" vs "slow" directions of the array? Are WebGL2 3D textures any less direction-dependent?
Contributor guide
Research direction
Start by reproducing the full-screen voxel case and profiling it with DevTools, using the reported JavaScript time and pixel-area behavior as a baseline. Compare the proposed simple-shape, one-LOD tileset, and 2D megatexture slice tests; the work is done when these benchmarks identify which candidate bottleneck materially affects frame rate.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- computer-graphics, performance
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100