mattatz / unity-subdivision-surface

Loop subdivision surface algorithm implementation in Unity.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

unity-subdivision-surface

Loop subdivision surface algorithm implementation in Unity.

Heads

From left to right, original mesh, subdivided 1 time, subdivided 2times model.

Cubes

Loop subdivision surface

Loop subdivision surface is an approximating subdivision scheme developed by Charles Loop in 1987 for triangular meshes. wikipedia

SubdivMorph

SubdivMorph

SubdivMorph demo morph vertices between original and subdivided.

Usage

var filter = GetComponent<MeshFilter>();

// Require a mesh to weld (require to remove duplicated vertices)
var welded = SubdivisionSurface.Weld(filter.mesh, float.Epsilon, filter.mesh.bounds.size.x);

var mesh = SubdivisionSurface.Subdivide(
  welded,   // a welded mesh
  2,        // subdivision count
  false     // a result mesh is welded or not
);
filter.sharedMesh = mesh;

See demo scenes for details.

Compatibility

tested on Unity 2017.0.3, windows10 (GTX 1060).

Sources

About

Loop subdivision surface algorithm implementation in Unity.

License:MIT License


Languages

Language:C# 55.7%Language:HLSL 30.2%Language:ShaderLab 14.1%