Class Smoothing
Utilities for working with smoothing groups. Smoothing groups are how ProBuilder defines hard and soft edges. ProBuilder calculates vertex normals by first calculating the normal for every face, which in turn is applied to each vertex that makes up the face. Afterwards, each vertex normal is averaged with coincident vertices belonging to the same smoothing group.
Namespace: UnityEngine.ProBuilder
Syntax
public static class Smoothing
Methods
ApplySmoothingGroups(ProBuilderMesh, IEnumerable<Face>, Single)
Generate smoothing groups for a set of faces by comparing adjacent faces with normal differences less than angleThreshold (in degrees).
Declaration
public static void ApplySmoothingGroups(ProBuilderMesh mesh, IEnumerable<Face> faces, float angleThreshold)
Parameters
Type | Name | Description |
---|---|---|
ProBuilderMesh | mesh | The source mesh. |
IEnumerable<Face> | faces | Faces to be considered for smoothing. |
Single | angleThreshold | The maximum angle difference in degrees between adjacent face normals for the shared edge to be considered smooth. |
GetUnusedSmoothingGroup(ProBuilderMesh)
Get the first available unused smoothing group.
Declaration
public static int GetUnusedSmoothingGroup(ProBuilderMesh mesh)
Parameters
Type | Name | Description |
---|---|---|
ProBuilderMesh | mesh | The target mesh. |
Returns
Type | Description |
---|---|
Int32 | An unused smoothing group. |
IsSmooth(Int32)
Is the smooth group value considered smooth?
Declaration
public static bool IsSmooth(int index)
Parameters
Type | Name | Description |
---|---|---|
Int32 | index | The smoothing group to test. |
Returns
Type | Description |
---|---|
Boolean | True if the smoothing group value is smoothed, false if not. |