Giter Site home page Giter Site logo

meshdecimator's Introduction

MeshDecimator

A mesh decimation library for .NET and Unity. The project is written entirely in C# and released under the MIT license.

Compatibility

This provided Unity Example project is currently compatible with Unity 2018.1.2f1

This does not in any way limit the code to that specific Unity version however, but you might have to modify some Unity API usage.

Prerequisites

The following must be installed before this repository can be properly cloned:

Installation into Unity

After building the project, copy over MeshDecimator.dll and MeshDecimator.xml into your Unity project, anywhere within your Assets directory (for example Assets/MeshDecimator). It is strongly recommended to build the C# project over copying the binaries found in the Unity Example project.

In the provided Unity example in this repository you can find examples of how to use the mesh decimation from Unity.

Fast Quadric Mesh Simplification Algorithm

MeshDecimator uses an algorithm based on the Fast Quadric Mesh Simplification algorithm, completely rewritten in C#. Currently it is the only mesh decimation algorithm available to use.

The Smart Linking feature

In order to solve artifacts in the mesh simplification process where holes or other serious issues could arise, a new feature called smart linking has been introduced. This feature is enabled by default but can be disabled through the EnableSmartLink property on the FastQuadricMeshSimplification class. Disabling this could give you a minor performance gain in cases where you do not need this.

The VertexLinkDistanceSqr property on the FastQuadricMeshSimplification class could be used to change the maximum squared distance between two vertices for the linking. The default value is double.Epsilon.

My decimated meshes have holes, what is wrong?

The original algorithm that was ported from C++ did not support situations where multiple vertices shared the same position, instead of being treated as one vertex they were treated individually. This would then end up creating visible holes in the mesh where the vertices were not connected through triangles.

There are several ways to solve this problem. The smart linking feature (mentioned above) is enabled by default and should take care of most of these problems for you. But there are also options to preserve borders, seams and UV foldovers. The properties PreserveBorders, PreserveSeams and PreserveFoldovers will preserve some vertices from being decimated, strongly limiting the decimation algorithm, but should prevent holes in most situations.

The recommendation is to use the smart linking feature that is enabled by default, but the options for preservation exists in those cases where you may want it.

Credits

The teddy bear model in the Unity example project is from the following package from Unity Asset Store: https://assetstore.unity.com/packages/essentials/tutorial-projects/mecanim-example-scenes-5328

Other projects

If you are interested in a more simple mesh simplification in Unity you can visit my other project UnityMeshSimplifier.

meshdecimator's People

Contributors

whinarn 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.