From afade93bad8cd5f360c29df758d7842d541b76d0 Mon Sep 17 00:00:00 2001 From: Pixelflinger Date: Wed, 15 Apr 2020 19:12:35 -0700 Subject: [PATCH] Fix a froxelization bug we would be short by one froxel on the left, usually this wasn't a problem due to the light falloff. --- filament/src/Froxelizer.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/filament/src/Froxelizer.cpp b/filament/src/Froxelizer.cpp index 99f8671e53..626581e08a 100644 --- a/filament/src/Froxelizer.cpp +++ b/filament/src/Froxelizer.cpp @@ -856,7 +856,9 @@ void Froxelizer::froxelizePointAndSpotLight( // find the begin index (left side) for (bx = x0; bx <= xcenter; ++bx) { if (spherePlaneDistanceSquared(cy, planesX[bx].x, planesX[bx].z) > 0) { - // intersection + // intersection, if we intersect with a plane at index bx, we + // actually intrude in the froxel to its left, i.e. with index bx - 1 + bx -= bx > 0; break; } }