Skip to content

Commit 2ebbbb6

Browse files
committed
Toggle for Dynamic GI for low quality baked mode testing in editor
1 parent f757308 commit 2ebbbb6

File tree

3 files changed

+19
-6
lines changed

3 files changed

+19
-6
lines changed

com.unity.render-pipelines.high-definition/Runtime/Lighting/LightLoop/LightLoop.cs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2118,9 +2118,15 @@ bool PrepareLightsForGPU(CommandBuffer cmd, HDCamera hdCamera, CullingResults cu
21182118
ProbeVolume.preparingMixedLights || ProbeVolume.preparingForBake ||
21192119
#endif
21202120
!dynamicGIMixedOnly;
2121-
2121+
21222122
bool processDynamicGI = dynamicGIEnabled && dynamicGINeedsLights;
21232123

2124+
var hdrp = RenderPipelineManager.currentPipeline as HDRenderPipeline;
2125+
if (hdrp != null)
2126+
{
2127+
processDynamicGI &= hdrp.SupportDynamicGI;
2128+
}
2129+
21242130
PreprocessLights(cmd, hdCamera, cullResults, debugDisplaySettings, aovRequest, processDynamicGI);
21252131

21262132
// In case ray tracing supported and a light cluster is built, we need to make sure to reserve all the cookie slots we need

com.unity.render-pipelines.high-definition/Runtime/Lighting/ProbeVolume/ProbeVolumeLighting.cs

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -155,8 +155,15 @@ public partial class HDRenderPipeline
155155
// Is the feature globally disabled?
156156
bool m_SupportProbeVolume = false;
157157
bool m_SupportDynamicGI = false;
158+
bool m_ForceDisableDynamicGI = false;
158159
private bool m_WasProbeVolumeDynamicGIEnabled;
159160

161+
public bool SupportDynamicGI
162+
{
163+
get { return m_SupportDynamicGI && !m_ForceDisableDynamicGI; }
164+
set { m_ForceDisableDynamicGI = !value; }
165+
}
166+
160167
// Pre-allocate sort keys array to max size to avoid creating allocations / garbage at runtime.
161168
uint[] m_ProbeVolumeSortKeys = new uint[k_MaxVisibleProbeVolumeCount];
162169

@@ -1086,7 +1093,7 @@ ProbeVolumeDynamicGICommonData PrepareProbeVolumeDynamicGIData(HDCamera hdCamera
10861093
data.globalCB = m_ShaderVariablesGlobalCB;
10871094
data.ambientProbe = m_SkyManager.GetAmbientProbe(hdCamera);
10881095

1089-
if (hdCamera.frameSettings.IsEnabled(FrameSettingsField.ProbeVolumeDynamicGI) && m_SupportDynamicGI)
1096+
if (hdCamera.frameSettings.IsEnabled(FrameSettingsField.ProbeVolumeDynamicGI) && SupportDynamicGI)
10901097
{
10911098
data.infiniteBounces = hdCamera.frameSettings.IsEnabled(FrameSettingsField.ProbeVolumeDynamicGIInfiniteBounces);
10921099
data.propagationQuality = hdCamera.frameSettings.probeVolumeDynamicGIPropagationQuality;
@@ -1112,7 +1119,6 @@ static void ExecuteProbeVolumeDynamicGI(CommandBuffer cmd, ProbeVolumeDynamicGIC
11121119
if (data.mode == ProbeVolumeDynamicGIMode.Dispatch)
11131120
{
11141121
// Update Probe Volume Data via Dynamic GI Propagation
1115-
ProbeVolumeDynamicGI.instance.ResetSimulationRequests();
11161122
float maxRange = Mathf.Max(data.giSettings.rangeBehindCamera.value, data.giSettings.rangeInFrontOfCamera.value);
11171123
int maxSimulationsPerFrame = data.maxSimulationsPerFrameOverride;
11181124

@@ -1127,7 +1133,7 @@ static void ExecuteProbeVolumeDynamicGI(CommandBuffer cmd, ProbeVolumeDynamicGIC
11271133
for (int probeVolumeIndex = 0; probeVolumeIndex < data.volumes.Count; ++probeVolumeIndex)
11281134
{
11291135
ProbeVolumeHandle volume = data.volumes[probeVolumeIndex];
1130-
1136+
11311137
bool requiresSimulation;
11321138
#if UNITY_EDITOR
11331139
if (ProbeVolume.preparingMixedLights || ProbeVolume.preparingForBake)
@@ -1144,7 +1150,7 @@ static void ExecuteProbeVolumeDynamicGI(CommandBuffer cmd, ProbeVolumeDynamicGIC
11441150
// TODO: obb.center can be a world space position if rendering is not camera relative.
11451151
requiresSimulation = obb.center.magnitude < (maxRange + maxExtent);
11461152
}
1147-
1153+
11481154
if (requiresSimulation)
11491155
ProbeVolumeDynamicGI.instance.AddSimulationRequest(data.volumes, probeVolumeIndex);
11501156
}
@@ -1183,7 +1189,7 @@ void PrepareVisibleProbeVolumeListBuffers(HDCamera hdCamera, CommandBuffer immed
11831189
float globalDistanceFadeEnd = settings.distanceFadeEnd.value;
11841190

11851191
float offscreenUploadDistance = 0.0f;
1186-
if (hdCamera.frameSettings.IsEnabled(FrameSettingsField.ProbeVolumeDynamicGI) && m_SupportDynamicGI)
1192+
if (hdCamera.frameSettings.IsEnabled(FrameSettingsField.ProbeVolumeDynamicGI) && SupportDynamicGI)
11871193
{
11881194
var dynamicGISettings = hdCamera.volumeStack.GetComponent<ProbeDynamicGI>();
11891195
offscreenUploadDistance = (dynamicGISettings.neighborVolumePropagationMode.value == ProbeDynamicGI.DynamicGINeighboringVolumePropagationMode.Disabled)

com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/HDRenderPipeline.RenderGraph.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,7 @@ void ExecuteWithRenderGraph(RenderRequest renderRequest,
128128
RenderShadows(m_RenderGraph, hdCamera, cullingResults, ref shadowResult);
129129

130130
ProbeVolumeDynamicGICommonData commonData = PrepareProbeVolumeDynamicGIData(hdCamera);
131+
ProbeVolumeDynamicGI.instance.ResetSimulationRequests();
131132
if (commonData.mode != ProbeVolumeDynamicGIMode.None)
132133
{
133134
using (var builder = m_RenderGraph.AddRenderPass<ProbeVolumeDynamicGIPassData>("ProbeVolumeDynamicGI", out var passData))

0 commit comments

Comments
 (0)