# Depth map with distance along the camera Z axis

With RenderLayers Node you can get the Z distance from the camera to the object behind (x,y) which is sqrt((x - xcam)² + (y - ycam)² + (z - zcam)²). But is it also possible to get only the distance along the camera Z axis for each pixel in the rendered image?

Assumed my camera is at (0,0,0) and looks parallel to the X-axis and I have a point at (3,0,4). Then i would get the distance of 5, but it i need it to be 3. The camera could also be somewhere else or rotated in all directions.

Is this possible to read out?