Skip to content

Commit e213167

Browse files
olivierpratEvergreen
authored andcommitted
[Port] [6000.3] UUM-129941 : Fix incorrect APV baking when using sample count Probe Adjustment Volumes
1 parent d7b24e9 commit e213167

1 file changed

Lines changed: 7 additions & 6 deletions

File tree

  • Packages/com.unity.render-pipelines.core/Editor/Lighting/ProbeVolume

Packages/com.unity.render-pipelines.core/Editor/Lighting/ProbeVolume/ProbeGIBaking.cs

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -306,13 +306,13 @@ public BakingBatch(Vector3Int cellCount, ProbeReferenceVolume refVolume)
306306
maxBrickCount = cellCount * ProbeReferenceVolume.CellSize(refVolume.GetMaxSubdivision());
307307
inverseScale = ProbeBrickPool.kBrickCellCount / refVolume.MinBrickSize();
308308
offset = refVolume.ProbeOffset();
309-
309+
310310
// Initialize NativeHashMaps with reasonable initial capacity
311311
// Using a larger capacity to reduce allocations during baking
312312
positionToIndex = new NativeHashMap<int, int>(100000, Allocator.Persistent);
313313
uniqueBrickSubdiv = new NativeHashMap<int, int>(100000, Allocator.Persistent);
314314
}
315-
315+
316316
public void Dispose()
317317
{
318318
if (positionToIndex.IsCreated)
@@ -1098,7 +1098,7 @@ static void BakeDelegate(ref float progress, ref bool done)
10981098
{
10991099
FixSeams(
11001100
s_BakeData.positionRemap,
1101-
s_BakeData.originalPositions,
1101+
s_BakeData.sortedPositions,
11021102
s_BakeData.lightingJob.irradiance,
11031103
s_BakeData.lightingJob.validity,
11041104
s_BakeData.lightingJob.occlusion,
@@ -1323,7 +1323,7 @@ internal static void FixSeams(
13231323
NativeArray<Vector4> skyOcclusion,
13241324
NativeArray<uint> renderingLayerMasks)
13251325
{
1326-
// Seams are caused are caused by probes on the boundary between two subdivision levels
1326+
// Seams are caused by probes on the boundary between two subdivision levels
13271327
// The idea is to find first them and do a kind of dilation to smooth the values on the boundary
13281328
// the dilation process consits in doing a trilinear sample of the higher subdivision brick and override the lower subdiv with that
13291329
// We have to mark the probes on the boundary as valid otherwise leak reduction at runtime will interfere with this method
@@ -1443,7 +1443,8 @@ Vector3Int GetCellPositionFromVoxel(Vector3Int voxelToLookup, int cellSizeInBric
14431443
{
14441444
uint renderingLayerMask = renderingLayerMasks[positionRemap[index]];
14451445
bool commonRenderingLayer = (renderingLayerMask & probeRenderingLayerMask) != 0;
1446-
if (!commonRenderingLayer) continue; // We do not use this probe contribution if it does not share at least a common rendering layer
1446+
if (!commonRenderingLayer)
1447+
continue; // We do not use this probe contribution if it does not share at least a common rendering layer
14471448
}
14481449

14491450
// Do the lerp in compressed format to match result on GPU
@@ -1512,7 +1513,7 @@ static void ApplyPostBakeOperations()
15121513
var chunkSizeInProbes = ProbeBrickPool.GetChunkSizeInProbeCount();
15131514
var hasVirtualOffsets = m_BakingSet.settings.virtualOffsetSettings.useVirtualOffset;
15141515
var hasRenderingLayers = m_BakingSet.useRenderingLayers;
1515-
1516+
15161517
if (!ValidateBakingCellsSize(bakingCellsArray, chunkSizeInProbes, hasVirtualOffsets, hasRenderingLayers))
15171518
return; // Early exit if validation fails
15181519

0 commit comments

Comments
 (0)