Disable tonemapping for SceneCapture2D

When rendering SceneDepth to texture using SceneCapture2D and a post-process material, I’m getting tonemapped depth values.

Prior to 4.8, I was able to correct for these by raising the values to the 2.2 power. With 4.8, I can’t seem to correct for the tonemapping going on.

As a test, I have my material producing a constant value of (2, 20, 200) instead of the depth, but the output is (21, 79, 225). If I apply the fix that worked prior to 4.8, I get values of (0, 12, 202). It seems that something has changed in the blacks.

Thanks!

For those of you struggling like me, here is a solution I stumbled upon.

When pulling the data from the render target, set the following flag:

FReadSurfaceDataFlags Flags;

Flags.SetLinearToGamma(false);
RHICmdList.ReadSurfaceData(
    SrcRenderTarget->GetRenderTargetTexture(),
    Rect,
    OutData,
    Flags
 );