@@ -278,15 +278,13 @@ half3 ReconstructNormal(float2 uv, float linearDepth, float3 vpos, float2 pixelD
278278 #if defined (_SOURCE_DEPTH_LOW)
279279 return half3 (normalize (cross (ddy (vpos), ddx (vpos))));
280280 #else
281- float2 delta = float2 (_SourceSize.zw * 2.0 );
282-
283- pixelDensity = rcp (pixelDensity);
281+ float2 delta = float2 (_SourceSize.zw * 2.0 ) * rcp (pixelDensity);
284282
285283 // Sample the neighbour fragments
286- float2 lUV = float2 (-delta.x, 0.0 ) * pixelDensity ;
287- float2 rUV = float2 (delta.x, 0.0 ) * pixelDensity ;
288- float2 uUV = float2 (0.0 , delta.y) * pixelDensity ;
289- float2 dUV = float2 (0.0 , -delta.y) * pixelDensity ;
284+ float2 lUV = float2 (-delta.x, 0.0 );
285+ float2 rUV = float2 (delta.x, 0.0 );
286+ float2 uUV = float2 (0.0 , delta.y);
287+ float2 dUV = float2 (0.0 , -delta.y);
290288
291289 float3 l1 = float3 (uv + lUV, 0.0 ); l1.z = SampleAndGetLinearEyeDepth (l1.xy); // Left1
292290 float3 r1 = float3 (uv + rUV, 0.0 ); r1.z = SampleAndGetLinearEyeDepth (r1.xy); // Right1
@@ -316,17 +314,17 @@ half3 ReconstructNormal(float2 uv, float linearDepth, float3 vpos, float2 pixelD
316314 // h == 1.0 && v == 1.0: p1 = right, p2 = up
317315 // h == 0.0 && v == 1.0: p1 = up, p2 = left
318316 // Calculate the view space positions for the three points...
319- half3 P1;
320- half3 P2;
317+ float3 P1;
318+ float3 P2;
321319 if (closest_vertical == 0 )
322320 {
323- P1 = half3 ( closest_horizontal == 0 ? l1 : d1) ;
324- P2 = half3 ( closest_horizontal == 0 ? d1 : r1) ;
321+ P1 = closest_horizontal == 0 ? l1 : d1;
322+ P2 = closest_horizontal == 0 ? d1 : r1;
325323 }
326324 else
327325 {
328- P1 = half3 ( closest_horizontal == 0 ? u1 : r1) ;
329- P2 = half3 ( closest_horizontal == 0 ? l1 : u1) ;
326+ P1 = closest_horizontal == 0 ? u1 : r1;
327+ P2 = closest_horizontal == 0 ? l1 : u1;
330328 }
331329
332330 // Use the cross product to calculate the normal...
0 commit comments