Depth from Texture in Unity

Hi everybody,

I am looking at the depth texture that is rendered like this in Unity:
Texture2D depth = zedCamera.CreateTextureMeasureType(sl.MEASURE.DEPTH_RIGHT, resolution);

The idea is that I need to send this texture to a dll or keep a sequence of these depth textures in memory. I would need to go back in time to calculate depth of a pixel. This pixel is coming from an outside program.

Two questions:

  1. When I take a look at pixel values from this texture I always get this:
    RGBA(-431602100.000, 1.000, 1.000, 1.000)
    How can I get the actual depth value out of this texture? I would not want to use the GetDepth method because that uses a dll somewhere down the line and I need the actual value coming from this texture.

  2. Could I pass this texture as GetNativeTexturePtr() and then how could I retrieve depth value in C++ fi?

Thank you so much!

Hi @wimvanhenden-tool ,

  1. I saw in your other post that you successfully retrieved the measure, is that working correctly now or is there still an issue?

  2. It should work seamlessly, simply reading the texture should give you a distance in meters in each pixel.

@JPlou that is correct. Thank you so much.