using System; namespace UnityEngine.Rendering.Universal { /// /// 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")] [SupportedOnRenderPipeline(typeof(UniversalRenderPipelineAsset))] [URPHelpURL("Post-Processing-Film-Grain")] public sealed class FilmGrain : VolumeComponent, IPostProcessComponent { /// /// The type of grain to use. You can select a preset or provide your own texture by selecting Custom. /// [Tooltip("The type of grain to use. You can select a preset or provide your own texture by selecting Custom.")] public FilmGrainLookupParameter type = new FilmGrainLookupParameter(FilmGrainLookup.Thin1); /// /// Use this to set the strength of the Film Grain effect. /// [Tooltip("Use the slider to set the strength of the Film Grain effect.")] public ClampedFloatParameter intensity = new ClampedFloatParameter(0f, 0f, 1f); /// /// Controls the noisiness response curve based on scene luminance. Higher values mean less noise in light areas. /// [Tooltip("Controls the noisiness response curve based on scene luminance. Higher values mean less noise in light areas.")] public ClampedFloatParameter response = new ClampedFloatParameter(0.8f, 0f, 1f); /// /// A tileable texture to use for the grain. The neutral value is 0.5 where no grain is applied /// [Tooltip("A tileable texture to use for the grain. The neutral value is 0.5 where no grain is applied.")] public NoInterpTextureParameter texture = new NoInterpTextureParameter(null); /// public bool IsActive() => intensity.value > 0f && (type.value != FilmGrainLookup.Custom || texture.value != null); /// [Obsolete("Unused #from(2023.1)", false)] public bool IsTileCompatible() => true; } /// /// 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) { } } }