Download

Texture type conversion

Hello everyone!

I am currently working on developing a plugin for a (already released) game which uses the Unreal Engine 3.5.
Since I am used to writing my own game engines more from scratch using C++ and DirectX, I have had to teach myself the Unreal Engine on the fly.
But I have now encountered a problem I cannot find a solution for, hence this forum post.

In my plugin I have to manually access the main render target after the entire scene is rendered. I think I have accomplished this by using the functions:
GSceneRenderTargets.GetRenderTargetTexture(SceneColor)

The current problem is that the texture returned by this function is of the type FTexture2DRHIRef and I need to be working with DirectX textures, specifically of the ID3D11Texture2D type.
I have searched for a while and found nothing useful, so I thought I’d ask here. Does anyone know of a good method for converting FTexture2DRHIRef textures to ID3D11Texture2D textures?
(!) Note that I am not working in Unreal Engine 4, but Unreal Engine 3.5! I do not have the option to upgrade to UE4.

Any answers would be much appreciated! :smiley:

Trying to access the RT on the CPU, right?

I have not tried this yet, but DanielW told me about this function. I briefly looked at it and looks to just return a rectangle from a render target. He said you may need to handle blocking the game thread etc but I haven’t looked into those details yet.

RHIReadSurfaceData

edit just saw your detail about UE3. No idea if this function exists there, sorry.

The function GSceneRenderTargets.GetRenderTargetTexture(SceneColor) returns a FTexture2DRHIRef, which I think is the RT, If I can convert this texture to a ID3D11Texture2D I can use it, so I’m mainly looking for a method of conversion.

[Edit]: RHIReadSurfaceData does not seem to work in Unreal Engine 3.5 sadly.