UnityMeshSimplifier Documentation

repository·master·Indexed 24 days ago

https://github.com/whinarn/unitymeshsimplifier

A C# implementation of the Fast Quadric Mesh Simplification algorithm for Unity. It enables 3D mesh decimation at editor-time and runtime across all supported platforms. Features include smart linking to prevent holes, preservation flags for borders, seams, and UV foldovers, and configurable simplification options via the MeshSimplifier class.

Tokens
663
Snippets
0
Records
6
Agent score
35%

What's inside UnityMeshSimplifier

  1. Configure Mesh Simplification with Smart Linking

    master

    The MeshSimplifier class uses a SimplificationOptions struct to control the simplification process.

    Smart Linking

    Smart linking is enabled by default and helps prevent artifacts like holes in decimated meshes. You can toggle this via the EnableSmartLink field. Disabling it may provide a minor performance gain if your meshes do not require it.

    You can adjust the maximum distance between two vertices for linking using the VertexLinkDistance field in SimplificationOptions. The default value is double.Epsilon. For large-scale meshes, you may need to increase this value to ensure vertices are correctly linked.

  2. Prevent holes in decimated meshes

    master

    If your decimated meshes contain holes, it is often because multiple vertices share the same position but are treated individually. While Smart Linking (enabled by default) is the recommended solution, you can also use preservation flags to limit decimation in sensitive areas:

    • PreserveBorders: Prevents decimation of border vertices.
    • PreserveSeams: Prevents decimation of seam vertices.
    • PreserveFoldovers: Prevents decimation of UV foldover vertices.

    Note that using these flags will strongly limit the decimation algorithm's effectiveness.

  3. Fix broken Visual Studio solution files

    master

    If the Unity-generated Visual Studio solution file appears broken (often due to assembly definitions), ensure you have the latest Visual Studio Tools for Unity.

    • For Visual Studio 2017: Ensure it is up to date and the Game development with Unity component is installed.
    • For other versions: Download the separate installer from the Microsoft Documentation.
  4. Fix animation issues in generated LOD Groups

    master

    If objects parented under bones do not animate correctly after generating LOD Groups, it is because the current implementation does not automatically handle bone-parented objects.

    Solution: Use nested LOD Groups. Any object known to be parented under a bone should be assigned its own individual LOD Group.

  5. Fix missing XML documentation in code editors

    master

    If you installed the library via a Git URL in the Unity Package Manager and cannot see XML documentation in your IDE, follow these steps:

    1. Open Unity Editor.
    2. Navigate to Edit > Preferences > External Tools.
    3. Under Generate .csproj files for:, ensure that Git packages (and any other relevant package types) are selected.
    4. Click Regenerate project files.