Class HDCachedShadowManager
The class responsible to handle cached shadow maps (shadows with Update mode set to OnEnable or OnDemand).
Namespace: UnityEngine.Rendering.HighDefinition
Syntax
public class HDCachedShadowManager : object
Properties
instance
Get the cached shadow manager to control cached shadow maps.
Declaration
public static HDCachedShadowManager instance { get; }
Property Value
Type | Description |
---|---|
HDCachedShadowManager |
Methods
DefragAtlas(HDLightType)
If a light is added after a scene is loaded, its placement in the atlas might be not optimal and the suboptimal placement might prevent a light to find a place in the atlas. This function will force a defragmentation of the atlas containing lights of type lightType and redistributes the shadows inside so that the placement is optimal. Note however that this will also mark the shadow maps as dirty and they will be re-rendered as soon the light will come into view for the first time after this function call.
Declaration
public void DefragAtlas(HDLightType lightType)
Parameters
Type | Name | Description |
---|---|---|
HDLightType | lightType | The type of the light contained in the atlas that need defragmentation. |
ForceEvictLight(HDAdditionalLightData)
This function can be used to evict a light from its atlas. The slots occupied by such light will be available to be occupied by other shadows. Note that eviction happens automatically upon light destruction and, if lightData.preserveCachedShadow is false, upon disabling of the light.
Declaration
public void ForceEvictLight(HDAdditionalLightData lightData)
Parameters
Type | Name | Description |
---|---|---|
HDAdditionalLightData | lightData | The light to evict from the atlas. |
ForceRegisterLight(HDAdditionalLightData)
This function can be used to register a light to the cached shadow system if not already registered. It is necessary to call this function if a light has been evicted with ForceEvictLight and it needs to be registered again. Please note that a light is automatically registered when enabled or when the shadow update changes from EveryFrame to OnDemand or OnEnable.
Declaration
public void ForceRegisterLight(HDAdditionalLightData lightData)
Parameters
Type | Name | Description |
---|---|---|
HDAdditionalLightData | lightData | The light to register. |
WouldFitInAtlas(Int32, HDLightType)
This function verifies if a shadow map of resolution shadowResolution for a light of type lightType would fit in the atlas when inserted.
Declaration
public bool WouldFitInAtlas(int shadowResolution, HDLightType lightType)
Parameters
Type | Name | Description |
---|---|---|
Int32 | shadowResolution | The resolution of the hypothetical shadow map that we are assessing. |
HDLightType | lightType | The type of the light that cast the hypothetical shadow map that we are assessing. |
Returns
Type | Description |
---|---|
Boolean | True if the shadow map would fit in the atlas, false otherwise. |