Skip to content

Terrain: DDA voxel raycast + voxel editing brushes with undo/redo #728

Description

@drsnuggles8

Is your feature request related to a problem? Please describe.

There is no voxel-grid raycast. Renderer/Ray.h plus BoundingVolumeHierarchy handle mesh picking, but a voxel volume needs grid traversal, not BVH descent — and without it there is no precise voxel picking, so Terrain/Voxel/VoxelOverride edits cannot be driven interactively from the viewport.

Describe the solution you'd like

  • Amanatides & Woo DDA traversal — step the ray cell-by-cell in the voxel grid, crossing chunk boundaries correctly, returning the hit voxel and the face normal (needed to know which side to place against).
  • Editing brushes on top of it — place / carve / fill / paint with a radius, marking touched chunks dirty for incremental remesh rather than rebuilding the volume.
  • Undo/redo over voxel edits, integrated with the editor's existing command stack.

Describe alternatives you've considered

Raycasting against the generated mesh via the BVH — works for picking a surface point but not for identifying the voxel behind it or the placement face, and the BVH is stale the moment the volume is edited.

Additional context

Reference: D:\repos\VoxelEngine\VoxelEngine\voxel_ray_cast.h (DDA traversal) and voxel_edit.h (brushes + dirty tracking + undo), with the chunk-dirty/remesh loop in chunk_manager.h. MIT.

Pairs with the greedy-meshing issue (incremental remesh is much cheaper when the mesher is fast) and with Terrain/Voxel/VoxelOverride.

Acceptance criteria

  • Clicking in the viewport identifies the exact voxel and the hit face across chunk boundaries.
  • Edits remesh only the affected chunks.
  • Undo/redo round-trips a multi-chunk brush stroke exactly.

Score

capability: 3
craft: 3
stability: 1
decay: 1
effort: 3
confidence: 0.8
learning: 3
fun: 5
kano: table-stakes
blocked_by: []
blocks: []

Rated per issue-scoring · score = confidence × (capability + craft + stability + decay) / effort, derived by the picker.

🤖 Generated with Claude Code

Metadata

Metadata

Assignees

No one assigned

    Labels

    featureNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions