I’m attempting to get depths that have been rendered to a UTextureRenderTargetCube. The problem I’m facing is that I can only seem to get the bottom face of the cube. Ideally I’d be able to get the direction of the pixel and its depth for all directions.
Here’s a section of code I’ve been using to scan for min/max depths. The min and max I get are always the camera’s distance above the floor plane.
TArray<FLinearColor> SurfData;
FTextureRenderTargetCubeResource* Target =(FTextureRenderTargetCubeResource*)(CubeTarget->GameThread_GetRenderTargetResource());
for (int side = 0; side < 6; side++) {
Target->ReadLinearColorPixels(SurfData, FReadSurfaceDataFlags(RCM_MinMax, (ECubeFace) side));
for (int i = 0; i < Target->GetSizeXY().X; i++) {
for (int j = 0; j < Target->GetSizeXY().Y; j++) {
FLinearColor color = SurfData[j * Target->GetSizeXY().X + i];
// ... Look for min/max in here...
}
}
}
Here’s the CubeTarget I’m reading from. It’s depth on the R channel.
https://forums.unrealengine.com/core/image/gif;base64
For what it’s worth, the cube map does render correctly when used in a material with InteriorCubeMap.