Class LipSyncMapper
Provides a mechanism for mapping blend shapes within a model’s geometry to corresponding visemes (lip-sync shapes). This class can be extended to integrate TriLib-loaded models with custom lip-sync systems, enabling facial animation driven by audio or other input sources.
Namespace: TriLibCore.Mappers
Assembly: TriLibCore.dll
Syntax
public class LipSyncMapper : ScriptableObject
Constructors
LipSyncMapper()
Declaration
public LipSyncMapper()
Fields
CheckingOrder
Defines the mapper’s priority when multiple LipSyncMapper instances are present in the same AssetLoaderOptions. A lower value means this mapper will be attempted first.
Declaration
public int CheckingOrder
Field Value
Type | Description |
---|---|
int |
VisemeCount
Specifies the total number of lip-sync visemes recognized by this mapper, allowing for indexed lookups or array-based mappings.
Declaration
public const int VisemeCount = 14
Field Value
Type | Description |
---|---|
int |
Methods
Map(AssetLoaderContext, IGeometryGroup, out int[])
Attempts to match each of the VisemeCount visemes
to corresponding blend shape keys in the provided geometryGroup
.
If any matches are found, their indices are stored in the output
array.
Declaration
public virtual bool Map(AssetLoaderContext assetLoaderContext, IGeometryGroup geometryGroup, out int[] output)
Parameters
Type | Name | Description |
---|---|---|
AssetLoaderContext | assetLoaderContext | The AssetLoaderContext holding model loading data, including loaded UnityEngine.GameObject references, options, and callbacks. |
IGeometryGroup | geometryGroup | The IGeometryGroup containing blend shape data (BlendShapeKeys). |
int[] | output | An integer array of length VisemeCount that, upon success,
will hold the matched blend shape key indices for each viseme. If no match is found
for a given viseme, the corresponding index is set to |
Returns
Type | Description |
---|---|
bool |
|
MapViseme(AssetLoaderContext, LipSyncViseme, IGeometryGroup)
Declaration
protected virtual int MapViseme(AssetLoaderContext assetLoaderContext, LipSyncViseme viseme, IGeometryGroup geometryGroup)
Parameters
Type | Name | Description |
---|---|---|
AssetLoaderContext | assetLoaderContext | |
LipSyncViseme | viseme | |
IGeometryGroup | geometryGroup |
Returns
Type | Description |
---|---|
int |