Skip to content

Commit 2f40ded

Browse files
Coordinate Grid: fixed camera Z range for reversed depth
1 parent ca8ce52 commit 2f40ded

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

Shaders/Common/public/CoordinateGrid.fxh

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -167,8 +167,10 @@ float4 ComputeCoordinateGrid(in float2 f2NormalizedXY,
167167
float PlaneAlpha[3];
168168

169169
float PixelSize = length(Camera.f4ViewportSize.zw / float2(Camera.mProj[0][0], Camera.mProj[1][1]));
170-
float MinCameraZ = DepthToCameraZ(MinDepth, Camera.mProj);
171-
float MaxCameraZ = DepthToCameraZ(MaxDepth, Camera.mProj);
170+
float CameraZ0 = DepthToCameraZ(MinDepth, Camera.mProj);
171+
float CameraZ1 = DepthToCameraZ(MaxDepth, Camera.mProj);
172+
float MinCameraZ = min(CameraZ0, CameraZ1);
173+
float MaxCameraZ = max(CameraZ0, CameraZ1);
172174
float CameraZRange = max(MaxCameraZ - MinCameraZ, 1e-6);
173175

174176
ComputePlaneIntersectionAttribs(Camera, RayWS, float3(1.0, 0.0, 0.0), MaxCameraZ, CameraZRange, Positions[0], PlaneAlpha[0]);

Shaders/PostProcess/DepthOfField/private/DOF_ComputeSeparatedCircleOfConfusion.fx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,5 @@ float ComputeSeparatedCoCPS(in FullScreenTriangleVSOutput VSOut) : SV_Target0
77
float2 Position = VSOut.f4PixelPos.xy;
88

99
float CoC = g_TextureCoC.Load(int3(Position, 0));
10-
return abs(CoC) * float(CoC < 0.0);;
10+
return abs(CoC) * float(CoC < 0.0);
1111
}

0 commit comments

Comments
 (0)