Class ShadowsMidtonesHighlights
A volume component that holds settings for the Shadows, Midtones, Highlights effect.
Inherited Members
Namespace: UnityEngine .Rendering.Universal
Assembly: Unity.RenderPipelines.Universal.Runtime.dll
Syntax
[Serializable]
[VolumeComponentMenu("Post-processing/Shadows, Midtones, Highlights")]
[SupportedOnRenderPipeline(typeof(UniversalRenderPipelineAsset))]
public sealed class ShadowsMidtonesHighlights : VolumeComponent, IApplyRevertPropertyContextMenuItemProvider, IPostProcessComponent
Remarks
You can add Unity
Examples
This sample code shows how settings can be retrieved and modified in runtime:
using System;
using UnityEngine;
using UnityEngine.Rendering;
using UnityEngine.Rendering.Universal;
public class ModifyVolumeComponent : MonoBehaviour
{
[SerializeField] VolumeProfile volumeProfile;
[SerializeField] VolumeSettings volumeSettings;
private bool m_HasRetrievedVolumeComponent;
private ShadowsMidtonesHighlights m_VolumeComponent;
[Serializable]
private struct VolumeSettings
{
public bool active;
public Vector4Parameter shadows;
public Vector4Parameter midtones;
public Vector4Parameter highlights;
public MinFloatParameter shadowsStart;
public MinFloatParameter shadowsEnd;
public MinFloatParameter highlightsStart;
public MinFloatParameter highlightsEnd;
public void SetVolumeComponentSettings(ref ShadowsMidtonesHighlights volumeComponent)
{
volumeComponent.active = active;
volumeComponent.shadows = shadows;
volumeComponent.midtones = midtones;
volumeComponent.highlights = highlights;
volumeComponent.shadowsStart = shadowsStart;
volumeComponent.shadowsEnd = shadowsEnd;
volumeComponent.highlightsStart = highlightsStart;
volumeComponent.highlightsEnd = highlightsEnd;
}
public void GetVolumeComponentSettings(ref ShadowsMidtonesHighlights volumeComponent)
{
active = volumeComponent.active;
shadows = volumeComponent.shadows;
midtones = volumeComponent.midtones;
highlights = volumeComponent.highlights;
shadowsStart = volumeComponent.shadowsStart;
shadowsEnd = volumeComponent.shadowsEnd;
highlightsStart = volumeComponent.highlightsStart;
highlightsEnd = volumeComponent.highlightsEnd;
}
}
private void Start()
{
m_HasRetrievedVolumeComponent = GetVolumeComponent(in volumeProfile, ref m_VolumeComponent);
if (m_HasRetrievedVolumeComponent)
volumeSettings.GetVolumeComponentSettings(ref m_VolumeComponent);
}
private void Update()
{
if (!m_HasRetrievedVolumeComponent)
return;
volumeSettings.SetVolumeComponentSettings(ref m_VolumeComponent);
}
private static bool GetVolumeComponent(in VolumeProfile volumeProfile, ref ShadowsMidtonesHighlights volumeComponent)
{
if (volumeComponent != null)
return true;
if (volumeProfile == null)
{
Debug.LogError("ModifyVolumeComponent.GetVolumeComponent():\nvolumeProfile has not been assigned.");
return false;
}
volumeProfile.TryGet(out ShadowsMidtonesHighlights component);
if (component == null)
{
Debug.LogError($"ModifyVolumeComponent.GetVolumeComponent():\nMissing component in the \"{volumeProfile.name}\" VolumeProfile ");
return false;
}
volumeComponent = component;
return true;
}
}
Fields
highlights
Use this to control and apply a hue to the highlights.
Declaration
public Vector4Parameter highlights
Field Value
Type | Description |
---|---|
Vector4Parameter |
See Also
highlightsEnd
End point of the transition between midtones and highlights.
Declaration
[Tooltip("End point of the transition between midtones and highlights.")]
public MinFloatParameter highlightsEnd
Field Value
Type | Description |
---|---|
Min |
See Also
highlightsStart
Start point of the transition between midtones and highlights
Declaration
[Header("Highlight Limits")]
[Tooltip("Start point of the transition between midtones and highlights.")]
public MinFloatParameter highlightsStart
Field Value
Type | Description |
---|---|
Min |
See Also
midtones
Use this to control and apply a hue to the midtones.
Declaration
public Vector4Parameter midtones
Field Value
Type | Description |
---|---|
Vector4Parameter |
See Also
shadows
Use this to control and apply a hue to the shadows.
Declaration
public Vector4Parameter shadows
Field Value
Type | Description |
---|---|
Vector4Parameter |
See Also
shadowsEnd
End point of the transition between shadows and midtones.
Declaration
[Tooltip("End point of the transition between shadows and midtones.")]
public MinFloatParameter shadowsEnd
Field Value
Type | Description |
---|---|
Min |
See Also
shadowsStart
Start point of the transition between shadows and midtones.
Declaration
[Header("Shadow Limits")]
[Tooltip("Start point of the transition between shadows and midtones.")]
public MinFloatParameter shadowsStart
Field Value
Type | Description |
---|---|
Min |
See Also
Methods
IsActive()
Tells if the post process needs to be rendered or not.
Declaration
public bool IsActive()
Returns
Type | Description |
---|---|
bool |
|