Class ProbeReferenceVolume
The reference volume for the Probe Volume 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 |
probeVolumesWeight
Global probe volumes weight. Allows for fading out probe volumes influence falling back to ambient probe.
Declaration
public float probeVolumesWeight { get; set; }
Property Value
Type | Description |
---|---|
float |
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 |
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 |
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)
Render Probe Volume related debug
Declaration
public void RenderDebug(Camera camera)
Parameters
Type | Name | Description |
---|---|---|
Camera | camera | The Camera |
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 | |
TextureHandle | colorBuffer | |
TextureHandle | depthBuffer | |
DebugOverlay | debugOverlay |
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. |
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 |
UpdateShaderVariablesProbeVolumes(CommandBuffer, ProbeVolumesOptions, int)
Update the constant buffer used by Probe Volumes in shaders.
Declaration
public bool UpdateShaderVariablesProbeVolumes(CommandBuffer cmd, ProbeVolumesOptions probeVolumeOptions, int taaFrameIndex)
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 |
Returns
Type | Description |
---|---|
bool | True if successful |