Skip to content

Game.VolumetricsQualitySettings

Assembly: Assembly-CSharp.dll
Namespace: Game.Settings

Type: class

Base: QualitySetting

Summary:
VolumetricsQualitySettings is a quality-setting wrapper used by the game's settings UI to control HDRP volumetric fog parameters. It exposes UI attributes (sliders and hidden flags) for toggling volumetrics and tuning a budget and depth-resolution ratio. The class caches a static HDRP Fog volume component (UnityEngine.Rendering.HighDefinition.Fog), provides preset values for Disabled/Low/Medium/High quality levels, and registers those presets with the QualitySetting base class in its static constructor. It relies on base-class helpers such as CreateVolumeComponent, SetLevel and ApplyState to manipulate the volume component and to integrate with the game's settings system.


Fields

  • private static Fog m_FogComponent
    Static cached reference to the HDRP Fog volume component (UnityEngine.Rendering.HighDefinition.Fog). The component is created/found via CreateVolumeComponent when an instance is constructed with a VolumeProfile. This is shared across instances of VolumetricsQualitySettings to avoid repeated lookups.

Properties

  • public bool enabled { get; set; }
    Controls whether volumetric fog is enabled. Marked with [SettingsUIHidden] in source (hidden in some UI contexts). Used by Apply() and IsOptionsDisabled() to determine runtime state.

  • public float budget { get; set; }
    A slider-exposed value (SettingsUISlider) representing the volumetric fog budget. Range: 0.001 — 1.0, step 0.1. Applied to m_FogComponent.m_VolumetricFogBudget when the fog component is available.

  • public float resolutionDepthRatio { get; set; }
    A slider-exposed value (SettingsUISlider) representing the resolution/depth ratio for volumetrics. Range: 0.001 — 1.0, step 0.1. Applied to m_FogComponent.m_ResolutionDepthRatio when the fog component is available.

Constructors

  • public VolumetricsQualitySettings()
    Default parameterless constructor. Initializes a new settings object (fields defaulted). Presets are provided via the static constructor.

  • public VolumetricsQualitySettings(Level quality, VolumeProfile profile)
    Constructs the settings and ensures the HDRP Fog volume component is created/cached from the provided VolumeProfile (via CreateVolumeComponent). Calls SetLevel(quality, apply: false) to initialize property values from the registered preset for the given quality level without immediately applying them to the volume component.

  • static VolumetricsQualitySettings()
    Static constructor that registers preset instances for Level.Disabled, Level.Low, Level.Medium, and Level.High with the QualitySetting base class. Presets initialize budget, resolutionDepthRatio and enabled according to intended quality.

Methods

  • public override void Apply()
    Applies this setting to the cached HDRP Fog component if available. Uses the base class ApplyState helper to set:
  • m_FogComponent.enableVolumetricFog <- enabled
  • m_FogComponent.m_VolumetricFogBudget <- budget
  • m_FogComponent.m_ResolutionDepthRatio <- resolutionDepthRatio Also calls base.Apply() to execute any base-class behavior.

  • public override bool IsOptionsDisabled()
    Returns whether the UI options for this setting should be disabled. If the option is "fully disabled" (as determined by the base class IsOptionFullyDisabled), returns true. Otherwise returns the inverse of enabled (i.e., options are disabled when volumetrics are turned off).

Usage Example

// Create from a VolumeProfile (e.g. from a loaded/custom profile) and set a quality
var profile = /* obtain a UnityEngine.Rendering.VolumeProfile instance */;
var settings = new VolumetricsQualitySettings(Level.High, profile);

// Optionally tweak values
settings.budget = 0.75f;
settings.resolutionDepthRatio = 0.5f;
settings.enabled = true;

// Apply to the HDRP Fog component (if the component was found/created)
settings.Apply();