Skip to content

Commit

Permalink
Fix light index calculation
Browse files Browse the repository at this point in the history
  • Loading branch information
pezcode committed Apr 3, 2020
1 parent 73de386 commit 6e1ff05
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/Renderer/Shaders/cs_clustered_lightculling.sc
Original file line number Diff line number Diff line change
Expand Up @@ -65,13 +65,12 @@ void main()
barrier();

// each thread is one cluster and checks against all lights in the cache
for(uint j = 0; j < batchSize; j++)
for(uint i = 0; i < batchSize; i++)
{
uint lightIndex = lightOffset + j;
Cluster cluster = getCluster(clusterIndex);
if(visibleCount < MAX_LIGHTS_PER_CLUSTER && pointLightAffectsCluster(lights[lightIndex], cluster))
if(visibleCount < MAX_LIGHTS_PER_CLUSTER && pointLightIntersectsCluster(lights[i], cluster))
{
visibleLights[visibleCount] = lightIndex;
visibleLights[visibleCount] = lightOffset + i;
visibleCount++;
}
}
Expand Down

0 comments on commit 6e1ff05

Please sign in to comment.