SceneCapture Depth as Texture
Hi, I want to get a depth map from a specific view. And I want it as texture because I want to be able to access the data in C++.
So I did the following setup. I placed a SceneCapture2D in the view I want. In the rendering settings it should render the scene into rgb and the depht into a-channel of a rendertarget: When It take a look at the render target, the rgb channels are good: but the alpha channel does not contain any depth map - it´s just white:
Am I doing something wrong? Or is there another way to do this? Thanks in advance!
asked Sep 20 '18 at 01:39 PM in Rendering
Ok yes it was the problem with alpha values > 1 because the depth was > 1 cm. I fixed it by creating a second material using only the alpha channel (where the depth value is written), divide it by my maximum distance I want and LERP to get a white is close, black is far image:
To look at the result, I placed two planes, one using a material with the rgb color, one using the lastly created with depth:
Note that the TextureRenderTarget has the format "RTF RGBA32f".
answered Sep 21 '18 at 11:47 AM
Follow this question
Once you sign in you will be able to subscribe for any updates here