Really fixing culling for real this time
This commit is contained in:
@@ -70,7 +70,7 @@ struct AABB
|
|||||||
int2 screenCoords = int2(clamp(int(screenCorner.x), 0, int(pViewParams.screenDimensions.x)), clamp(int(screenCorner.y), 0, int(pViewParams.screenDimensions.y)));
|
int2 screenCoords = int2(clamp(int(screenCorner.x), 0, int(pViewParams.screenDimensions.x)), clamp(int(screenCorner.y), 0, int(pViewParams.screenDimensions.y)));
|
||||||
screenCornerMin = int2(min(screenCornerMin.x, screenCoords.x), min(screenCornerMin.y, screenCoords.y));
|
screenCornerMin = int2(min(screenCornerMin.x, screenCoords.x), min(screenCornerMin.y, screenCoords.y));
|
||||||
screenCornerMax = int2(max(screenCornerMax.x, screenCoords.x), max(screenCornerMax.y, screenCoords.y));
|
screenCornerMax = int2(max(screenCornerMax.x, screenCoords.x), max(screenCornerMax.y, screenCoords.y));
|
||||||
maxDepth = max(maxDepth, 1/screenCorner.z);
|
maxDepth = max(maxDepth, screenCorner.z);
|
||||||
}
|
}
|
||||||
return maxDepth;
|
return maxDepth;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -85,7 +85,10 @@ float4 clipToScreen(float4 clip)
|
|||||||
{
|
{
|
||||||
float4 ndc = clip / clip.w;
|
float4 ndc = clip / clip.w;
|
||||||
float2 texCoords = (float2(ndc.xy) + 1.0f) / 2.0f;
|
float2 texCoords = (float2(ndc.xy) + 1.0f) / 2.0f;
|
||||||
return float4(float2(texCoords.x, 1 - texCoords.y) * pViewParams.screenDimensions, 1 - ndc.z, 1.0f);
|
float oz = 1;
|
||||||
|
float pz = 0 - 1;
|
||||||
|
float zf = pz * ndc.z + oz;
|
||||||
|
return float4(float2(texCoords.x, 1 - texCoords.y) * pViewParams.screenDimensions, zf, 1.0f);
|
||||||
}
|
}
|
||||||
|
|
||||||
struct Plane
|
struct Plane
|
||||||
|
|||||||
Reference in New Issue
Block a user