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)
Maps a single viseme (lip-sync shape) to its corresponding blend shape key
within the specified geometryGroup, returning the index of
that blend shape key if found.
Override this method to customize name matching or heuristic-based matching.
Declaration
protected virtual int MapViseme(AssetLoaderContext assetLoaderContext, LipSyncViseme viseme, IGeometryGroup geometryGroup)
Parameters
| Type | Name | Description |
|---|---|---|
| AssetLoaderContext | assetLoaderContext | The AssetLoaderContext referencing the model’s loaded data and import settings. |
| LipSyncViseme | viseme | The specific lip-sync shape to match. |
| IGeometryGroup | geometryGroup | The geometric data group holding blend shape keys. This method tries to locate one that corresponds to the requested viseme. |
Returns
| Type | Description |
|---|---|
| int | The blend shape key index if a matching shape is found; otherwise |