Krabl Mesh Library
A C# library to process meshes in Unity3D
 All Classes Namespaces Functions Variables Pages
List of all members
KrablMeshUtility Class Reference

Description

A collection of static calls to easily use the Krabl Mesh Library in Unity3D scripts.

Functions

static void KrablMeshUtility.SimplifyMesh ( Mesh  unityMesh,
int  targetFaceCount,
bool  highQuality = true 
)
static

Simplify a mesh by collapsing edges until the target face count is reached.

Parameters
unityMeshThe mesh to simplify.
targetFaceCountThe number of triangles to reduce the mesh to. If this is higher than the initial number of triangles, no processing will occur.
highQualityUse slower, but more precise calculations.
static void KrablMeshUtility.SubdivideQuadsMesh ( Mesh  unityMesh,
int  iterations,
bool  trisToQuads = true 
)
static

Subdivides a mesh by applying a quads-based subdivision algorithm. Optionally, triangles are first merged to quads if possible to produce a better topology. For every iteration the face count of the mesh quadruples. The result mesh has quad topology.

Parameters
unityMeshThe mesh to subdivide.
iterationsThe number of iterations the algorithm should perform. High numbers (>3) quickly lead to producing more triangles than unity can handle! (>65k).
trisToQuadsAttempt to convert triangles to quads before the subdivision (highly recommended).
static void KrablMeshUtility.FlatShadeMesh ( Mesh  unityMesh)
static

Change the normals of a mesh to produce a flat-shaded look. This will increase the vertex count as all vertices need to be split.

Parameters
unityMeshThe mesh to flat shade.
static void KrablMeshUtility.SmoothShadeMesh ( Mesh  unityMesh)
static

Change to normals of a mesh to produce a smooth-shaded look. This will reduce the vertex count and all mesh corners will just have one normal.

Parameters
unityMeshThe mesh to smooth shade.