How can I retrieve a depth texture from a different viewport?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By SIsilicon

You see, I’m making a denoiser for my volume renderer addon. But to do that, I need to render the volumes in a different viewport; in a different world. And I need the scene’s depth information to handle occlusion. I need to somehow access the scene’s current spatial viewport’s depth information, but I don’t know how.
Unless you know a way to make a denoiser.