Game.Prefabs.Climate.VignetteProperties
Assembly:
Assembly-CSharp (game code assembly)
Namespace:
Game.Prefabs.Climate
Type:
public class VignetteProperties
Base:
OverrideablePropertiesComponent
Summary:
Provides a wrapper of HDRP's Vignette Volume component parameters so they can be exposed and overridden by the game's weather/prefab system. When bound to a Unity Volume, this component reads (and exposes) the Vignette component's properties and forces the vignette to use the procedural mode. Intended for use by Weather prefabs to control screen vignette settings (color, center, intensity, etc.) via the game's overrideable properties framework.
Fields
-
public ColorParameter m_Color = new ColorParameter(Color.black, hdr: false, showAlpha: false, showEyeDropper: true);
Exposes the vignette color. Default is black. HDR is disabled, alpha is hidden, and the eye-dropper is enabled in the editor. -
public Vector2Parameter m_Center = new Vector2Parameter(new Vector2(0.5f, 0.5f));
Normalized center of the vignette (x,y). Default is (0.5, 0.5) — the screen center. -
public ClampedFloatParameter m_Intensity = new ClampedFloatParameter(0f, 0f, 1f);
Intensity of the vignette effect. Range 0..1, default 0 (disabled). -
public ClampedFloatParameter m_Smoothness = new ClampedFloatParameter(0.2f, 0.01f, 1f);
Smoothness/feathering of the vignette. Range 0.01..1, default 0.2. -
public ClampedFloatParameter m_Roundness = new ClampedFloatParameter(1f, 0f, 1f);
Controls roundness of the vignette shape (0 = very oval, 1 = circle). Range 0..1, default 1. -
public BoolParameter m_Rounded = new BoolParameter(value: false);
Whether the vignette is rounded (procedural rounded mask). Default is false.
Properties
- None. This component exposes its adjustable values via public Parameter fields (m_Color, m_Center, etc.) rather than C# properties.
Constructors
public VignetteProperties()
No explicit constructor is defined in the source — the default parameterless constructor is used. Field initializers set sensible defaults for each parameter as declared in the class.
Methods
-
protected override void OnBindVolumeProperties(UnityEngine.Rendering.Volume volume) : System.Void
Binds this component to a Unity Volume by ensuring a Vignette volume component exists on the given Volume, copying the Vignette component's parameters into the wrapper fields, and forcing the Vignette mode to Procedural: -
Uses VolumeHelper.GetOrCreateVolumeComponent to fetch or add the HD Vignette component.
- Copies component.color, center, intensity, smoothness, roundness, and rounded into the corresponding fields on this class.
- Calls component.mode.Override(VignetteMode.Procedural) to ensure the procedural vignette mode is used (required for some runtime controls).
This method is called by the overrideable-properties framework when the prefab or weather system needs to bind volume properties for editing or runtime application.
Usage Example
// Example: the class itself binds HD Vignette properties from a Volume.
// This is the implementation present in the source file and shows the typical usage.
protected override void OnBindVolumeProperties(Volume volume)
{
Vignette component = null;
VolumeHelper.GetOrCreateVolumeComponent(volume, ref component);
// Mirror the volume's Vignette settings into the public Parameter fields
m_Color = component.color;
m_Center = component.center;
m_Intensity = component.intensity;
m_Smoothness = component.smoothness;
m_Roundness = component.roundness;
m_Rounded = component.rounded;
// Force procedural mode to ensure the properties behave as expected
component.mode.Override(VignetteMode.Procedural);
}
Notes and tips: - This component is intended to be used as part of Weather/Prefab editing; the public Parameter fields are meant to be serialized by the prefab system and edited by designers. - Because it forces the Vignette to Procedural mode, any profile using this wrapper will get a procedural vignette (center, roundness, etc.) rather than a masked texture vignette. - The component requires HDRP's Vignette type (UnityEngine.Rendering.HighDefinition) to be available at runtime.