Fixing depth mip generation

This commit is contained in:
Dynamitos
2024-06-17 16:21:41 +02:00
parent 0fd331b3b5
commit 7cdbb19331
5 changed files with 221 additions and 43 deletions
+3 -3
View File
@@ -89,18 +89,18 @@ void cullLights(ComputeShaderInput in)
float maxDepthWS = clipToWorld(float4(0, 0, fMaxDepth, 1)).z;
float nearClipWS = clipToWorld(float4(0, 0, 0, 1)).z;
Plane minPlane = {float3(0, 0, -1), -minDepthWS};
Plane maxPlane = {float3(0, 0, -1), -maxDepthWS};
for ( uint i = in.groupIndex; i < pLightEnv.numPointLights; i += BLOCK_SIZE * BLOCK_SIZE )
{
PointLight light = pLightEnv.pointLights[i];
#ifdef LIGHT_CULLING
if(light.insideFrustum(groupFrustum, light.getPosition(), nearClipWS, maxDepthWS))
if(light.insideFrustum(groupFrustum, light.getPosition(), nearClipWS, minDepthWS))
#endif
{
tAppendLight(i);
#ifdef LIGHT_CULLING
if(!light.insidePlane(minPlane, light.getPosition()))
if(!light.insidePlane(maxPlane, light.getPosition()))
#endif
{
oAppendLight(i);