Skip to content

PatHightree/Mesh-Voxelization

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 

Repository files navigation

Mesh-Voxelization

This project converts a mesh into voxels in Unity. The idea is to ray trace the mesh and find where each ray intersects a triangle. These positions can then be used to make a 3D array of voxels.

The ray tracing is accelerated by using a AABB tree to group the mesh triangles. The AABB tree should be much faster for large meshes but the overhead might not be worth it for smaller meshes.

The original code for the AABB tree can be found in the core section of this collection of code from Miles Macklins blog.

For the demo scene the voxels are converted back into a mesh by adding quads at the edge of each voxel.

You can download a unity package here.

The mesh before voxelization.

Before voxelization

The mesh after voxelization.

After voxelization

About

Mesh voxelization in Unity

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C# 100.0%