Skip to content

Game.Settings.SSAOQualitySettings

Assembly: Assembly-CSharp
Namespace: Game.Settings

Type: class

Base: QualitySetting

Summary:
SSAOQualitySettings exposes configuration and presets for Screen-Space Ambient Occlusion (SSAO) used by the HDRP ScreenSpaceAmbientOcclusion volume component. It integrates with the game's settings UI (attributes present: SettingsUIAdvanced, SettingsUISection("SSAOQualitySettings"), SettingsUIDisableByCondition) and maps quality Levels (Disabled/Low/Medium/High) to preconfigured SSAO parameter sets. The class can create or bind to a VolumeProfile's ScreenSpaceAmbientOcclusion component and apply property values such as enabled/intensity, full-resolution toggle, maximum sampling radius (pixels), and sample step count.


Fields

  • private static UnityEngine.Rendering.HighDefinition.ScreenSpaceAmbientOcclusion m_AOComponent
    A static reference to the HDRP ScreenSpaceAmbientOcclusion volume component used to apply settings. This component is created or retrieved from a provided VolumeProfile via the inherited CreateVolumeComponent call in the constructor. It is static so the same component reference is shared across instances.

Properties

  • public bool enabled { get; set; }
    Controls whether SSAO is enabled. Marked with [SettingsUIHidden], so it is present in the data model but hidden in the UI by that attribute. When false, Apply() will set the AO intensity to 0.

  • public int maxPixelRadius { get; set; }
    Maximum sampling radius in pixels for the SSAO effect. Exposed as a UI slider with range 16–256 (integer). Applied to m_AOComponent.m_MaximumRadiusInPixels.

  • public bool fullscreen { get; set; }
    When true, SSAO runs at full resolution (m_FullResolution). Applied to the AO component.

  • public int stepCount { get; set; }
    Number of steps/samples used by the SSAO algorithm. Exposed as a UI slider with range 2–32 (integer). Applied to m_AOComponent.m_StepCount.

  • private static SSAOQualitySettings highQuality { get; }

  • private static SSAOQualitySettings mediumQuality { get; }
  • private static SSAOQualitySettings lowQuality { get; }
  • private static SSAOQualitySettings disabled { get; }
    Private read-only preset properties that return configured SSAOQualitySettings instances for each quality Level. These presets are registered with QualitySetting.RegisterSetting in the static constructor so the quality system can select them automatically.

Constructors

  • static SSAOQualitySettings()
    Static constructor that registers preset instances for Level.Disabled, Level.Low, Level.Medium, and Level.High with the QualitySetting system. Ensures the quality framework knows the default settings for each quality level.

  • public SSAOQualitySettings()
    Default parameterless constructor. Initializes an empty settings object; useful when constructing programmatically.

  • public SSAOQualitySettings(Level quality, UnityEngine.Rendering.VolumeProfile profile)
    Convenience constructor that ensures the ScreenSpaceAmbientOcclusion volume component is created or retrieved from the provided VolumeProfile (via CreateVolumeComponent) and sets the instance to the specified quality level without applying the settings immediately (SetLevel(quality, apply: false)).

Methods

  • public override void Apply() : System.Void
    Applies the current SSAOQualitySettings values to the bound ScreenSpaceAmbientOcclusion volume component (m_AOComponent) if it exists. Behavior:
  • Calls base.Apply().
  • If m_AOComponent is non-null:

    • Sets intensity to 0 when enabled == false (via ApplyState).
    • Sets the m_FullResolution flag according to fullscreen.
    • Sets m_MaximumRadiusInPixels to maxPixelRadius.
    • Sets m_StepCount to stepCount. Note: ApplyState is a helper (likely provided by base class) used to change and/or animate parameter values.
  • public override bool IsOptionsDisabled() : System.Boolean
    Returns whether the options should be disabled in the UI. Logic:

  • If the base option IsOptionFullyDisabled() returns true, this returns true.
  • Otherwise returns !enabled (so options are disabled when SSAO is not enabled).

Usage Example

// Assume 'profile' is an existing VolumeProfile (e.g. obtained from a Volume component)
var ssaoSettings = new SSAOQualitySettings(Level.High, profile);

// Optionally tweak a value
ssaoSettings.maxPixelRadius = 100;
ssaoSettings.stepCount = 12;

// Apply the settings to the bound ScreenSpaceAmbientOcclusion component
ssaoSettings.Apply();

Notes: - The class depends on HDRP's ScreenSpaceAmbientOcclusion (UnityEngine.Rendering.HighDefinition) and the game's QualitySetting framework. - The SettingsUI* attributes are used by the game's UI system to control how the setting appears and when it is disabled.