 		currentDepth = texture(sampler2D(depth, sRepeatLinearLinear), newUV).r;
 		// Update current layer.
 		currentLayer += layerHeight;
-		currentLayerId += 1.0;
 	}
 	
 	// Perform interpolation between the current depth layer and the previous one to refine the UV shift.

	float finalDepth = mix(currentDepth, previousDepth, mixRatio);

	// Ouptut distance covered along the view direction.
	float finalDist = PARALLAX_SCALE * (currentLayerId - mixRatio) / (layersCount - 1.0); 
	shiftDistance = finalDist;
	return finalUV;
}


	vec2 newUV = uv;
	
	// While the current layer is above the surface (ie smaller than depth), we march.
	while (currentLayer < currentDepth) {
		// We update the UV, going further away from the viewer.
		newUV -= shiftUV;
