123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226 |
- using System;
- namespace UnityEngine.PostProcessing
- {
- [Serializable]
- public class AntialiasingModel : PostProcessingModel
- {
- public AntialiasingModel.Settings settings
- {
- get
- {
- return this.m_Settings;
- }
- set
- {
- this.m_Settings = value;
- }
- }
- public override void Reset()
- {
- this.m_Settings = AntialiasingModel.Settings.defaultSettings;
- }
- [SerializeField]
- private AntialiasingModel.Settings m_Settings = AntialiasingModel.Settings.defaultSettings;
- public enum Method
- {
- Fxaa,
- Taa
- }
- public enum FxaaPreset
- {
- ExtremePerformance,
- Performance,
- Default,
- Quality,
- ExtremeQuality
- }
- [Serializable]
- public struct FxaaQualitySettings
- {
- [Tooltip("The amount of desired sub-pixel aliasing removal. Effects the sharpeness of the output.")]
- [Range(0f, 1f)]
- public float subpixelAliasingRemovalAmount;
- [Tooltip("The minimum amount of local contrast required to qualify a region as containing an edge.")]
- [Range(0.063f, 0.333f)]
- public float edgeDetectionThreshold;
- [Tooltip("Local contrast adaptation value to disallow the algorithm from executing on the darker regions.")]
- [Range(0f, 0.0833f)]
- public float minimumRequiredLuminance;
- public static AntialiasingModel.FxaaQualitySettings[] presets = new AntialiasingModel.FxaaQualitySettings[]
- {
- new AntialiasingModel.FxaaQualitySettings
- {
- subpixelAliasingRemovalAmount = 0f,
- edgeDetectionThreshold = 0.333f,
- minimumRequiredLuminance = 0.0833f
- },
- new AntialiasingModel.FxaaQualitySettings
- {
- subpixelAliasingRemovalAmount = 0.25f,
- edgeDetectionThreshold = 0.25f,
- minimumRequiredLuminance = 0.0833f
- },
- new AntialiasingModel.FxaaQualitySettings
- {
- subpixelAliasingRemovalAmount = 0.75f,
- edgeDetectionThreshold = 0.166f,
- minimumRequiredLuminance = 0.0833f
- },
- new AntialiasingModel.FxaaQualitySettings
- {
- subpixelAliasingRemovalAmount = 1f,
- edgeDetectionThreshold = 0.125f,
- minimumRequiredLuminance = 0.0625f
- },
- new AntialiasingModel.FxaaQualitySettings
- {
- subpixelAliasingRemovalAmount = 1f,
- edgeDetectionThreshold = 0.063f,
- minimumRequiredLuminance = 0.0312f
- }
- };
- }
- [Serializable]
- public struct FxaaConsoleSettings
- {
- [Tooltip("The amount of spread applied to the sampling coordinates while sampling for subpixel information.")]
- [Range(0.33f, 0.5f)]
- public float subpixelSpreadAmount;
- [Tooltip("This value dictates how sharp the edges in the image are kept; a higher value implies sharper edges.")]
- [Range(2f, 8f)]
- public float edgeSharpnessAmount;
- [Tooltip("The minimum amount of local contrast required to qualify a region as containing an edge.")]
- [Range(0.125f, 0.25f)]
- public float edgeDetectionThreshold;
- [Tooltip("Local contrast adaptation value to disallow the algorithm from executing on the darker regions.")]
- [Range(0.04f, 0.06f)]
- public float minimumRequiredLuminance;
- public static AntialiasingModel.FxaaConsoleSettings[] presets = new AntialiasingModel.FxaaConsoleSettings[]
- {
- new AntialiasingModel.FxaaConsoleSettings
- {
- subpixelSpreadAmount = 0.33f,
- edgeSharpnessAmount = 8f,
- edgeDetectionThreshold = 0.25f,
- minimumRequiredLuminance = 0.06f
- },
- new AntialiasingModel.FxaaConsoleSettings
- {
- subpixelSpreadAmount = 0.33f,
- edgeSharpnessAmount = 8f,
- edgeDetectionThreshold = 0.125f,
- minimumRequiredLuminance = 0.06f
- },
- new AntialiasingModel.FxaaConsoleSettings
- {
- subpixelSpreadAmount = 0.5f,
- edgeSharpnessAmount = 8f,
- edgeDetectionThreshold = 0.125f,
- minimumRequiredLuminance = 0.05f
- },
- new AntialiasingModel.FxaaConsoleSettings
- {
- subpixelSpreadAmount = 0.5f,
- edgeSharpnessAmount = 4f,
- edgeDetectionThreshold = 0.125f,
- minimumRequiredLuminance = 0.04f
- },
- new AntialiasingModel.FxaaConsoleSettings
- {
- subpixelSpreadAmount = 0.5f,
- edgeSharpnessAmount = 2f,
- edgeDetectionThreshold = 0.125f,
- minimumRequiredLuminance = 0.04f
- }
- };
- }
- [Serializable]
- public struct FxaaSettings
- {
- public static AntialiasingModel.FxaaSettings defaultSettings
- {
- get
- {
- return new AntialiasingModel.FxaaSettings
- {
- preset = AntialiasingModel.FxaaPreset.Default
- };
- }
- }
- public AntialiasingModel.FxaaPreset preset;
- }
- [Serializable]
- public struct TaaSettings
- {
- public static AntialiasingModel.TaaSettings defaultSettings
- {
- get
- {
- return new AntialiasingModel.TaaSettings
- {
- jitterSpread = 0.75f,
- sharpen = 0.3f,
- stationaryBlending = 0.95f,
- motionBlending = 0.85f
- };
- }
- }
- [Tooltip("The diameter (in texels) inside which jitter samples are spread. Smaller values result in crisper but more aliased output, while larger values result in more stable but blurrier output.")]
- [Range(0.1f, 1f)]
- public float jitterSpread;
- [Tooltip("Controls the amount of sharpening applied to the color buffer.")]
- [Range(0f, 3f)]
- public float sharpen;
- [Tooltip("The blend coefficient for a stationary fragment. Controls the percentage of history sample blended into the final color.")]
- [Range(0f, 0.99f)]
- public float stationaryBlending;
- [Tooltip("The blend coefficient for a fragment with significant motion. Controls the percentage of history sample blended into the final color.")]
- [Range(0f, 0.99f)]
- public float motionBlending;
- }
- [Serializable]
- public struct Settings
- {
- public static AntialiasingModel.Settings defaultSettings
- {
- get
- {
- return new AntialiasingModel.Settings
- {
- method = AntialiasingModel.Method.Fxaa,
- fxaaSettings = AntialiasingModel.FxaaSettings.defaultSettings,
- taaSettings = AntialiasingModel.TaaSettings.defaultSettings
- };
- }
- }
- public AntialiasingModel.Method method;
- public AntialiasingModel.FxaaSettings fxaaSettings;
- public AntialiasingModel.TaaSettings taaSettings;
- }
- }
- }
|