Skip to content

feat: make the voxels shape use a sparse internal storage#380

Merged
sebcrozet merged 3 commits into
masterfrom
sparse-voxels
Oct 3, 2025
Merged

feat: make the voxels shape use a sparse internal storage#380
sebcrozet merged 3 commits into
masterfrom
sparse-voxels

Conversation

@sebcrozet
Copy link
Copy Markdown
Member

Currently, the dedicated shapes for voxels uses a dense grid internally, meaning that even if the voxels {0, 0, 0} and {1000, 1000, 1000} are set, the shape will allocate room for 1000 * 1000 * 1000 = 1_000_000_000 voxels (about 1GB) despite the fact that the shape is mostly empty.

This PR replaces the internal dense grid by a sparse grid based on a hash-map combined with a Bvh.
Large maps that would exceed 4GB for some users are now down to about 1.3MB with this change.

Performance is mostly unchanged.

@sebcrozet sebcrozet merged commit c8bae14 into master Oct 3, 2025
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant