UTextureRenderTarget2D::ResizeTarget crashes when called multiple times

I am using the following function to resize a RenderTarget.

UTextureRenderTarget2D::ResizeTarget

However the game crashes if I call this function in a Tick() function or if the function is called consecutively in a short period of time. I believe this crash happens if I call the ResizeTarget function before the RHI command finished.

Does anybody know how I can prevent this crash or how can I check if the RHI command has finished ?

I managed to solve this issue with the following code

CameraCapturedScene->TextureTarget->ResizeTarget(SizeX, SizeY);
CameraCapturedScene->CaptureSceneDeferred();
FlushRenderingCommands();    // prevents crash

Also make sure the you have the following:

  • SizeX and SizeY are not greater than 2048
    • seems to be the max size limit for render targets. Higher values seems to work but they cause lag. I believe it’s related to the VRAM of your gpu (I’m on 8gb VRAM, 48gb ram)
  • bCaptureOnMovement and bCaptureOnMovement is set to false

From what I searched up if you want to achieve higher resolutions for your render target you need to split the image in multiple render targets. It seems Movie Render Queue has this option but I am not sure if it can be done from C++, and in real time.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.