using System; using UnityEngine.Serialization; namespace UnityEngine.Rendering.HighDefinition { /// /// A volume component that holds settings for the Chromatic Aberration effect. /// [Serializable, VolumeComponentMenu("Post-processing/Chromatic Aberration")] [SupportedOnRenderPipeline(typeof(HDRenderPipelineAsset))] [HDRPHelpURL("Post-Processing-Chromatic-Aberration")] public sealed class ChromaticAberration : VolumeComponentWithQuality, IPostProcessComponent { /// /// Specifies a Texture which HDRP uses to shift the hue of chromatic aberrations. /// [Tooltip("Specifies a Texture which HDRP uses to shift the hue of chromatic aberrations.")] public Texture2DParameter spectralLut = new Texture2DParameter(null); /// /// Controls the strength of the chromatic aberration effect. /// [Tooltip("Use the slider to set the strength of the Chromatic Aberration effect.")] public ClampedFloatParameter intensity = new ClampedFloatParameter(0f, 0f, 1f); /// /// Controls the maximum number of samples HDRP uses to render the effect. A lower sample number results in better performance. /// public int maxSamples { get { if (!UsesQualitySettings()) { return m_MaxSamples.value; } else { int qualityLevel = (int)quality.levelAndOverride.level; return GetPostProcessingQualitySettings().ChromaticAberrationMaxSamples[qualityLevel]; } } set { m_MaxSamples.value = value; } } [Tooltip("Controls the maximum number of samples HDRP uses to render the effect. A lower sample number results in better performance.")] [SerializeField, FormerlySerializedAs("maxSamples")] private ClampedIntParameter m_MaxSamples = new ClampedIntParameter(6, 3, 24); /// /// Tells if the effect needs to be rendered or not. /// /// true if the effect should be rendered, false otherwise. public bool IsActive() { return intensity.value > 0f; } } }