Migrated a C++ plugin from UE4 to UE5. How to access scene depth texture (via FSceneTextures in RDG?) in UE5.1 C++ ?

Hi, I updated my Unreal plugin from UE4 to UE5.1 and now I don’t know how to access the scene depth texture.

In UE4, I use

FRHICommandListImmediate& RHICmdList = FRHICommandListExecutor::GetImmediateCommandList();
FTexture2DRHIRef depthTexture = FSceneRenderTargets::Get(RHICmdList).GetSceneDepthTexture();
// rendering code
// RHICmdList.BeginRenderPass...

to access the scene depth texture. But FSceneRenderTargets is deprecated in UE5.1 and FSceneTextures is suggested. I’m not familiar with RDG and I couldn’t figure out how to access scene depth texture via FSceneTextures.

What’s more, in the docs of RDG FSceneTextures is not even mentioned. I tried to find some examples of FSceneTextures in the source code of UE5 but it didn’t work out.

1 Like

Hello, have you found the solution? Looking forward to your reply!