Class LiftGammaGain
A volume component that holds settings for the Lift-Gamma-Gain effect.
Inherited Members
Namespace: UnityEngine .Rendering.Universal
Assembly: Unity.RenderPipelines.Universal.Runtime.dll
Syntax
[Serializable]
[VolumeComponentMenu("Post-processing/Lift, Gamma, Gain")]
[SupportedOnRenderPipeline(typeof(UniversalRenderPipelineAsset))]
public sealed class LiftGammaGain : 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 LiftGammaGain m_VolumeComponent;
[Serializable]
private struct VolumeSettings
{
public bool active;
public Vector4Parameter lift;
public Vector4Parameter gamma;
public Vector4Parameter gain;
public void SetVolumeComponentSettings(ref LiftGammaGain volumeComponent)
{
volumeComponent.active = active;
volumeComponent.lift = lift;
volumeComponent.gamma = gamma;
volumeComponent.gain = gain;
}
public void GetVolumeComponentSettings(ref LiftGammaGain volumeComponent)
{
active = volumeComponent.active;
lift = volumeComponent.lift;
gamma = volumeComponent.gamma;
gain = volumeComponent.gain;
}
}
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 LiftGammaGain volumeComponent)
{
if (volumeComponent != null)
return true;
if (volumeProfile == null)
{
Debug.LogError("ModifyVolumeComponent.GetVolumeComponent():\nvolumeProfile has not been assigned.");
return false;
}
volumeProfile.TryGet(out LiftGammaGain component);
if (component == null)
{
Debug.LogError($"ModifyVolumeComponent.GetVolumeComponent():\nMissing component in the \"{volumeProfile.name}\" VolumeProfile ");
return false;
}
volumeComponent = component;
return true;
}
}
Fields
gain
Use this to increase and apply a hue to the signal and make highlights brighter.
Declaration
public Vector4Parameter gain
Field Value
Type | Description |
---|---|
Vector4Parameter |
See Also
gamma
Use this to control and apply a hue to the mid-range tones with a power function.
Declaration
public Vector4Parameter gamma
Field Value
Type | Description |
---|---|
Vector4Parameter |
See Also
lift
Use this to control and apply a hue to the dark tones. This has a more exaggerated effect on shadows.
Declaration
public Vector4Parameter lift
Field Value
Type | Description |
---|---|
Vector4Parameter |
See Also
Methods
IsActive()
Tells if the post process needs to be rendered or not.
Declaration
public bool IsActive()
Returns
Type | Description |
---|---|
bool |
|