Class ProbeReferenceVolume
The reference volume for the Adaptive Probe Volumes system. This defines the structure in which volume assets are loaded into. There must be only one, hence why it follow a singleton pattern.
Inherited Members
Namespace: UnityEngine.Rendering
Assembly: Unity.RenderPipelines.Core.Runtime.dll
Syntax
public class ProbeReferenceVolume
Fields
checksDuringBakeAction
An action that is used by the SRP to perform checks every frame during baking.
Declaration
public Action checksDuringBakeAction
Field Value
| Type | Description |
|---|---|
| Action |
k_DebugPanelName
Name of debug panel for Probe Volume
Declaration
public static readonly string k_DebugPanelName
Field Value
| Type | Description |
|---|---|
| string |
retrieveExtraDataAction
An action that is used by the SRP to retrieve extra data that was baked together with the bake
Declaration
public Action<ProbeReferenceVolume.ExtraDataActionInput> retrieveExtraDataAction
Field Value
| Type | Description |
|---|---|
| Action<ProbeReferenceVolume.ExtraDataActionInput> |
Properties
currentBakingSet
The active baking set.
Declaration
public ProbeVolumeBakingSet currentBakingSet { get; }
Property Value
| Type | Description |
|---|---|
| ProbeVolumeBakingSet |
instance
Get the instance of the probe reference volume (singleton).
Declaration
public static ProbeReferenceVolume instance { get; }
Property Value
| Type | Description |
|---|---|
| ProbeReferenceVolume |
isInitialized
Is Probe Volume initialized.
Declaration
public bool isInitialized { get; }
Property Value
| Type | Description |
|---|---|
| bool |
lightingScenario
The active lighting scenario.
Declaration
public string lightingScenario { get; set; }
Property Value
| Type | Description |
|---|---|
| string |
loadMaxCellsPerFrame
Set to true to stream as many cells as possible every frame.
Declaration
public bool loadMaxCellsPerFrame { get; set; }
Property Value
| Type | Description |
|---|---|
| bool |
memoryBudget
Get the memory budget for the Probe Volume system.
Declaration
public ProbeVolumeTextureMemoryBudget memoryBudget { get; }
Property Value
| Type | Description |
|---|---|
| ProbeVolumeTextureMemoryBudget |
numberOfCellsBlendedPerFrame
Maximum number of cells that are blended per frame.
Declaration
public int numberOfCellsBlendedPerFrame { get; set; }
Property Value
| Type | Description |
|---|---|
| int |
otherScenario
The lighting scenario APV is blending toward.
Declaration
public string otherScenario { get; }
Property Value
| Type | Description |
|---|---|
| string |
probeOcclusion
Whether APV stores occlusion for mixed lights.
Declaration
public bool probeOcclusion { get; }
Property Value
| Type | Description |
|---|---|
| bool |
scenarioBlendingFactor
The blending factor currently used to blend probe data. A value of 0 means blending is not active.
Declaration
public float scenarioBlendingFactor { get; set; }
Property Value
| Type | Description |
|---|---|
| float |
shBands
Declaration
public ProbeVolumeSHBands shBands { get; }
Property Value
| Type | Description |
|---|---|
| ProbeVolumeSHBands |
skyOcclusion
Whether APV handles sky dynamically (with baked sky occlusion) or fully statically.
Declaration
public bool skyOcclusion { get; }
Property Value
| Type | Description |
|---|---|
| bool |
skyOcclusionShadingDirection
Bake sky shading direction.
Declaration
public bool skyOcclusionShadingDirection { get; }
Property Value
| Type | Description |
|---|---|
| bool |
subdivisionDebugColors
Colors that can be used for debug visualization of the brick structure subdivision.
Declaration
public Color[] subdivisionDebugColors { get; }
Property Value
| Type | Description |
|---|---|
| Color[] |
turnoverRate
Percentage of cells loaded in the blending pool that can be replaced by out of date cells.
Declaration
public float turnoverRate { get; set; }
Property Value
| Type | Description |
|---|---|
| float |
Methods
BindAPVRuntimeResources(CommandBuffer, bool)
Bind the global APV resources
Declaration
public void BindAPVRuntimeResources(CommandBuffer cmdBuffer, bool isProbeVolumeEnabled)
Parameters
| Type | Name | Description |
|---|---|---|
| CommandBuffer | cmdBuffer | Command buffer |
| bool | isProbeVolumeEnabled | True if APV is enabled |
BlendLightingScenario(string, float)
Allows smooth transitions between two lighting scenarios. This only affects the runtime data used for lighting.
Declaration
public void BlendLightingScenario(string otherScenario, float blendingFactor)
Parameters
| Type | Name | Description |
|---|---|---|
| string | otherScenario | The name of the scenario to load. |
| float | blendingFactor | The factor used to interpolate between the active scenario and otherScenario. Accepted values range from 0 to 1 and will progressively blend from the active scenario to otherScenario. |
Cleanup()
Cleanup the Probe Volume system.
Declaration
public void Cleanup()
DataHasBeenLoaded()
Returns whether any brick data has been loaded.
Declaration
public bool DataHasBeenLoaded()
Returns
| Type | Description |
|---|---|
| bool | True if brick data is present, otherwise false. |
EnableMaxCellStreaming(bool)
Enable streaming as many cells per frame as possible.
Declaration
public void EnableMaxCellStreaming(bool value)
Parameters
| Type | Name | Description |
|---|---|---|
| bool | value | True to enable streaming as many cells per frame as possible. |
GetProbeSamplingDebugResources(Camera, out GraphicsBuffer, out Vector2)
Returns the resources used for APV probe sampling debug mode
Declaration
public bool GetProbeSamplingDebugResources(Camera camera, out GraphicsBuffer resultBuffer, out Vector2 coords)
Parameters
| Type | Name | Description |
|---|---|---|
| Camera | camera | The camera for which to evaluate the debug mode |
| GraphicsBuffer | resultBuffer | The buffer that should be filled with position and normal |
| Vector2 | coords | The screen space coords to sample the position and normal |
Returns
| Type | Description |
|---|---|
| bool | True if the pipeline should write position and normal at coords in resultBuffer |
GetRuntimeResources()
Get the resources that are bound to the runtime shaders for sampling Adaptive Probe Volume data.
Declaration
public ProbeReferenceVolume.RuntimeResources GetRuntimeResources()
Returns
| Type | Description |
|---|---|
| ProbeReferenceVolume.RuntimeResources | The resources to bind to runtime shaders. |
GetVideoMemoryCost()
Get approximate video memory impact, in bytes, of the system.
Declaration
public int GetVideoMemoryCost()
Returns
| Type | Description |
|---|---|
| int | An approximation of the video memory impact, in bytes, of the system |
Initialize(in ProbeVolumeSystemParameters)
Initialize the Probe Volume system
Declaration
public void Initialize(in ProbeVolumeSystemParameters parameters)
Parameters
| Type | Name | Description |
|---|---|---|
| ProbeVolumeSystemParameters | parameters | Initialization parameters. |
IsProbeSamplingDebugEnabled()
Checks if APV sampling debug is enabled
Declaration
public bool IsProbeSamplingDebugEnabled()
Returns
| Type | Description |
|---|---|
| bool | True if APV sampling debug is enabled |
PerformPendingOperations()
Perform all the operations that are relative to changing the content or characteristics of the probe reference volume.
Declaration
public void PerformPendingOperations()
RenderDebug(Camera, ProbeVolumesOptions, Texture)
Render Probe Volume related debug
Declaration
public void RenderDebug(Camera camera, ProbeVolumesOptions options, Texture exposureTexture)
Parameters
| Type | Name | Description |
|---|---|---|
| Camera | camera | The Camera |
| ProbeVolumesOptions | options | Options coming from the volume stack. |
| Texture | exposureTexture | Texture containing the exposure value for this frame. |
RenderDebug(Camera, Texture)
Obsolete. Render Probe Volume related debug
Declaration
[Obsolete("Use the other override to support sampling offset in debug modes. #from(6000.0)")]
public void RenderDebug(Camera camera, Texture exposureTexture)
Parameters
| Type | Name | Description |
|---|---|---|
| Camera | camera | The Camera |
| Texture | exposureTexture | Texture containing the exposure value for this frame. |
RenderFragmentationOverlay(RenderGraph, TextureHandle, TextureHandle, DebugOverlay)
Render a debug view showing fragmentation of the GPU memory.
Declaration
public void RenderFragmentationOverlay(RenderGraph renderGraph, TextureHandle colorBuffer, TextureHandle depthBuffer, DebugOverlay debugOverlay)
Parameters
| Type | Name | Description |
|---|---|---|
| RenderGraph | renderGraph | The RenderGraph responsible for executing this pass. |
| TextureHandle | colorBuffer | The color buffer where the overlay will be rendered. |
| TextureHandle | depthBuffer | The depth buffer used for depth-testing the overlay. |
| DebugOverlay | debugOverlay | The debug overlay manager to orchestrate multiple overlays. |
SetActiveBakingSet(ProbeVolumeBakingSet)
Set the currently active baking set. Can be used when loading additively two scenes belonging to different baking sets to control which one is active.
Declaration
public void SetActiveBakingSet(ProbeVolumeBakingSet bakingSet)
Parameters
| Type | Name | Description |
|---|---|---|
| ProbeVolumeBakingSet | bakingSet | The baking set to load. |
SetActiveScene(Scene)
Loads the baking set the given scene is part of if it exists.
Declaration
public void SetActiveScene(Scene scene)
Parameters
| Type | Name | Description |
|---|---|---|
| Scene | scene | The scene for which to load the baking set. |
SetEnableStateFromSRP(bool)
Communicate to the Probe Volume system whether the SRP enables Probe Volume. It is important to keep in mind that this is not used by the system for anything else but book-keeping, the SRP is still responsible to disable anything Probe volume related on SRP side.
Declaration
public void SetEnableStateFromSRP(bool srpEnablesPV)
Parameters
| Type | Name | Description |
|---|---|---|
| bool | srpEnablesPV | The value of the new enabled |
SetNumberOfCellsLoadedPerFrame(int)
Set the number of cells that are loaded per frame when needed. This number is capped at 10.
Declaration
public void SetNumberOfCellsLoadedPerFrame(int numberOfCells)
Parameters
| Type | Name | Description |
|---|---|---|
| int | numberOfCells | Number of cells to be loaded per frame. |
SetVertexSamplingEnabled(bool)
Communicate to the Probe Volume system whether the SRP uses per vertex sampling
Declaration
public void SetVertexSamplingEnabled(bool value)
Parameters
| Type | Name | Description |
|---|---|---|
| bool | value | True for vertex sampling, false for pixel sampling |
UpdateCellStreaming(CommandBuffer, Camera)
Updates the cell streaming for a Camera
Declaration
public void UpdateCellStreaming(CommandBuffer cmd, Camera camera)
Parameters
| Type | Name | Description |
|---|---|---|
| CommandBuffer | cmd | The CommandBuffer |
| Camera | camera | The Camera |
UpdateCellStreaming(CommandBuffer, Camera, ProbeVolumesOptions)
Updates the cell streaming for a Camera
Declaration
public void UpdateCellStreaming(CommandBuffer cmd, Camera camera, ProbeVolumesOptions options)
Parameters
| Type | Name | Description |
|---|---|---|
| CommandBuffer | cmd | The CommandBuffer |
| Camera | camera | The Camera |
| ProbeVolumesOptions | options | Options coming from the volume stack. |
UpdateShaderVariablesProbeVolumes(CommandBuffer, ProbeVolumesOptions, int, bool)
Update the constant buffer used by Probe Volumes in shaders.
Declaration
public bool UpdateShaderVariablesProbeVolumes(CommandBuffer cmd, ProbeVolumesOptions probeVolumeOptions, int taaFrameIndex, bool supportRenderingLayers = false)
Parameters
| Type | Name | Description |
|---|---|---|
| CommandBuffer | cmd | A command buffer used to perform the data update. |
| ProbeVolumesOptions | probeVolumeOptions | probe volume options from the active volume stack |
| int | taaFrameIndex | TAA frame index |
| bool | supportRenderingLayers | Are rendering layers supported |
Returns
| Type | Description |
|---|---|
| bool | True if successful |