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
TArray<FColor> Data;
auto DepthRenderTargetResource = DepthRenderTarget->GameThread_GetRenderTargetResource()->GetTextureRenderTarget2DResource();
DepthRenderTargetResource->ReadPixels(Data);
UE_LOG(LogTemp, Display, TEXT("some point: %f"), *reinterpret_cast<float*>(&Data[1000]) );
in the Tick method of an actor with
UPROPERTY(EditAnywhere)
UTextureRenderTarget2D* DepthRenderTarget;
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.