Reputation: 65
I'd like to know how to get distance information from z-buffer (or depth buffer) in this way: based on my viewpoint I'd like to extract the distance as a 3x3 distance matrix of the objects in front of the viewplane. Is it possible?
Also is it possible to get the same information from another cop even if I am rendering in a completely different cop?
Upvotes: 0
Views: 543
Reputation: 39370
You can't get information from the depth buffer other way that it is stored in it - as a depth value for each destination buffer (screen) pixel. If you'd like to calculate the distance to other objects from a given point, you could extract the data and reload it into another shader (or just to CPU-available array in memory), calculating the lenghts.
Upvotes: 2