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"

Simulate depth camera. Depth settings not working as expected


I'm trying to simulate a depth camera.

After some research I found that this should be possible with a ASceneCapture2D object and set CaptureSource to SCS_SceneDepth or SCS_DeviceDepth.

Following this post SCS_SceneDepth should output values in cm, but I get values in [0,1]. The calculation with SCS_DeviceDepth seems to work (but alpha is always 1).

I setup the TextureTarget as following:

 renderTarget = UCanvasRenderTarget2D::CreateCanvasRenderTarget2D(GetWorld(), UCanvasRenderTarget2D::StaticClass(), PictureResolutionX, PictureResolutionY);
 renderTarget->bHDR = 1;
 renderTarget->InitAutoFormat(PictureResolutionX, PictureResolutionY);

And read the pixels in the FLinearColor struct.

If I read the red value of a SCS_SceneDepth pixel I get values in [0,1] on the contrary to the promised cm values. This wouldn't be a problem by itself, but the [0,1] values from SCS_SceneDepth (and also from SCS_DeviceDepth) don't seem to be linear, so I don't know how to convert them back to cm values.

As I'm trying to simulate a max range on the camera this is a problem. I need to scale the values that the colors white to black map linear from 0cm to e.g. 350cm.

I tried to make some measurements with accurately placed planes and discovered an other problem. The cm range behind the [0,1] values do not seem to be static. If a plane fills the whole field of view the values get rescaled so that the planes is displayed in white.

So my Questions are:

  1. How to I read the cm values from a SCS_SceneDepth pixel?

  2. As I would like to have the best possible precision. How to i convert the [0,1] values back to cm?

  3. And last how do I prevent the above described rescaling?

Thanks for any information to my questions. I found near to nothing to this topic that seems to work and site like this are not helping at all.

Product Version: UE 4.16
more ▼

asked Oct 27 '17 at 10:18 AM in C++ Programming

avatar image

6 1 1

avatar image pygospa Jul 02 '18 at 02:04 AM

Hi, as I am working on something similar - did you manage to find a solution? If so, might you share your findings?

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

0 answers: sort voted first
Be the first one to answer this question
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