Class UniversalRPMaterialMapper
Converts TriLib virtual materials into Unity Universal Render Pipeline (URP) materials by processing various texture maps and material properties through an asynchronous coroutine pipeline.
Inherited Members
Namespace: TriLibCore.URP.Mappers
Assembly: Assembly-CSharp.dll
Syntax
[Serializable]
[CreateAssetMenu(menuName = "TriLib/Mappers/Material/Universal RP Material Mapper", fileName = "UniversalRPMaterialMapper")]
public class UniversalRPMaterialMapper : MaterialMapper
Properties
ConvertMaterialTextures
Indicates whether this Material Mapper does "Metallic/Smoothness/Specular/Roughness/Emission" automatic texture creation.
Declaration
public override bool ConvertMaterialTextures { get; }
Property Value
| Type | Description |
|---|---|
| bool |
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
ExtractMetallicAndSmoothness
Indicates whether this Material Mapper automatically extracts Metallic and Smoothness textures.
Declaration
public override bool ExtractMetallicAndSmoothness { get; }
Property Value
| Type | Description |
|---|---|
| bool |
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
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
TransparentMaterialPreset
A fully transparent (alpha) material preset.
Declaration
public override Material TransparentMaterialPreset { get; }
Property Value
| Type | Description |
|---|---|
| Material |
Overrides
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
| Type | Description |
|---|---|
| bool |
Overrides
Remarks
Returning true means MapCoroutine(MaterialMapperContext) will be called instead of Map(MaterialMapperContext).
Methods
ApplyGlossinessMapTexture(TextureLoadingContext)
Declaration
protected virtual IEnumerable ApplyGlossinessMapTexture(TextureLoadingContext textureLoadingContext)
Parameters
| Type | Name | Description |
|---|---|---|
| TextureLoadingContext | textureLoadingContext |
Returns
| Type | Description |
|---|---|
| IEnumerable |
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
| Type | Description |
|---|---|
| string |
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
| Type | Description |
|---|---|
| string |
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
| Type | Description |
|---|---|
| string |
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
| Type | Description |
|---|---|
| string |
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
| Type | Description |
|---|---|
| string |
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
| Type | Description |
|---|---|
| string |
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
| Type | Description |
|---|---|
| string |
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 |
Returns
| Type | Description |
|---|---|
| bool |
|
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
| Type | Name | Description |
|---|---|---|
| MaterialMapperContext | materialMapperContext | Holds references to the TriLib virtual material, the target Unity material, and the overall AssetLoaderContext. |
Returns
| Type | Description |
|---|---|
| IEnumerable | An IEnumerable sequence that yields at intermediate steps for cooperative asynchronous processing. |