Code Monkey home page Code Monkey logo

voronoi-remesh's Introduction

Introduction

This tool takes a 3d mesh as input and compresses it into another 3d mesh such that the outputed mesh will use much less triangles while keeps the shape of the original mesh. The algorithm is based on metric-driven Discrete Voronoi Diagram construction. Some code is from other open source projects. This project is originally what I did for the (free-topic group) final project for CS184 at UC Berkeley, but I only open-sourced the part that I implemented in this repository. Most implementation is in vertexClustering.cpp.

My implementation is mainly based on [1]. I implemented uniform remeshing, adaptive remeshing, anisotropic remeshing, and an optimal vertex placement policy based on the Quadric Error Metrics described in that paper. The main idea of this approach is to group the triangles of the input mesh into clusters, and the compute a representative vertex for each cluster, and finally connect these new vertices together to form a new mesh.

For more information, please checkout the "Remeshing" section in the original final project report. (The link of reference [1] in the final report is broken, so please refer to the reference [1] in the section below if you need it.)

Reference

[1] Generic remeshing of 3D triangular meshes with metric-dependent discrete Voronoi Diagrams

[2] Approximated Centroidal Voronoi Diagrams for Uniform Polygonal Mesh Coarsening

[3] Surface Simplification Using Quadric Error Metrics

[4] Recent Advances in Remeshing of Surfaces

[5] Anisotropy

Build

mkdir build
cd build
cmake ..
make

Run

./remesh.exe [options] <inputfile_name> 

Example

./remesh.exe -n 1000 -o3 models/dragon.obj

options

-n INT    : set the number of clusters, default 400
-f PATH   : set the name of the output file, a default name will be generated if not provided
-r INT    : set the radius of the ring used by adaptive sampling, default 2
-seed INT : set the seed for srand(), default time(0)
-q        : use quadric based placement policy for vertex position
-o1       : enable adaptive remeshing
-o2       : enable adaptive remeshing with anisotropic metric
-o3       : shortcut for -o2 -q
-v        : enable verification for the clusters
-h        : show this help page

Some examples

The following visualization of meshes are generated by MeshLab

The original block model (block.obj)

Uniform remeshing

Adaptive remeshing

Adaptive remeshing with anisotrophic metric

Adaptive remeshing with anisotrophic metric + quadric based placement policy

The original dragon model (dragon.obj)

Uniform remeshing for the dragon model

Adaptive remeshing with anisotrophic metric + quadric based placement policy for the dragon model

voronoi-remesh's People

Contributors

jsc723 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

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.