Skip to content

Commit ff9abbb

Browse files
Partner/crazyhunter 10.7.0 custom.1.pvdgi cross volumes (#38)
* Scaffolding for testing how sampling neighbor probe volumes around edges of dynamic GI volumes can help with propagating GI from neighbors. Needs to be filled in * typo * work in progress * Probe Volumes: Fix up case where ProbeVolume.hlsl is included and LIGHTLOOP_DISABLE_TILE_AND_CLUSTER is defined. Add support for dynamic GI border axes sampling all other probe volumes in order to propagate dynamic GI across volume boundaries. * Fix fade calculation * Fix warning about sign / unsign mismatch. * cache and respect the HDRP asset Dynamic GI toggle at runtime for perf testing * Probe Volumes: Dynamic GI: Add Neighboring Volume Propagation Mode to Probe Dynamic GI Volume Override for selecting which algorithm is used to inject dynamic GI from neighboring probe volumes at boundaries. Options include Disabled, Sample Neighbors Direction Only (reccomended), and Sample Neighbors Position and Direction * Probe Volumes: Dynamic GI: If Dynamic GI is on, and Neighboring Volume Propagation is on, force probe volumes to upload to structured buffers and the atlas if they are within the rangeInFrontOfCamera or rangeBehindCamera distance. * Probe Volume GI: neighboringVolumePropagationMode - change default to SampleNeighborsPositionAndDirection Co-authored-by: Szymon Swistun <szymon@bonfirestudios.com> Co-authored-by: pastasfuture <nickb@bonfirestudios.com>
1 parent ba7e205 commit ff9abbb

7 files changed

Lines changed: 236 additions & 5 deletions

File tree

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

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,8 @@ public class ProbeDynamicGI : VolumeComponent
4141
public ClampedFloatParameter leakMultiplier = new ClampedFloatParameter(0.0f, 0.0f, 1.0f);
4242
[Tooltip("Advanced control to bias the distance from the normal of the hit surface to perform direct lighting evaluation on")]
4343
public ClampedFloatParameter bias = new ClampedFloatParameter(0.05f, 0.0f, 0.33f);
44+
[Tooltip("Advanced control for how probes at volume boundaries propagate light from neighboring Probe Volumes.\n\nDisabled: No light is propagated across neighbors.\n\nSample Neighbors Direction Only: Samples all probe volumes once per probe and evaluates light from the resulting probe data for each axis.\n\nSample Neighbors Position and Direction: Samples all probe volumes for all propagation axes at each axes neighboring probe position.\nPotentially more accurate than Sample Neighbors Direction Only, but significantly more expensive.")]
45+
public DynamicGINeighboringVolumePropagationModeParameter neighboringVolumePropagationMode = new DynamicGINeighboringVolumePropagationModeParameter(DynamicGINeighboringVolumePropagationMode.SampleNeighborsPositionAndDirection);
4446

4547
[Tooltip("Debug Contribution control for mixing in baked indirect lighting")]
4648
public ClampedFloatParameter bakeAmount = new ClampedFloatParameter(1.0f, 0.0f, 1.0f);
@@ -64,5 +66,20 @@ public sealed class SHFromSGModeParameter : VolumeParameter<SHFromSGMode>
6466
public SHFromSGModeParameter(SHFromSGMode value, bool overrideState = false)
6567
: base(value, overrideState) {}
6668
}
69+
70+
[Serializable]
71+
public enum DynamicGINeighboringVolumePropagationMode
72+
{
73+
Disabled = 0,
74+
SampleNeighborsDirectionOnly,
75+
SampleNeighborsPositionAndDirection
76+
};
77+
78+
[Serializable]
79+
public sealed class DynamicGINeighboringVolumePropagationModeParameter : VolumeParameter<DynamicGINeighboringVolumePropagationMode>
80+
{
81+
public DynamicGINeighboringVolumePropagationModeParameter(DynamicGINeighboringVolumePropagationMode value, bool overrideState = false)
82+
: base(value, overrideState) { }
83+
}
6784
}
6885
} // UnityEngine.Experimental.Rendering.HDPipeline

com.unity.render-pipelines.high-definition/Runtime/Lighting/ProbeVolume/DynamicGI/ProbePropagationAxes.compute

Lines changed: 167 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,18 @@
33
#include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariables.hlsl"
44
#include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Packing.hlsl"
55
#include "Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/ProbeVolume/DynamicGI/ProbePropagationSphericalGaussians.hlsl"
6+
#include "Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/ProbeVolume/DynamicGI/ProbeVolumeSphericalHarmonicsLighting.hlsl"
7+
8+
#define LIGHTLOOP_DISABLE_TILE_AND_CLUSTER
9+
// Force probe volume bilateral filtering off to speed things up.
10+
// Comment out this line if you would like to use the project wide setting bilateral filtering defined in ShaderConfig.cs
11+
#define PROBE_VOLUMES_BILATERAL_FILTERING_MODE PROBEVOLUMESBILATERALFILTERINGMODES_DISABLED
12+
13+
// Can force L1 or L0 sampling by modifying this define. When commented out it will use the project wide setting defined in ShaderConfig.cs
14+
// #define PROBE_VOLUMES_SAMPLING_MODE PROBEVOLUMESENCODINGMODES_SPHERICAL_HARMONICS_L1
15+
#include "Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/ProbeVolume/ProbeVolume.hlsl"
16+
17+
#pragma multi_compile _ SAMPLE_NEIGHBORS_DIRECTION_ONLY SAMPLE_NEIGHBORS_POSITION_AND_DIRECTION
618

719
#pragma kernel PropagateLight
820
#define GROUP_SIZE 64
@@ -24,12 +36,16 @@ uint _ProbeVolumeDGIResolutionX;
2436
uint _ProbeVolumeDGIResolutionY;
2537
uint _ProbeVolumeDGIResolutionZ;
2638
float3 _ProbeVolumeDGIResolutionInverse;
39+
float _ProbeVolumeDGIMaxNeighborDistance;
2740

2841
float3 _ProbeVolumeDGIBoundsRight;
2942
float3 _ProbeVolumeDGIBoundsUp;
3043
float3 _ProbeVolumeDGIBoundsExtents;
3144
float3 _ProbeVolumeDGIBoundsCenter;
3245

46+
uint _ProbeVolumeDGILightLayers;
47+
int _ProbeVolumeDGIEngineDataIndex;
48+
3349
float _RangeInFrontOfCamera;
3450
float _RangeBehindCamera;
3551

@@ -55,6 +71,131 @@ float3 ProbeCoordinatesToWorldPosition(float3 probeCoordinates, float3x3 probeVo
5571
return mul(localPosition, probeVolumeLtw) + GetAbsolutePositionWS(_ProbeVolumeDGIBoundsCenter);
5672
}
5773

74+
#if PROBE_VOLUMES_SAMPLING_MODE == PROBEVOLUMESENCODINGMODES_SPHERICAL_HARMONICS_L0
75+
void ProbeVolumeAccumulateDynamicGINeighborsSphericalHarmonicsL0(
76+
#elif PROBE_VOLUMES_SAMPLING_MODE == PROBEVOLUMESENCODINGMODES_SPHERICAL_HARMONICS_L1
77+
void ProbeVolumeAccumulateDynamicGINeighborsSphericalHarmonicsL1(
78+
#elif PROBE_VOLUMES_SAMPLING_MODE == PROBEVOLUMESENCODINGMODES_SPHERICAL_HARMONICS_L2
79+
void ProbeVolumeAccumulateDynamicGINeighborsSphericalHarmonicsL2(
80+
#endif
81+
PositionInputs posInput, float3 normalWS, float3 viewDirectionWS, uint renderingLayers,
82+
#if PROBE_VOLUMES_SAMPLING_MODE == PROBEVOLUMESENCODINGMODES_SPHERICAL_HARMONICS_L0
83+
out ProbeVolumeSphericalHarmonicsL0 coefficients,
84+
#elif PROBE_VOLUMES_SAMPLING_MODE == PROBEVOLUMESENCODINGMODES_SPHERICAL_HARMONICS_L1
85+
out ProbeVolumeSphericalHarmonicsL1 coefficients,
86+
#elif PROBE_VOLUMES_SAMPLING_MODE == PROBEVOLUMESENCODINGMODES_SPHERICAL_HARMONICS_L2
87+
out ProbeVolumeSphericalHarmonicsL2 coefficients,
88+
#endif
89+
inout float weightHierarchy)
90+
{
91+
92+
#if PROBE_VOLUMES_SAMPLING_MODE == PROBEVOLUMESENCODINGMODES_SPHERICAL_HARMONICS_L0
93+
ZERO_INITIALIZE(ProbeVolumeSphericalHarmonicsL0, coefficients);
94+
#elif PROBE_VOLUMES_SAMPLING_MODE == PROBEVOLUMESENCODINGMODES_SPHERICAL_HARMONICS_L1
95+
ZERO_INITIALIZE(ProbeVolumeSphericalHarmonicsL1, coefficients);
96+
#elif PROBE_VOLUMES_SAMPLING_MODE == PROBEVOLUMESENCODINGMODES_SPHERICAL_HARMONICS_L2
97+
ZERO_INITIALIZE(ProbeVolumeSphericalHarmonicsL2, coefficients);
98+
#endif
99+
100+
for (int i = 0; i < (int)_ProbeVolumeCount; ++i)
101+
{
102+
ProbeVolumeEngineData probeVolumeData = _ProbeVolumeDatas[i];
103+
OrientedBBox probeVolumeBounds = _ProbeVolumeBounds[i];
104+
105+
if (ProbeVolumeIsAllWavesComplete(weightHierarchy, probeVolumeData.volumeBlendMode)) { break; }
106+
107+
// Do not sample ourselves.
108+
// TODO: We also likely only want to sample neighboring probe volumes if they are simulating dynamic GI (and ideally, only the dynamic GI portion).
109+
if (i != _ProbeVolumeDGIEngineDataIndex)
110+
{
111+
#if PROBE_VOLUMES_SAMPLING_MODE == PROBEVOLUMESENCODINGMODES_SPHERICAL_HARMONICS_L0
112+
ProbeVolumeAccumulateSphericalHarmonicsL0(
113+
#elif PROBE_VOLUMES_SAMPLING_MODE == PROBEVOLUMESENCODINGMODES_SPHERICAL_HARMONICS_L1
114+
ProbeVolumeAccumulateSphericalHarmonicsL1(
115+
#elif PROBE_VOLUMES_SAMPLING_MODE == PROBEVOLUMESENCODINGMODES_SPHERICAL_HARMONICS_L2
116+
ProbeVolumeAccumulateSphericalHarmonicsL2(
117+
#endif
118+
posInput, normalWS, viewDirectionWS, renderingLayers,
119+
probeVolumeData, probeVolumeBounds,
120+
coefficients,
121+
weightHierarchy
122+
);
123+
}
124+
}
125+
}
126+
127+
SHIncomingIrradiance ProbeVolumeEvaluateIncomingIrradiance(float3 positionWS, uint renderingLayers)
128+
{
129+
float3 positionRWS = GetCameraRelativePositionWS(positionWS);
130+
PositionInputs posInput;
131+
ZERO_INITIALIZE(PositionInputs, posInput);
132+
posInput.positionWS = positionRWS; // TODO: Be careful about RWS here.
133+
// float2 positionNDC; // unused in probe volumes.
134+
// uint2 positionSS; // unused in probe volumes.
135+
// uint2 tileCoord; // unused in probe volumes with light lists disabled.
136+
// float deviceDepth; // unused in probe volumes.
137+
posInput.linearDepth = abs(mul(GetWorldToViewMatrix(), float4(positionRWS, 1.0)).z); // needed for depth fade. TODO: Should be a max(0.0) but need to figure out the sign flip here.
138+
139+
// Completely disable normal and view bias in this context by setting the normal and view to zero.
140+
// They are only used for bias.
141+
const float3 normalWSForBias = 0.0;
142+
const float3 viewDirectionWSForBias = 0.0;
143+
SHIncomingIrradiance shIncomingIrradiance;
144+
ZERO_INITIALIZE(SHIncomingIrradiance, shIncomingIrradiance);
145+
float weightHierarchy = 0.0;
146+
147+
#if PROBE_VOLUMES_SAMPLING_MODE == PROBEVOLUMESENCODINGMODES_SPHERICAL_HARMONICS_L0
148+
#error "Need to define implementation of ProbeVolumeEvaluateIncomingRadiance for PROBEVOLUMESENCODINGMODES_SPHERICAL_HARMONICS_L0"
149+
// TODO:
150+
// ProbeVolumeSphericalHarmonicsL0 coefficients;
151+
// ProbeVolumeAccumulateSphericalHarmonicsL0(posInput, normalWS, normalWS, renderingLayers, coefficients, weightHierarchy);
152+
// bakeDiffuseLighting += ProbeVolumeEvaluateSphericalHarmonicsL0(normalWS, coefficients);
153+
154+
#elif PROBE_VOLUMES_SAMPLING_MODE == PROBEVOLUMESENCODINGMODES_SPHERICAL_HARMONICS_L1
155+
#error "Need to define implementation of ProbeVolumeEvaluateIncomingRadiance for PROBEVOLUMESENCODINGMODES_SPHERICAL_HARMONICS_L1"
156+
// TODO:
157+
// ProbeVolumeSphericalHarmonicsL1 coefficients;
158+
// ProbeVolumeAccumulateDynamicGINeighborsSphericalHarmonicsL1(posInput, normalWSForBias, viewDirectionWSForBias, renderingLayers, coefficients, weightHierarchy);
159+
160+
#elif PROBE_VOLUMES_SAMPLING_MODE == PROBEVOLUMESENCODINGMODES_SPHERICAL_HARMONICS_L2
161+
ProbeVolumeSphericalHarmonicsL2 coefficients;
162+
ProbeVolumeAccumulateDynamicGINeighborsSphericalHarmonicsL2(posInput, normalWSForBias, viewDirectionWSForBias, renderingLayers, coefficients, weightHierarchy);
163+
164+
SHOutgoingRadiosityWithProjectedConstantsPacked outgoingRadiosityProjectedConstantsPacked;
165+
[unroll] for (int i = 0; i < SH_PACKED_COEFFICIENT_COUNT; ++i) { outgoingRadiosityProjectedConstantsPacked.data[i] = coefficients.data[i]; }
166+
SHOutgoingRadiosityWithProjectedConstants outgoingRadiosityProjectedConstants = SHOutgoingRadiosityWithProjectedConstantsCompute(outgoingRadiosityProjectedConstantsPacked);
167+
SHOutgoingRadiosity bakedOutgoingRadiosity = SHOutgoingRadiosityCompute(outgoingRadiosityProjectedConstants);
168+
shIncomingIrradiance = SHIncomingIrradianceCompute(bakedOutgoingRadiosity);
169+
#endif
170+
171+
return shIncomingIrradiance;
172+
}
173+
174+
float3 ProbeVolumeEvaluateIncomingRadiance(SHIncomingIrradiance shIncomingIrradiance, float3 directionWS)
175+
{
176+
// TODO: Rather than simply point sampling the incoming radiance, we could approximately evaluate the integral of the axis SG and the SH term using very similar math
177+
// to what we use for converting from SGs to SH in ProbePropagationCombine.compute.
178+
// In short, we would generate a zonal harmonic that approximately represents our SG, use it as a window for our SH data, compute the integral of our windowed SH term over the sphere,
179+
// and use that as the amplitude for our axis SG (likely requires careful normalization).
180+
// Point sampling might be good enough - would just be nice to have the option to compare.
181+
float3 incomingRadiance = IncomingRadianceCompute(shIncomingIrradiance, directionWS);
182+
183+
// Values can be negative due to ringing. Clip off negative values.
184+
incomingRadiance = max(0.0, incomingRadiance);
185+
186+
return incomingRadiance;
187+
}
188+
189+
bool IsBoundaryProbe(uint3 probeCoordinate, uint3 resolution)
190+
{
191+
return (probeCoordinate.x == 0)
192+
|| (probeCoordinate.y == 0)
193+
|| (probeCoordinate.z == 0)
194+
|| ((probeCoordinate.x + 1) == resolution.x)
195+
|| ((probeCoordinate.y + 1) == resolution.y)
196+
|| ((probeCoordinate.z + 1) == resolution.z);
197+
}
198+
58199
[numthreads(GROUP_SIZE, 1, 1)]
59200
void PropagateLight(uint3 id : SV_DispatchThreadID)
60201
{
@@ -68,14 +209,23 @@ void PropagateLight(uint3 id : SV_DispatchThreadID)
68209
uint3 probeCoordinate = ProbeIndexToProbeCoordinatesUint(probeIndex);
69210

70211
const float3x3 probeVolumeLtw = float3x3(_ProbeVolumeDGIBoundsRight, _ProbeVolumeDGIBoundsUp, cross(_ProbeVolumeDGIBoundsRight, _ProbeVolumeDGIBoundsUp));
71-
const float3 worldPosition = ProbeCoordinatesToWorldPosition(probeCoordinate, probeVolumeLtw);
212+
const float3 probePositionWS = ProbeCoordinatesToWorldPosition(probeCoordinate, probeVolumeLtw);
72213

73214
// Early out at far distances
74-
if (IsFarFromCamera(worldPosition, _RangeInFrontOfCamera, _RangeBehindCamera))
215+
if (IsFarFromCamera(probePositionWS, _RangeInFrontOfCamera, _RangeBehindCamera))
75216
{
76217
return;
77218
}
78219

220+
#if defined(SAMPLE_NEIGHBORS_DIRECTION_ONLY)
221+
SHIncomingIrradiance shIncomingIrradiance;
222+
ZERO_INITIALIZE(SHIncomingIrradiance, shIncomingIrradiance);
223+
if (IsBoundaryProbe(probeCoordinate, uint3(_ProbeVolumeDGIResolutionX, _ProbeVolumeDGIResolutionY, _ProbeVolumeDGIResolutionZ)))
224+
{
225+
shIncomingIrradiance = ProbeVolumeEvaluateIncomingIrradiance(probePositionWS, _ProbeVolumeDGILightLayers);
226+
}
227+
#endif
228+
79229
float3 incomingRadiance = 0;
80230
float weight = 0.0f;
81231
float probeValidity = 0;
@@ -84,6 +234,9 @@ void PropagateLight(uint3 id : SV_DispatchThreadID)
84234
for(int i=0; i < NEIGHBOR_AXIS_COUNT; ++i)
85235
{
86236
float3 neighborDirection = _RayAxis[i].xyz;
237+
float neighborAxisLength = _RayAxis[i].w;
238+
float3 neighborWorldDirection = mul(neighborDirection, probeVolumeLtw);
239+
87240
uint sampleAxis = probeIndex * NEIGHBOR_AXIS_COUNT + i;
88241
NeighborAxis neighbor = _ProbeVolumeNeighbors[sampleAxis];
89242

@@ -111,7 +264,6 @@ void PropagateLight(uint3 id : SV_DispatchThreadID)
111264
int3 offset = GetNeighborAxisOffset(i);
112265
int3 neighborProbeCoordinate = probeCoordinate + offset;
113266

114-
//TODO: remove missed axis on generation to avoid this branch entirely here
115267
if(neighborProbeCoordinate.x >= 0 && neighborProbeCoordinate.x < (int)_ProbeVolumeDGIResolutionX &&
116268
neighborProbeCoordinate.y >= 0 && neighborProbeCoordinate.y < (int)_ProbeVolumeDGIResolutionY &&
117269
neighborProbeCoordinate.z >= 0 && neighborProbeCoordinate.z < (int)_ProbeVolumeDGIResolutionZ)
@@ -122,6 +274,18 @@ void PropagateLight(uint3 id : SV_DispatchThreadID)
122274
weight += sgWeight;
123275
incomingRadiance += prevAxisRadiance * sgWeight;
124276
}
277+
#if defined(SAMPLE_NEIGHBORS_DIRECTION_ONLY) || defined(SAMPLE_NEIGHBORS_POSITION_AND_DIRECTION)
278+
else
279+
{
280+
#if defined(SAMPLE_NEIGHBORS_POSITION_AND_DIRECTION)
281+
// sample neighbor probe volumes to gather radiance from neighbor volumes
282+
float3 boundaryEdgePositionWS = probePositionWS + neighborWorldDirection * neighborAxisLength * _ProbeVolumeDGIMaxNeighborDistance;
283+
SHIncomingIrradiance shIncomingIrradiance = ProbeVolumeEvaluateIncomingIrradiance(boundaryEdgePositionWS, _ProbeVolumeDGILightLayers);
284+
#endif
285+
weight += sgWeight;
286+
incomingRadiance += ProbeVolumeEvaluateIncomingRadiance(shIncomingIrradiance, neighborWorldDirection) * sgWeight;
287+
}
288+
#endif
125289
}
126290
}
127291

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

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -402,10 +402,36 @@ void DispatchPropagationAxes(CommandBuffer cmd, ProbeVolumeHandle probeVolume, i
402402
var obb = probeVolume.GetProbeVolumeEngineDataBoundingBox();
403403
var data = probeVolume.GetProbeVolumeEngineData();
404404

405+
switch (giSettings.neighboringVolumePropagationMode.value)
406+
{
407+
case ProbeDynamicGI.DynamicGINeighboringVolumePropagationMode.SampleNeighborsDirectionOnly:
408+
{
409+
CoreUtils.SetKeyword(shader, "SAMPLE_NEIGHBORS_DIRECTION_ONLY", true);
410+
CoreUtils.SetKeyword(shader, "SAMPLE_NEIGHBORS_POSITION_AND_DIRECTION", false);
411+
break;
412+
}
413+
case ProbeDynamicGI.DynamicGINeighboringVolumePropagationMode.SampleNeighborsPositionAndDirection:
414+
{
415+
CoreUtils.SetKeyword(shader, "SAMPLE_NEIGHBORS_DIRECTION_ONLY", false);
416+
CoreUtils.SetKeyword(shader, "SAMPLE_NEIGHBORS_POSITION_AND_DIRECTION", true);
417+
break;
418+
}
419+
case ProbeDynamicGI.DynamicGINeighboringVolumePropagationMode.Disabled:
420+
default:
421+
{
422+
CoreUtils.SetKeyword(shader, "SAMPLE_NEIGHBORS_DIRECTION_ONLY", false);
423+
CoreUtils.SetKeyword(shader, "SAMPLE_NEIGHBORS_POSITION_AND_DIRECTION", false);
424+
break;
425+
}
426+
}
427+
428+
cmd.SetComputeFloatParam(shader, "_ProbeVolumeDGIMaxNeighborDistance", data.maxNeighborDistance);
405429
cmd.SetComputeIntParam(shader, "_ProbeVolumeDGIResolutionXY", (int)data.resolutionXY);
406430
cmd.SetComputeIntParam(shader, "_ProbeVolumeDGIResolutionX", (int)data.resolutionX);
407431
cmd.SetComputeIntParam(shader, "_ProbeVolumeDGIResolutionY", (int)data.resolution.y);
408432
cmd.SetComputeIntParam(shader, "_ProbeVolumeDGIResolutionZ", (int)data.resolution.z);
433+
cmd.SetComputeIntParam(shader, "_ProbeVolumeDGILightLayers", unchecked((int)data.lightLayers));
434+
cmd.SetComputeIntParam(shader, "_ProbeVolumeDGIEngineDataIndex", probeVolume.GetProbeVolumeEngineDataIndex());
409435
cmd.SetComputeVectorParam(shader, "_ProbeVolumeDGIResolutionInverse", data.resolutionInverse);
410436
cmd.SetComputeVectorParam(shader, "_ProbeVolumeDGIBoundsRight", obb.right);
411437
cmd.SetComputeVectorParam(shader, "_ProbeVolumeDGIBoundsUp", obb.up);

com.unity.render-pipelines.high-definition/Runtime/Lighting/ProbeVolume/DynamicGI/ProbeVolumeSphericalHarmonicsLighting.hlsl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -295,6 +295,7 @@ SHIncomingIrradiance SHIncomingIrradianceCompute(SHOutgoingRadiosity shOutgoingR
295295

296296
SHIncomingIrradiance shIncomingIrradiance;
297297

298+
[unroll]
298299
for (int i = 0; i < SH_COEFFICIENT_COUNT; ++i)
299300
{
300301
shIncomingIrradiance.data[i] = (shOutgoingRadiosity.data[i] / shConvolveCosineLobeConstants[i]) * PI;

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
#endif
2020

2121
#include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Packing.hlsl"
22+
#include "Packages/com.unity.render-pipelines.core/ShaderLibrary/CommonLighting.hlsl" // Needed for IsMatchingLightLayer().
2223
#include "Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/ProbeVolume/ProbeVolume.cs.hlsl"
2324
#include "Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/ProbeVolume/ProbeVolumeLightLoopDef.hlsl"
2425
#include "Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/ProbeVolume/ProbeVolumeAtlas.hlsl"

com.unity.render-pipelines.high-definition/Runtime/Lighting/ProbeVolume/ProbeVolumeLightLoopDef.hlsl

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -192,8 +192,14 @@ uint ProbeVolumeFetchIndex(uint probeVolumeStart, uint probeVolumeOffset)
192192
return ProbeVolumeMaterialPassFetchIndex(probeVolumeStart, probeVolumeOffset);
193193
#else // #if SHADEROPTIONS_PROBE_VOLUMES_EVALUATION_MODE == PROBEVOLUMESEVALUATIONMODES_LIGHT_LOOP
194194
// Access probe volume data from standard lightloop light list data structure.
195+
196+
#if defined(LIGHTLOOP_DISABLE_TILE_AND_CLUSTER)
197+
return probeVolumeStart + probeVolumeOffset;
198+
#else
195199
return FetchIndex(probeVolumeStart, probeVolumeOffset);
196200
#endif
201+
202+
#endif
197203
}
198204

199205
// This function scalarize an index accross all lanes. To be effecient it must be used in the context

0 commit comments

Comments
 (0)