Depth map changes if object is close to camera (unity)


I’ve been using unity to display the depthmap from the camera to a RenderTexture.

I’m using //depthTexture = zed.CreateTextureImageType(sl.VIEW.DEPTH); to retrieve the texture from the camera, which I then Blit into a render texture.

However what I noticed is that the gray values shift quite drammatically if one object is really close to the camera (e.g. passing the hand close to the camera), almost like if it’s automatically adjusting the range.

The documentation says:

To display the depth map, we scale its values to [0, 255], where 255 (white) represents the closest possible depth value and 0 (black) represents the most distant possible depth value.

so I assumed that such and auto-adjustment shouldn’t happen.

What am I missing? How can I get a stable depth image?



This texture is only made for display, and should not be used to get precise value of depth (see

To get precise values of depth, you should use “CreateTextureMeasureType” instead.

Stereolabs Support