Download

Exporting SceneDepth Images

Hi All

I’m trying to export SceneDepth in R images (using a blueprint) for a machine learning application. I know that the render target has to be set to RTF R32f and that the image cannot be viewed directly. To get around this, I’ve made a material which uses the render target as a texture sample and normalizes the output values, so that it makes sense in gray scale (see here: What does DeviceDepth option under SceneCaptureComponent2D capture? - UE4 AnswerHub).

The problem is that this new correctly normalized data cannot be exported to a png or bmp image, I’ve tried both drawing the material to a new render target and exporting that as well as making a texture from the material and exporting that, neither of which work. The image exports but is either solid black (for render target exports) or unreadable (for texture exports), no matter what render target format is selected. In the UE4 editor everything looks correct and the various render targets, materials and textures all update correctly, it is only the export which isn’t working.

If I export the texture manually from the content browser it works fine but I can’t do that for every image.

Thanks

What’s the depth of the PNG? 8bit? Is everything in range of 0-255? 16bit?
Have you tried saving as EXR? (floating point)
Is it possible to setup sequence to render? If so you can choose to render a depth pass to EXR format.

So I found that I couldn’t make PNG work, only HDR, when exporting using Export Texture 2D. HOWEVER, the actual in game distances (which are what I’m after) are not preserved. Instead, the image is re-normalised too between 0-255 and the absolute depth information is lost.

Having the same issue with recovering actual depth values in each pixel, did you manage to resolve the issue?