Class HDRPMaterialMapper
Converts TriLib virtual materials into Unity High Definition Render Pipeline (HDRP) materials by processing various texture maps and material properties through an asynchronous coroutine pipeline.
Inherited Members
Namespace: TriLibCore.HDRP.Mappers
Assembly: Assembly-CSharp.dll
Syntax
[Serializable]
[CreateAssetMenu(menuName = "TriLib/Mappers/Material/HDRP Material Mapper", fileName = "HDRPMaterialMapper")]
public class HDRPMaterialMapper : MaterialMapper
Fields
ForceShaderVariantCollection
Declaration
public bool ForceShaderVariantCollection
Field Value
Type | Description |
---|---|
bool |
Properties
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 TriLib automatically extracts metallic and smoothness data from the source material textures. Inheritors can override this to disable the extraction step.
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
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
Type | Description |
---|---|
bool |
Overrides
Remarks
Implementers can override this to provide advanced material handling, especially when working with different pipelines or specialized shader setups.
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
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. |