 	
 	// Interpolate between the two local depths to obtain the correct UV shift.
 	vec2 finalUV = mix(newUV, previousNewUV, currentLocalDepth / (currentLocalDepth - previousLocalDepth));
-	positionShift = (uv - finalUV) * vTangentDir.z / layerHeight;
+	// Ouptut position shift, taking UV flip into account.
+	positionShift = (uv - finalUV) * vTangentDir.z / layerHeight * vec2(1.0, -1.0);
 	return finalUV;
 }
 

	// Step vector: in tangent space, we walk on the surface, in the (X,Y) plane.
	vec2 shift = PARALLAX_SCALE * vTangentDir.xy;
	// This shift corresponds to a UV shift, scaled depending on the height of a layer and the vertical coordinate of the view direction.
	vec2 shiftUV = shift / vTangentDir.z * layerHeight;
	vec2 newUV = uv;
	
	// While the current layer is above the surface (ie smaller than depth), we march.

	vec4 clipPos = proj * vec4(newViewSpacePosition, 1.0);
	// Perspective division.
	float newDepth = clipPos.z / clipPos.w;
	// Update the fragment depth.
	gl_FragDepth = newDepth;
	return newViewSpacePosition;
}
