using System; namespace UnityEngine.Rendering.HighDefinition { /// /// Global lighting quality settings. /// [Serializable] public sealed class GlobalLightingQualitySettings { static int s_QualitySettingCount = Enum.GetNames(typeof(ScalableSettingLevelParameter.Level)).Length; internal GlobalLightingQualitySettings() { /* Ambient Occlusion */ AOStepCount[(int)ScalableSettingLevelParameter.Level.Low] = 4; AOStepCount[(int)ScalableSettingLevelParameter.Level.Medium] = 6; AOStepCount[(int)ScalableSettingLevelParameter.Level.High] = 16; AOFullRes[(int)ScalableSettingLevelParameter.Level.Low] = false; AOFullRes[(int)ScalableSettingLevelParameter.Level.Medium] = false; AOFullRes[(int)ScalableSettingLevelParameter.Level.High] = true; AOBilateralUpsample[(int)ScalableSettingLevelParameter.Level.Low] = false; AOBilateralUpsample[(int)ScalableSettingLevelParameter.Level.Medium] = true; AOBilateralUpsample[(int)ScalableSettingLevelParameter.Level.High] = true; // N/A AODirectionCount[(int)ScalableSettingLevelParameter.Level.Low] = 1; AODirectionCount[(int)ScalableSettingLevelParameter.Level.Medium] = 2; AODirectionCount[(int)ScalableSettingLevelParameter.Level.High] = 4; AOMaximumRadiusPixels[(int)ScalableSettingLevelParameter.Level.Low] = 32; AOMaximumRadiusPixels[(int)ScalableSettingLevelParameter.Level.Medium] = 40; AOMaximumRadiusPixels[(int)ScalableSettingLevelParameter.Level.High] = 80; /* Contact Shadow */ ContactShadowSampleCount[(int)ScalableSettingLevelParameter.Level.Low] = 6; ContactShadowSampleCount[(int)ScalableSettingLevelParameter.Level.Medium] = 10; ContactShadowSampleCount[(int)ScalableSettingLevelParameter.Level.High] = 16; /* Screen Space Reflection */ SSRMaxRaySteps[(int)ScalableSettingLevelParameter.Level.Low] = 16; SSRMaxRaySteps[(int)ScalableSettingLevelParameter.Level.Medium] = 32; SSRMaxRaySteps[(int)ScalableSettingLevelParameter.Level.High] = 64; /* Screen Space Global Illumination */ SSGIRaySteps[(int)ScalableSettingLevelParameter.Level.Low] = 32; SSGIRaySteps[(int)ScalableSettingLevelParameter.Level.Medium] = 64; SSGIRaySteps[(int)ScalableSettingLevelParameter.Level.High] = 96; SSGIFullResolution[(int)ScalableSettingLevelParameter.Level.Low] = false; SSGIFullResolution[(int)ScalableSettingLevelParameter.Level.Medium] = true; SSGIFullResolution[(int)ScalableSettingLevelParameter.Level.High] = true; SSGIFilterRadius[(int)ScalableSettingLevelParameter.Level.Low] = 3; SSGIFilterRadius[(int)ScalableSettingLevelParameter.Level.Medium] = 5; SSGIFilterRadius[(int)ScalableSettingLevelParameter.Level.High] = 7; // Ray Traced Ambient Occlusion RTAORayLength[(int)ScalableSettingLevelParameter.Level.Low] = 0.5f; RTAORayLength[(int)ScalableSettingLevelParameter.Level.Medium] = 3.0f; RTAORayLength[(int)ScalableSettingLevelParameter.Level.High] = 20.0f; RTAOSampleCount[(int)ScalableSettingLevelParameter.Level.Low] = 1; RTAOSampleCount[(int)ScalableSettingLevelParameter.Level.Medium] = 2; RTAOSampleCount[(int)ScalableSettingLevelParameter.Level.High] = 8; RTAODenoise[(int)ScalableSettingLevelParameter.Level.Low] = true; RTAODenoise[(int)ScalableSettingLevelParameter.Level.Medium] = true; RTAODenoise[(int)ScalableSettingLevelParameter.Level.High] = true; RTAODenoiserRadius[(int)ScalableSettingLevelParameter.Level.Low] = 0.25f; RTAODenoiserRadius[(int)ScalableSettingLevelParameter.Level.Medium] = 0.5f; RTAODenoiserRadius[(int)ScalableSettingLevelParameter.Level.High] = 0.65f; // RTGI RTGIRayLength[(int)ScalableSettingLevelParameter.Level.Low] = 50.0f; RTGIRayLength[(int)ScalableSettingLevelParameter.Level.Medium] = 50.0f; RTGIRayLength[(int)ScalableSettingLevelParameter.Level.High] = 50.0f; RTGIFullResolution[(int)ScalableSettingLevelParameter.Level.Low] = false; RTGIFullResolution[(int)ScalableSettingLevelParameter.Level.Medium] = false; RTGIFullResolution[(int)ScalableSettingLevelParameter.Level.High] = true; RTGIClampValue[(int)ScalableSettingLevelParameter.Level.Low] = 0.5f; RTGIClampValue[(int)ScalableSettingLevelParameter.Level.Medium] = 0.8f; RTGIClampValue[(int)ScalableSettingLevelParameter.Level.High] = 1.5f; RTGIUpScaleRadius[(int)ScalableSettingLevelParameter.Level.Low] = 4; RTGIUpScaleRadius[(int)ScalableSettingLevelParameter.Level.Medium] = 4; RTGIUpScaleRadius[(int)ScalableSettingLevelParameter.Level.High] = 4; RTGIDenoise[(int)ScalableSettingLevelParameter.Level.Low] = true; RTGIDenoise[(int)ScalableSettingLevelParameter.Level.Medium] = true; RTGIDenoise[(int)ScalableSettingLevelParameter.Level.High] = true; RTGIHalfResDenoise[(int)ScalableSettingLevelParameter.Level.Low] = true; RTGIHalfResDenoise[(int)ScalableSettingLevelParameter.Level.Medium] = false; RTGIHalfResDenoise[(int)ScalableSettingLevelParameter.Level.High] = false; RTGIDenoiserRadius[(int)ScalableSettingLevelParameter.Level.Low] = 0.75f; RTGIDenoiserRadius[(int)ScalableSettingLevelParameter.Level.Medium] = 0.5f; RTGIDenoiserRadius[(int)ScalableSettingLevelParameter.Level.High] = 0.25f; RTGISecondDenoise[(int)ScalableSettingLevelParameter.Level.Low] = true; RTGISecondDenoise[(int)ScalableSettingLevelParameter.Level.Medium] = true; RTGISecondDenoise[(int)ScalableSettingLevelParameter.Level.High] = true; // RTR RTRMinSmoothness[(int)ScalableSettingLevelParameter.Level.Low] = 0.6f; RTRMinSmoothness[(int)ScalableSettingLevelParameter.Level.Medium] = 0.4f; RTRMinSmoothness[(int)ScalableSettingLevelParameter.Level.High] = 0.0f; RTRSmoothnessFadeStart[(int)ScalableSettingLevelParameter.Level.Low] = 0.7f; RTRSmoothnessFadeStart[(int)ScalableSettingLevelParameter.Level.Medium] = 0.5f; RTRSmoothnessFadeStart[(int)ScalableSettingLevelParameter.Level.High] = 0.0f; RTRRayLength[(int)ScalableSettingLevelParameter.Level.Low] = 50.0f; RTRRayLength[(int)ScalableSettingLevelParameter.Level.Medium] = 50.0f; RTRRayLength[(int)ScalableSettingLevelParameter.Level.High] = 50.0f; RTRClampValue[(int)ScalableSettingLevelParameter.Level.Low] = 0.8f; RTRClampValue[(int)ScalableSettingLevelParameter.Level.Medium] = 1.0f; RTRClampValue[(int)ScalableSettingLevelParameter.Level.High] = 1.2f; RTRFullResolution[(int)ScalableSettingLevelParameter.Level.Low] = false; RTRFullResolution[(int)ScalableSettingLevelParameter.Level.Medium] = false; RTRFullResolution[(int)ScalableSettingLevelParameter.Level.High] = true; RTRDenoise[(int)ScalableSettingLevelParameter.Level.Low] = true; RTRDenoise[(int)ScalableSettingLevelParameter.Level.Medium] = true; RTRDenoise[(int)ScalableSettingLevelParameter.Level.High] = true; RTRDenoiserRadius[(int)ScalableSettingLevelParameter.Level.Low] = 8; RTRDenoiserRadius[(int)ScalableSettingLevelParameter.Level.Medium] = 12; RTRDenoiserRadius[(int)ScalableSettingLevelParameter.Level.High] = 16; RTRSmoothDenoising[(int)ScalableSettingLevelParameter.Level.Low] = true; RTRSmoothDenoising[(int)ScalableSettingLevelParameter.Level.Medium] = false; RTRSmoothDenoising[(int)ScalableSettingLevelParameter.Level.High] = false; // Fog Fog_ControlMode[(int)ScalableSettingLevelParameter.Level.Low] = FogControl.Balance; Fog_ControlMode[(int)ScalableSettingLevelParameter.Level.Medium] = FogControl.Balance; Fog_ControlMode[(int)ScalableSettingLevelParameter.Level.High] = FogControl.Balance; Fog_Budget[(int)ScalableSettingLevelParameter.Level.Low] = 0.166f; Fog_Budget[(int)ScalableSettingLevelParameter.Level.Medium] = 0.33f; Fog_Budget[(int)ScalableSettingLevelParameter.Level.High] = 0.666f; Fog_DepthRatio[(int)ScalableSettingLevelParameter.Level.Low] = 0.666f; Fog_DepthRatio[(int)ScalableSettingLevelParameter.Level.Medium] = 0.666f; Fog_DepthRatio[(int)ScalableSettingLevelParameter.Level.High] = 0.50f; } internal static GlobalLightingQualitySettings NewDefault() => new GlobalLightingQualitySettings(); // SSAO /// Ambient Occlusion step count for each quality level. public int[] AOStepCount = new int[s_QualitySettingCount]; /// Ambient Occlusion uses full resolution buffer for each quality level. public bool[] AOFullRes = new bool[s_QualitySettingCount]; /// Ambient Occlusion maximum radius for each quality level. public int[] AOMaximumRadiusPixels = new int[s_QualitySettingCount]; /// Ambient Occlusion uses bilateral upsample for each quality level. public bool[] AOBilateralUpsample = new bool[s_QualitySettingCount]; /// Ambient Occlusion direction count for each quality level. public int[] AODirectionCount = new int[s_QualitySettingCount]; // Contact Shadows /// Contact shadow sample count for each quality level. public int[] ContactShadowSampleCount = new int[s_QualitySettingCount]; // Screen Space Reflections /// Maximum number of rays for Screen Space Reflection for each quality level. public int[] SSRMaxRaySteps = new int[s_QualitySettingCount]; // Screen Space Global Illumination /// Screen space global illumination step count for the ray marching. [NonSerialized] public int[] SSGIRaySteps = new int[s_QualitySettingCount]; /// Screen space global illumination's world space maximal radius. [NonSerialized] public float[] SSGIRadius = new float[s_QualitySettingCount]; /// Screen space global illumination flag to define if the effect is computed at full resolution. [NonSerialized] public bool[] SSGIFullResolution = new bool[s_QualitySettingCount]; /// Screen space global illumination signal clamping value. [NonSerialized] public float[] SSGIClampValue = new float[s_QualitySettingCount]; /// Screen space global illumination's filter size. [NonSerialized] public int[] SSGIFilterRadius = new int[s_QualitySettingCount]; // Ray Traced Ambient Occlusion /// Controls the length of ray traced ambient occlusion rays. public float[] RTAORayLength = new float[s_QualitySettingCount]; /// Number of samples for evaluating the effect. public int[] RTAOSampleCount = new int[s_QualitySettingCount]; /// Defines if the ray traced ambient occlusion should be denoised. public bool[] RTAODenoise = new bool[s_QualitySettingCount]; /// Controls the radius of the ray traced ambient occlusion denoiser. public float[] RTAODenoiserRadius = new float[s_QualitySettingCount]; // Ray Traced Global Illumination /// Controls the length of ray traced global illumination rays. public float[] RTGIRayLength = new float[s_QualitySettingCount]; /// Controls if the effect should be computed at full resolution. public bool[] RTGIFullResolution = new bool[s_QualitySettingCount]; /// Clamp value used to reduce the variance in the integration signal. public float[] RTGIClampValue = new float[s_QualitySettingCount]; /// Radius for the up-sample pass. public int[] RTGIUpScaleRadius = new int[s_QualitySettingCount]; /// Flag that enables the first denoising pass. public bool[] RTGIDenoise = new bool[s_QualitySettingCount]; /// Flag that defines if the denoiser should be evaluated at half resolution. public bool[] RTGIHalfResDenoise = new bool[s_QualitySettingCount]; /// Flag that defines the radius of the first denoiser. public float[] RTGIDenoiserRadius = new float[s_QualitySettingCount]; /// Flag that enables the second denoising pass. public bool[] RTGISecondDenoise = new bool[s_QualitySettingCount]; // Ray Traced Reflections /// Controls the minimal smoothness. public float[] RTRMinSmoothness = new float[s_QualitySettingCount]; /// Controls the minimal smoothness. public float[] RTRSmoothnessFadeStart = new float[s_QualitySettingCount]; /// Controls the length of ray traced reflection rays. public float[] RTRRayLength = new float[s_QualitySettingCount]; /// Clamp value used to reduce the variance in the integration signal. public float[] RTRClampValue = new float[s_QualitySettingCount]; /// Controls if the effect should be computed at full resolution. public bool[] RTRFullResolution = new bool[s_QualitySettingCount]; /// Flag that enables the first denoising pass. public bool[] RTRDenoise = new bool[s_QualitySettingCount]; /// Flag that defines the radius of the first denoiser. public int[] RTRDenoiserRadius = new int[s_QualitySettingCount]; /// Flag that defines smooth denoising status. public bool[] RTRSmoothDenoising = new bool[s_QualitySettingCount]; // TODO: Volumetric fog quality /// Controls which control mode should be used to define the volumetric fog parameters. public FogControl[] Fog_ControlMode = new FogControl[s_QualitySettingCount]; /// Controls the budget of the volumetric fog effect. public float[] Fog_Budget = new float[s_QualitySettingCount]; /// Controls how the budget is shared between screen resolution and depth. public float[] Fog_DepthRatio = new float[s_QualitySettingCount]; // TODO: Shadows. This needs to be discussed further as there is an idiosyncracy here as we have different level of quality settings, //some for resolution per light (4 levels) some per volume (which are 3 levels everywhere). This needs to be discussed more. } }