Class Smoothing
Provides utilities for working with smoothing groups. ProBuilder uses smoothing groups to define hard and soft edges. To calculate vertex normals, ProBuilder performs these tasks:
- Calculates the normals for every face.
- Applies the results of those calculations to each vertex on the face.
- Averages each vertex normal with coincident vertices belonging to the same smoothing group.
Inherited Members
Namespace: UnityEngine.ProBuilder
Assembly: Unity.ProBuilder.dll
Syntax
public static class Smoothing
Methods
ApplySmoothingGroups(ProBuilderMesh, IEnumerable<Face>, float)
Generates 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 mesh to apply new smoothing groups to. |
IEnumerable<Face> | faces | Faces to inspect for smoothing. |
float | angleThreshold | Set the maximum value to consider the shared edge smooth. This value is an angle in degrees that represents the difference between adjacent face normals. |
GetUnusedSmoothingGroup(ProBuilderMesh)
Returns 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 |
---|---|
int | An unused smoothing group. |
IsSmooth(int)
Tests whether the specified smoothing group is smooth.
Declaration
public static bool IsSmooth(int index)
Parameters
Type | Name | Description |
---|---|---|
int | index | The ID of the smoothing group to test. |
Returns
Type | Description |
---|---|
bool | True if the smoothing group value is smoothed; false otherwise. |