Giter Site home page Giter Site logo

mc-mesher's Introduction

mc-mesher

by Kyle J Burgess (github.com/kyy13)

disp

Summary

mc-mesher is a lightweight marching cubes mesh generator for c, c++, c#, and Unity.

Features

details

Mesh Generation

  • Generate 3D Marching Cubes meshes from a 3D scalar field and custom ISO level.
  • Produces mesh indices, vertices, and normal vector data
  • Choose between face normal vectors, and vertex normal vectors.

Algorithms

  • Trace rays through a scalar field used to generate a mesh without requiring the mesh to be generated first; detects collision with the mesh and returns the point of intersection. This method will detect collision much faster than ray tracing implementations operating on the mesh data itself.

Performance

details

Notes

  • mc-mesher is designed to produce indexed marching cubes meshes with minimal vertices.
  • Meshes generated with face normals tend to be much larger due to the inability to index vertices that share the same position, because they have different normal vectors.
  • Mesh generation functions have O(X*Y*Z) time complexity where X, Y, and Z refer to the dimensions of the scalar field used to produce the mesh.
  • Meshes with face normals have O(1) temporary memory usage.
  • Meshes with vertex normals have O(X*Y) temporary memory usage.

Quick Start

details

Unity Steps

  1. Download the latest release from the releases page.
  2. Drop the DLL into the your Assets folder
  3. Drop the mc_mesher.cs wrapper file into your Assets folder.

Build

details

Notes

  • There are precompiled binaries available on the releases page.
  • See the build scripts in the scripts folder for examples on how to build with cmake.
    The scripts are setup to target mingw-w64 for 64-bit windows.

Requirements

  1. A working c++17 (or higher) compiler.
  2. CMake version 3.7 or higher

Steps

  1. Run cmake with DCMAKE_BUILD_TYPE=Release to generate the build files
  2. Run make to compile

mc-mesher uses lookup tables modified from the transvoxel algorithm [1].

[1] Lengyel, Eric. “Voxel-Based Terrain for Real-Time Virtual Simulations”. PhD diss., University of California at Davis, 2010.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.