Class ColorLookup
A volume component that holds settings for the Color Lookup effect.
Inherited Members
Namespace: UnityEngine .Rendering.Universal
Assembly: Unity.RenderPipelines.Universal.Runtime.dll
Syntax
[Serializable]
[VolumeComponentMenu("Post-processing/Color Lookup")]
[SupportedOnRenderPipeline(typeof(UniversalRenderPipelineAsset))]
public sealed class ColorLookup : 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 ColorLookup m_VolumeComponent;
[Serializable]
private struct VolumeSettings
{
public bool active;
public TextureParameter texture;
public ClampedFloatParameter contribution;
public void SetVolumeComponentSettings(ref ColorLookup volumeComponent)
{
volumeComponent.active = active;
volumeComponent.texture = texture;
volumeComponent.contribution = contribution;
}
public void GetVolumeComponentSettings(ref ColorLookup volumeComponent)
{
active = volumeComponent.active;
texture = volumeComponent.texture;
contribution = volumeComponent.contribution;
}
}
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 ColorLookup volumeComponent)
{
if (volumeComponent != null)
return true;
if (volumeProfile == null)
{
Debug.LogError("ModifyVolumeComponent.GetVolumeComponent():\nvolumeProfile has not been assigned.");
return false;
}
volumeProfile.TryGet(out ColorLookup component);
if (component == null)
{
Debug.LogError($"ModifyVolumeComponent.GetVolumeComponent():\nMissing component in the \"{volumeProfile.name}\" VolumeProfile ");
return false;
}
volumeComponent = component;
return true;
}
}
Fields
contribution
Controls how much of the lookup texture will contribute to the color grading effect.
Declaration
[Tooltip("How much of the lookup texture will contribute to the color grading effect.")]
public ClampedFloatParameter contribution
Field Value
Type | Description |
---|---|
Clamped |
See Also
texture
A 2D Lookup Texture (LUT) to use for color grading.
Declaration
[Tooltip("A 2D Lookup Texture (LUT) to use for color grading.")]
public TextureParameter texture
Field Value
Type | Description |
---|---|
Texture |
See Also
Methods
IsActive()
Tells if the post process needs to be rendered or not.
Declaration
public bool IsActive()
Returns
Type | Description |
---|---|
bool |
|
See Also
ValidateLUT()
Validates the lookup texture assigned to the volume component.
Declaration
public bool ValidateLUT()
Returns
Type | Description |
---|---|
bool | True if the texture is valid, false otherwise. |