fixing light culling

This commit is contained in:
Dynamitos
2024-02-23 08:31:21 +01:00
parent 15813ba612
commit a3f5ad2841
8 changed files with 37 additions and 24 deletions
+5 -5
View File
@@ -15,13 +15,13 @@ void computeFrustums(ComputeShaderInput in)
{
float3 origin = float3(0, 0, 0);
float3 corners[4] = {
screenToClip(float3(float2(in.dispatchThreadID.x + 0, in.dispatchThreadID.y + 0) * BLOCK_SIZE, -1.0f)),
screenToClip(float3(float2(in.dispatchThreadID.x + 1, in.dispatchThreadID.y + 0) * BLOCK_SIZE, -1.0f)),
screenToClip(float3(float2(in.dispatchThreadID.x + 0, in.dispatchThreadID.y + 1) * BLOCK_SIZE, -1.0f)),
screenToClip(float3(float2(in.dispatchThreadID.x + 1, in.dispatchThreadID.y + 1) * BLOCK_SIZE, -1.0f))
screenToView(float4(float2(in.dispatchThreadID.x + 0, in.dispatchThreadID.y + 0) * BLOCK_SIZE, -1.0f, 1.0f)).xyz,
screenToView(float4(float2(in.dispatchThreadID.x + 1, in.dispatchThreadID.y + 0) * BLOCK_SIZE, -1.0f, 1.0f)).xyz,
screenToView(float4(float2(in.dispatchThreadID.x + 0, in.dispatchThreadID.y + 1) * BLOCK_SIZE, -1.0f, 1.0f)).xyz,
screenToView(float4(float2(in.dispatchThreadID.x + 1, in.dispatchThreadID.y + 1) * BLOCK_SIZE, -1.0f, 1.0f)).xyz
};
Frustum frustum;
frustum.sides[0] = computePlane(origin, corners[2], corners[1]);
frustum.sides[0] = computePlane(origin, corners[2], corners[0]);
frustum.sides[1] = computePlane(origin, corners[1], corners[3]);
frustum.sides[2] = computePlane(origin, corners[0], corners[1]);
frustum.sides[3] = computePlane(origin, corners[3], corners[2]);