using System;
namespace UnityEngine.Rendering.HighDefinition
{
///
/// Presets for the effect.
///
///
public enum FilmGrainLookup
{
///
/// Thin grain preset.
///
Thin1,
///
/// Thin grain preset.
///
Thin2,
///
/// Medium grain preset.
///
Medium1,
///
/// Medium grain preset.
///
Medium2,
///
/// Medium grain preset.
///
Medium3,
///
/// Medium grain preset.
///
Medium4,
///
/// Medium grain preset.
///
Medium5,
///
/// Medium grain preset.
///
Medium6,
///
/// Large grain preset.
///
Large01,
///
/// Large grain preset.
///
Large02,
///
/// Custom grain preset.
///
///
Custom
}
///
/// A volume component that holds settings for the Film Grain effect.
///
[Serializable, VolumeComponentMenu("Post-processing/Film Grain")]
[HelpURL(Documentation.baseURL + Documentation.version + Documentation.subURL + "Post-Processing-Film-Grain" + Documentation.endURL)]
public sealed class FilmGrain : VolumeComponent, IPostProcessComponent
{
///
/// Specifies the type of grain to use. Use to provide your own .
///
///
[Tooltip("Specifies the type of grain to use. Select a preset or select \"Custom\" to provide your own Texture.")]
public FilmGrainLookupParameter type = new FilmGrainLookupParameter(FilmGrainLookup.Thin1);
///
/// Controls the strength of the film grain effect.
///
[Tooltip("Controls the strength of the film grain effect.")]
public ClampedFloatParameter intensity = new ClampedFloatParameter(0f, 0f, 1f);
///
/// Controls the noisiness response curve. The higher you set this value, the less noise there is in brighter areas.
///
[Tooltip("Controls the noisiness response curve. The higher you set this value, the less noise there is in brighter areas.")]
public ClampedFloatParameter response = new ClampedFloatParameter(0.8f, 0f, 1f);
///
/// Specifies a tileable Texture to use for the grain. The neutral value for this Texture is 0.5 which means that HDRP does not apply grain at this value.
///
[Tooltip("Specifies a tileable Texture to use for the grain. The neutral value for this Texture is 0.5 which means that HDRP does not apply grain at this value.")]
public NoInterpTextureParameter texture = new NoInterpTextureParameter(null);
///
/// 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
&& (type.value != FilmGrainLookup.Custom || texture.value != null);
}
}
///
/// A that holds a value.
///
[Serializable]
public sealed class FilmGrainLookupParameter : VolumeParameter
{
///
/// Creates a new instance.
///
/// The initial value to store in the parameter.
/// The initial override state for the parameter.
public FilmGrainLookupParameter(FilmGrainLookup value, bool overrideState = false) : base(value, overrideState) {}
}
}