Hello everyone,
I’m having a bit of a problem with getting the data out of a TextureRenderTarget2D with the format RTF_R32f. I can’t find a perfect match for that problem in the methods of any related class and when I do
in the header I get an exception. When setting breakpoints it seems to crash at the line with the ReadPixels(Data).
I would just like to have a virtual depth camera in Unreal without the RGB luggage.
I tried to use your solution, but I am confused on how you managed to get anything in your data code based on what I have read here. To my knowledge you are doing:
//start
TArray Data;
auto DepthRenderTargetResource = DepthRenderTarget->GameThread_GetRenderTargetResource()->GetTextureRenderTarget2DResource();
DepthRenderTargetResource->ReadPixels(Data);
for (auto& Color : Data) {
auto depth = Color.FromRGBE().R;
// …
}
//end
But I also get an exception thrown when I try to run ReadPixels.
I am curious what portion I am missing, because I have been stuck on this for hours now.
Set CaptureSource = ESceneCaptureSource::SCS_SceneColorSceneDepth;
Set RenderTargetFormat = ETextureRenderTargetFormat::RTF_RGBA32f;
Use Color.A As Depth