Skip to content

Commit 6e1ff05

Browse files
committed
Fix light index calculation
1 parent 73de386 commit 6e1ff05

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

src/Renderer/Shaders/cs_clustered_lightculling.sc

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -65,13 +65,12 @@ void main()
6565
barrier();
6666

6767
// each thread is one cluster and checks against all lights in the cache
68-
for(uint j = 0; j < batchSize; j++)
68+
for(uint i = 0; i < batchSize; i++)
6969
{
70-
uint lightIndex = lightOffset + j;
7170
Cluster cluster = getCluster(clusterIndex);
72-
if(visibleCount < MAX_LIGHTS_PER_CLUSTER && pointLightAffectsCluster(lights[lightIndex], cluster))
71+
if(visibleCount < MAX_LIGHTS_PER_CLUSTER && pointLightIntersectsCluster(lights[i], cluster))
7372
{
74-
visibleLights[visibleCount] = lightIndex;
73+
visibleLights[visibleCount] = lightOffset + i;
7574
visibleCount++;
7675
}
7776
}

0 commit comments

Comments
 (0)