0

I have a depth texture and I would like to know in which coordinate system are the values stored inside the depth texture. Homogeneous coordinates, camera coordinates, world coordinates or model coordinates?

I also would like to know what values are stored in the depth texture and what do they mean.

Thanks.

Alex Moreno
  • 729
  • 3
  • 8
  • 14

1 Answers1

0

This should be a value in range [min, max] where min is either -1.0 or 0.0 and max is 1.0 though what you get from the texture might simply be an integer value which might need to be transformed (from 24-bit to 32-bit). If none confirms any of these you will need to test it yourself.

Anyway, these values min and max should represent the clipping planes so min = near and max = far due to the depth buffer optimisation. To get the true Z value from texture coordinate ZT then:

Z = near + ((far-near) * ((ZT-min)/(max-min)))

This Z then represents the distance from (0,0,0) from the user perspective this is the distance between object and the camera position.

Try looking for some literature.

Matic Oblak
  • 16,318
  • 3
  • 24
  • 43