Class StandardMaterialMapper
Converts TriLib virtual materials into Unity Standard materials. This mapper is designed
to work with the Unity Standard shader and processes texture maps and various material properties
(e.g., diffuse, glossiness, metallic, emission, normal, occlusion, and displacement) using an asynchronous
coroutine pipeline.
Inheritance
Object
ScriptableObject
StandardMaterialMapper
Inherited Members
ScriptableObject.SetDirty()
ScriptableObject.CreateInstance<T>()
Object.GetInstanceID()
Object.GetHashCode()
Object.Instantiate(Object, Vector3, Quaternion)
Object.Instantiate(Object, Vector3, Quaternion, Transform)
Object.Instantiate(Object)
Object.Instantiate(Object, Transform)
Object.Instantiate<T>(T)
Object.Instantiate<T>(T, Vector3, Quaternion)
Object.Instantiate<T>(T, Vector3, Quaternion, Transform)
Object.Instantiate<T>(T, Transform)
Object.Destroy(Object)
Object.DestroyImmediate(Object)
Object.DontDestroyOnLoad(Object)
Object.DestroyObject(Object)
Object.FindObjectsOfType<T>()
Object.FindObjectOfType<T>()
Object.ToString()
Object.name
Object.hideFlags
Assembly: Assembly-CSharp.dll
Syntax
[Serializable]
[CreateAssetMenu(menuName = "TriLib/Mappers/Material/Standard Material Mapper", fileName = "StandardMaterialMapper")]
public class StandardMaterialMapper : MaterialMapper
Fields
ForceShaderVariantCollection
Declaration
public bool ForceShaderVariantCollection
Field Value
Properties
ConvertMaterialTextures
Indicates whether this Material Mapper does "Metallic/Smoothness/Specular/Roughness/Emission" automatic texture creation.
Declaration
public override bool ConvertMaterialTextures { get; }
Property Value
Overrides
CutoutMaterialPreset
A cutout material preset for materials that use alpha testing
(fully transparent vs. fully opaque).
Declaration
public override Material CutoutMaterialPreset { get; }
Property Value
| Type |
Description |
| Material |
|
Overrides
CutoutMaterialPresetNoMetallicTexture
A cutout material preset for materials with no metallic texture usage.
Declaration
public override Material CutoutMaterialPresetNoMetallicTexture { get; }
Property Value
| Type |
Description |
| Material |
|
Overrides
Indicates whether this Material Mapper automatically extracts Metallic and Smoothness textures.
Declaration
public override bool ExtractMetallicAndSmoothness { get; }
Property Value
Overrides
LoadingMaterial
An optional placeholder material used while a model’s final materials and textures
are still loading.
Declaration
public override Material LoadingMaterial { get; }
Property Value
| Type |
Description |
| Material |
|
Overrides
MaterialPreset
The default (opaque) material preset.
Declaration
public override Material MaterialPreset { get; }
Property Value
| Type |
Description |
| Material |
|
Overrides
MaterialPresetNoMetallicTexture
The default (opaque) material preset for materials with no metallic texture usage.
Declaration
public override Material MaterialPresetNoMetallicTexture { get; }
Property Value
| Type |
Description |
| Material |
|
Overrides
TransparentComposeMaterialPreset
A “compose” material preset used in layered alpha workflows when
AlphaMaterialMode is set to CutoutAndTransparent.
This is applied as a secondary pass for partially transparent regions.
Declaration
public override Material TransparentComposeMaterialPreset { get; }
Property Value
| Type |
Description |
| Material |
|
Overrides
TransparentComposeMaterialPresetNoMetallicTexture
The “compose” material preset for partially transparent materials
that have no metallic texture usage.
Declaration
public override Material TransparentComposeMaterialPresetNoMetallicTexture { get; }
Property Value
| Type |
Description |
| Material |
|
Overrides
TransparentMaterialPreset
A fully transparent (alpha) material preset.
Declaration
public override Material TransparentMaterialPreset { get; }
Property Value
| Type |
Description |
| Material |
|
Overrides
TransparentMaterialPresetNoMetallicTexture
A fully transparent (alpha) material preset for materials without a metallic texture.
Declaration
public override Material TransparentMaterialPresetNoMetallicTexture { get; }
Property Value
| Type |
Description |
| Material |
|
Overrides
UseShaderVariantCollection
If overridden to return true, indicates that this mapper uses a Shader Variant
Collection instead of the usual material presets. By default, it returns false.
Declaration
public override bool UseShaderVariantCollection { get; }
Property Value
Overrides
Remarks
UsesCoroutines
Indicates whether this mapper’s Map(MaterialMapperContext) process requires an
asynchronous coroutine approach (true), or can run synchronously (false).
Declaration
public override bool UsesCoroutines { get; }
Property Value
Overrides
Remarks
Methods
ApplyDiffuseMapTexture(TextureLoadingContext)
Declaration
protected virtual IEnumerable ApplyDiffuseMapTexture(TextureLoadingContext textureLoadingContext)
Parameters
Returns
ApplyDisplacementTexture(TextureLoadingContext)
Declaration
protected virtual IEnumerable ApplyDisplacementTexture(TextureLoadingContext textureLoadingContext)
Parameters
Returns
ApplyEmissionMapTexture(TextureLoadingContext)
Declaration
protected virtual IEnumerable ApplyEmissionMapTexture(TextureLoadingContext textureLoadingContext)
Parameters
Returns
ApplyGlossinessMapTexture(TextureLoadingContext)
Declaration
protected virtual IEnumerable ApplyGlossinessMapTexture(TextureLoadingContext textureLoadingContext)
Parameters
Returns
ApplyMetallicGlossMapTexture(TextureLoadingContext)
Declaration
protected virtual IEnumerable ApplyMetallicGlossMapTexture(TextureLoadingContext textureLoadingContext)
Parameters
Returns
ApplyNormalMapTexture(TextureLoadingContext)
Declaration
protected virtual IEnumerable ApplyNormalMapTexture(TextureLoadingContext textureLoadingContext)
Parameters
Returns
ApplyOcclusionMapTexture(TextureLoadingContext)
Declaration
protected virtual IEnumerable ApplyOcclusionMapTexture(TextureLoadingContext textureLoadingContext)
Parameters
Returns
CheckDiffuseColor(MaterialMapperContext)
Declaration
protected virtual IEnumerable CheckDiffuseColor(MaterialMapperContext materialMapperContext)
Parameters
Returns
CheckDiffuseMapTexture(MaterialMapperContext)
Declaration
protected virtual IEnumerable CheckDiffuseMapTexture(MaterialMapperContext materialMapperContext)
Parameters
Returns
CheckDisplacementTexture(MaterialMapperContext)
Declaration
protected virtual IEnumerable CheckDisplacementTexture(MaterialMapperContext materialMapperContext)
Parameters
Returns
CheckEmissionColor(MaterialMapperContext)
Declaration
protected virtual IEnumerable CheckEmissionColor(MaterialMapperContext materialMapperContext)
Parameters
Returns
CheckEmissionMapTexture(MaterialMapperContext)
Declaration
protected virtual IEnumerable CheckEmissionMapTexture(MaterialMapperContext materialMapperContext)
Parameters
Returns
CheckGlossinessMapTexture(MaterialMapperContext)
Declaration
protected virtual IEnumerable CheckGlossinessMapTexture(MaterialMapperContext materialMapperContext)
Parameters
Returns
CheckGlossinessValue(MaterialMapperContext)
Declaration
protected virtual IEnumerable CheckGlossinessValue(MaterialMapperContext materialMapperContext)
Parameters
Returns
CheckMetallicGlossMapTexture(MaterialMapperContext)
Declaration
protected virtual IEnumerable CheckMetallicGlossMapTexture(MaterialMapperContext materialMapperContext)
Parameters
Returns
CheckMetallicValue(MaterialMapperContext)
Declaration
protected virtual IEnumerable CheckMetallicValue(MaterialMapperContext materialMapperContext)
Parameters
Returns
CheckNormalMapTexture(MaterialMapperContext)
Declaration
protected virtual IEnumerable CheckNormalMapTexture(MaterialMapperContext materialMapperContext)
Parameters
Returns
CheckOcclusionMapTexture(MaterialMapperContext)
Declaration
protected virtual IEnumerable CheckOcclusionMapTexture(MaterialMapperContext materialMapperContext)
Parameters
Returns
CheckSpecularMapTexture(MaterialMapperContext)
Declaration
protected virtual IEnumerable CheckSpecularMapTexture(MaterialMapperContext materialMapperContext)
Parameters
Returns
CheckTransparencyMapTexture(MaterialMapperContext)
Declaration
protected virtual IEnumerable CheckTransparencyMapTexture(MaterialMapperContext materialMapperContext)
Parameters
Returns
GetDiffuseColorName(MaterialMapperContext)
Retrieves the property name for the diffuse (albedo) color within this mapper’s target shaders.
Declaration
public override string GetDiffuseColorName(MaterialMapperContext materialMapperContext)
Parameters
| Type |
Name |
Description |
| MaterialMapperContext |
materialMapperContext |
Context containing the TriLib virtual material and Unity material references.
|
Returns
Overrides
GetDiffuseTextureName(MaterialMapperContext)
Retrieves the property name for the diffuse (albedo) texture within this mapper’s target shaders.
Declaration
public override string GetDiffuseTextureName(MaterialMapperContext materialMapperContext)
Parameters
| Type |
Name |
Description |
| MaterialMapperContext |
materialMapperContext |
Context containing the TriLib virtual material and Unity material references.
|
Returns
Overrides
GetEmissionColorName(MaterialMapperContext)
Retrieves the property name for the emissive color within this mapper’s target shaders.
Declaration
public override string GetEmissionColorName(MaterialMapperContext materialMapperContext)
Parameters
| Type |
Name |
Description |
| MaterialMapperContext |
materialMapperContext |
Context containing the TriLib virtual material and Unity material references.
|
Returns
Overrides
GetGlossinessOrRoughnessName(MaterialMapperContext)
Retrieves the property name for glossiness or roughness, depending on the shader’s workflow.
Declaration
public override string GetGlossinessOrRoughnessName(MaterialMapperContext materialMapperContext)
Parameters
| Type |
Name |
Description |
| MaterialMapperContext |
materialMapperContext |
Context containing the TriLib virtual material and Unity material references.
|
Returns
Overrides
GetGlossinessOrRoughnessTextureName(MaterialMapperContext)
Retrieves the property name for the glossiness or roughness texture, if applicable.
Declaration
public override string GetGlossinessOrRoughnessTextureName(MaterialMapperContext materialMapperContext)
Parameters
| Type |
Name |
Description |
| MaterialMapperContext |
materialMapperContext |
Context containing the TriLib virtual material and Unity material references.
|
Returns
Overrides
GetMetallicName(MaterialMapperContext)
Retrieves the property name for metallic values in PBR workflows.
Declaration
public override string GetMetallicName(MaterialMapperContext materialMapperContext)
Parameters
| Type |
Name |
Description |
| MaterialMapperContext |
materialMapperContext |
Context containing the TriLib virtual material and Unity material references.
|
Returns
Overrides
GetMetallicTextureName(MaterialMapperContext)
Retrieves the property name for the metallic texture, if used in the target shader.
Declaration
public override string GetMetallicTextureName(MaterialMapperContext materialMapperContext)
Parameters
| Type |
Name |
Description |
| MaterialMapperContext |
materialMapperContext |
Context containing the TriLib virtual material and Unity material references.
|
Returns
Overrides
IsCompatible(MaterialMapperContext)
Determines whether this mapper can handle the specified material (e.g., by checking
shader keywords, pipeline features, or other criteria). Mappers with false returns
are skipped in favor of others with higher compatibility.
Declaration
public override bool IsCompatible(MaterialMapperContext materialMapperContext)
Parameters
| Type |
Name |
Description |
| MaterialMapperContext |
materialMapperContext |
The context providing references to both the TriLib VirtualMaterial data
and the underlying Unity UnityEngine.Material.
|
Returns
| Type |
Description |
| bool |
true if compatible; otherwise false.
|
Overrides
MapCoroutine(MaterialMapperContext)
Begins the material mapping process asynchronously, yielding control back to the caller
to allow frame updates or concurrent loading. Called if UsesCoroutines
returns true.
Declaration
public override IEnumerable MapCoroutine(MaterialMapperContext materialMapperContext)
Parameters
Returns
| Type |
Description |
| IEnumerable |
An IEnumerable sequence that yields at intermediate steps for cooperative
asynchronous processing.
|
Overrides
Extension Methods