x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

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: alt text When It take a look at the render target, the rgb channels are good: alt text but the alpha channel does not contain any depth map - it´s just white: alt text

Am I doing something wrong? Or is there another way to do this? Thanks in advance!

Product Version: UE 4.19
Tags:
more ▼

asked Sep 20 '18 at 01:39 PM in Rendering

avatar image

DaKenpachi
74 3 6 9

avatar image DaKenpachi Sep 21 '18 at 11:32 AM

Ok after a little research I think I might know what the problem is. The Depth Stream (comming from SceneDepth or PixelDepth or whereelse) is always the distance in cm. So, the every pixel in the depth scene has a value > 1 because its at least a few cm away - but when you cast this to a color, you just see white.

I have two options now: finding an option in SceneCapture2D where you can set a depth divider (to get the max depth and a value from 0 to 1 - see here: https://answers.unrealengine.com/questions/723922/scene-depth-capture-does-not-work.html) Or use some code or blueprint to access the pixel values and divide them manually (or at least see whether I am right anyway).

I´m gonny keep updating

(comments are locked)
10|2000 characters needed characters left

1 answer: sort voted first

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: alt text

To look at the result, I placed two planes, one using a material with the rgb color, one using the lastly created with depth: alt text

Note that the TextureRenderTarget has the format "RTF RGBA32f".

more ▼

answered Sep 21 '18 at 11:47 AM

avatar image

DaKenpachi
74 3 6 9

avatar image Zeclown Nov 06 '18 at 05:01 AM

Thank you so much, I thought I was going crazy!

(comments are locked)
10|2000 characters needed characters left
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question