You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
60 lines
2.4 KiB
60 lines
2.4 KiB
using System;
|
|
using UnityEngine.Serialization;
|
|
|
|
namespace UnityEngine.Rendering.HighDefinition
|
|
{
|
|
/// <summary>
|
|
/// A volume component that holds settings for the Chromatic Aberration effect.
|
|
/// </summary>
|
|
[Serializable, VolumeComponentMenu("Post-processing/Chromatic Aberration")]
|
|
[SupportedOnRenderPipeline(typeof(HDRenderPipelineAsset))]
|
|
[HDRPHelpURL("Post-Processing-Chromatic-Aberration")]
|
|
|
|
public sealed class ChromaticAberration : VolumeComponentWithQuality, IPostProcessComponent
|
|
{
|
|
/// <summary>
|
|
/// Specifies a Texture which HDRP uses to shift the hue of chromatic aberrations.
|
|
/// </summary>
|
|
[Tooltip("Specifies a Texture which HDRP uses to shift the hue of chromatic aberrations.")]
|
|
public Texture2DParameter spectralLut = new Texture2DParameter(null);
|
|
|
|
/// <summary>
|
|
/// Controls the strength of the chromatic aberration effect.
|
|
/// </summary>
|
|
[Tooltip("Use the slider to set the strength of the Chromatic Aberration effect.")]
|
|
public ClampedFloatParameter intensity = new ClampedFloatParameter(0f, 0f, 1f);
|
|
|
|
/// <summary>
|
|
/// Controls the maximum number of samples HDRP uses to render the effect. A lower sample number results in better performance.
|
|
/// </summary>
|
|
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);
|
|
|
|
/// <summary>
|
|
/// Tells if the effect needs to be rendered or not.
|
|
/// </summary>
|
|
/// <returns><c>true</c> if the effect should be rendered, <c>false</c> otherwise.</returns>
|
|
public bool IsActive()
|
|
{
|
|
return intensity.value > 0f;
|
|
}
|
|
}
|
|
}
|