NativeResource of RHITexture not a type of D3D11Texture2D?


i’m trying to ues the Facebook’s 360-Capture-SDK.

that sdk does not come from capture, it only supports ‘save’ functionality. i need to get the ‘ID3D11Texture2D’ type texture and give it to sdk.

So first we used a SceneCaptrueComponentCube to draw a RenderTarget of type CubeMap and we used a Material to draw a RenderTarget of type ‘LongLat’:

The result is a simple object that has been rendered as a texture.

but, get the NativeResource of the RenderTarget and save it via Sdk, then only the black image will be saved.

try saving the image in the way suggested in this topic works well. it does not mean I can not get a texture from the RenderTarget.

My code is this:

void CAPTURE_API UFBC_BP::SaveScreenShot(UTextureRenderTarget2D* rt)
    FString SavePath = FString(TEXT("C:/Users/user/Documents/cap/test.jpg"));
    FFBCaptureModule FBCap = FModuleManager::LoadModuleChecked<FFBCaptureModule>("FBCapture");

    FTextureRenderTarget2DResource* rtRes = (FTextureRenderTarget2DResource*) rt->Resource;

    void* nativeRes = rtRes->GetTextureRHI()->GetNativeResource();
    // SaveScreenShot(const void* texturePtr, const TCHAR* fullSavePath)
    // texturePtr is ID3D11Texture2D
    FBCap.SaveScreenShot(nativeRes, *SavePath);

is the NativeResource of RHITexture not a type of D3D11Texture2D? or is my procedure wrong?