Skip to content

AdamStone/dual-contouring-2d-grid

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

First attempt to implement Dual Contouring

  • 2D case on a simple grid
  • mathjs for vector/matrix manipulation
  • p5js to interactively visualize the result

Done:

  1. Partition space into a grid
  2. Add a surface function (noise-modulated circle)
  3. Iterate over vertices, marking densities (solid or air)
  4. Iterate over edges, marking surface intercept positions and normals
  5. Iterate over cells, positioning vertices by minimizing quadratic error function
  6. Iterate over cells, connecting adjacent vertices with faces (in 2d, just lines)
  7. Convert grid into quadtree, collapsing homogeneous regions

Most of the work is done in simplegrid.js.

Not done:

  1. Multiple materials
  2. Adding/removing voxels
  3. Mesh simplification

Interactive demo (only tested in Chrome)

About

Dual contouring on a 2D grid

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published