How to read float data from UTextureRenderTargetCube in the RenderThread

For a UTextureRenderTargetCube object, I can get valid floating-point data by the CubemapHelpers::GenerateLongLatUnwrap() function in the GameThread.

I’d like to read float data from the same UTextureRenderTargetCube object in the RenderThread. I was experimenting with the following pseudo-code

====== Code begins. ======
FRHICommandListImmediate& RHICmdList = GetImmediateCommandList_ForRenderCommand();
auto rt_resource = render_target_cube->GetRenderTargetResource();
if (rt_resource != nullptr) {
const FTexture2DRHIRef& rhi_texture = rt_resource->GetRenderTargetTexture();
FIntPoint size = rt_resource->GetSizeXY();

TArray<TArray<FFloat16Color>> float6

for ( int32 cube_face = CubeFace_PosX; cube_face < CubeFace_MAX; cube_face++ ) {
    RHICmdList.ReadSurfaceFloatData(
        rhi_texture,
        FIntRect(0, 0, size.X, size.Y),
        float6[cube_face],
        (ECubeFace)cube_face, 0, 0
    );
}

}
====== Code ends. ======

However, it seems that no valid data is saved in float6. What is the appropriate method for accessing the floating point data associated with the UTextureRenderTarget in the RenderThread?

1 Like