Class HDMaterial
Utility class for setting properties, keywords and passes on a material to ensure it is in a valid state for rendering with HDRP.
Namespace: UnityEngine.Rendering.HighDefinition
Syntax
public static class HDMaterial
Methods
GetUseEmissiveIntensity(Material)
Compares a material's color and intensity values to determine if they are different. Works with Lit, Unlit and Decal shaders.
Declaration
public static bool GetUseEmissiveIntensity(Material material)
Parameters
Type | Name | Description |
---|---|---|
Material | material | The material to change. |
Returns
Type | Description |
---|---|
Boolean | True if the material uses different color and intensity values. |
SetAlphaClipping(Material, Boolean)
Set Alpha Clipping on Lit and Unlit shaders.
Declaration
public static void SetAlphaClipping(Material material, bool value)
Parameters
Type | Name | Description |
---|---|---|
Material | material | The material to change. |
Boolean | value | True to enable alpha clipping. |
SetAlphaCutoff(Material, Single)
Set Alpha Cutoff on Lit and Unlit shaders.
Declaration
public static void SetAlphaCutoff(Material material, float cutoff)
Parameters
Type | Name | Description |
---|---|---|
Material | material | The material to change. |
Single | cutoff | The alpha cutoff value between 0 and 1. |
SetDiffusionProfile(Material, DiffusionProfileSettings)
Set the Diffusion profile on Lit shaders.
Declaration
public static void SetDiffusionProfile(Material material, DiffusionProfileSettings profile)
Parameters
Type | Name | Description |
---|---|---|
Material | material | The material to change. |
DiffusionProfileSettings | profile | The Diffusion Profile Asset. |
SetDiffusionProfileShaderGraph(Material, DiffusionProfileSettings, String)
Set a Diffusion profile on a Shader Graph material.
Declaration
public static void SetDiffusionProfileShaderGraph(Material material, DiffusionProfileSettings profile, string referenceName)
Parameters
Type | Name | Description |
---|---|---|
Material | material | The material to change. |
DiffusionProfileSettings | profile | The Diffusion Profile Asset. |
String | referenceName | The reference name of the Diffusion Profile property in the Shader Graph. |
SetEmissiveColor(Material, Color)
Set the Emissive Color on Lit, Unlit and Decal shaders.
Declaration
public static void SetEmissiveColor(Material material, Color value)
Parameters
Type | Name | Description |
---|---|---|
Material | material | The material to change. |
Color | value | The emissive color. In LDR if the material uses a separate emissive intensity value, in HDR otherwise. |
SetEmissiveIntensity(Material, Single, EmissiveIntensityUnit)
Set the Emissive Intensity on Lit, Unlit and Decal shaders. If the material doesn't use emissive intensity, this won't have any effect.
Declaration
public static void SetEmissiveIntensity(Material material, float intensity, EmissiveIntensityUnit unit)
Parameters
Type | Name | Description |
---|---|---|
Material | material | The material to change. |
Single | intensity | The emissive intensity. |
EmissiveIntensityUnit | unit | The unit of the intensity parameter. |
SetRenderingPass(Material, HDMaterial.RenderingPass)
Set the Rendering Pass on Lit, Unlit and Shadergraph shaders.
Declaration
public static void SetRenderingPass(Material material, HDMaterial.RenderingPass value)
Parameters
Type | Name | Description |
---|---|---|
Material | material | The material to change. |
HDMaterial.RenderingPass | value | The rendering pass to set. |
SetUseEmissiveIntensity(Material, Boolean)
Set to true to use a separate LDR color and intensity value for the emission color. Compatible with Lit, Unlit and Decal shaders.
Declaration
public static void SetUseEmissiveIntensity(Material material, bool value)
Parameters
Type | Name | Description |
---|---|---|
Material | material | The material to change. |
Boolean | value | True to use separate color and intensity values. |
ValidateMaterial(Material)
Setup properties, keywords and passes on a material to ensure it is in a valid state for rendering with HDRP. This function is only for materials using HDRP Shaders.
Declaration
public static bool ValidateMaterial(Material material)
Parameters
Type | Name | Description |
---|---|---|
Material | material | The target material. |
Returns
Type | Description |
---|---|
Boolean | False if the material doesn't have an HDRP Shader. |