Developer Notes

The correct solution for this is to simply set r.SceneRenderTargetResizeMethod to 2 instead of the default of 0 when there are intermediate render targets used for scene captures.

Description

Using SceneCapture in packaged VR projects causes poor performance.

Also observed with SceneCaptureCube

Does not occur in 4.18

Steps to Reproduce

1. Create a new project in 4.19
2. Create a RenderTarget2D in the Content Browser. Set it to 256x256 size. Any size will work as long as it's different to native HMD resolution. Eg, anything other than 2720x1600 for Oculus.
3. Make new Starter map, place a SceneCapture2D in it, and assign the RenderTarget to its TextureTarget property. Ensure CaptureEveryFrame and CaptureOnMovement are both ticked. (Or alternatively, manually call CaptureScene() every Tick).
4. Launch a "VR Preview" PIE session. Note the framerate should be smooth.
5. Make a packaged build in the Development configuration, launch it. The framerate should drop due to RenderTarget allocation every frame. In Shipping configuration, framerate is still lower than PIE.

Close the packaged build, and check its generated log file. There should be lines resembling the following, output every frame.

[2018.05.10-00.43.43:520][982]LogRenderer: Reallocating scene render targets to support 256x256 Format 10 NumSamples 1 (Frame:6984).
 [2018.05.10-00.43.43:540][983]LogRenderer: Reallocating scene render targets to support 2720x1600 Format 10 NumSamples 1 (Frame:6984).
 [2018.05.10-00.43.43:540][983]LogHMD: Allocating Oculus 2720 x 1600 depth rendertarget swapchain
 [2018.05.10-00.43.43:579][984]LogRenderer: Reallocating scene render targets to support 256x256 Format 10 NumSamples 1 (Frame:6985).
 [2018.05.10-00.43.43:579][984]LogRenderer: Reallocating scene render targets to support 2720x1600 Format 10 NumSamples 1 (Frame:6985).

Have Comments or More Details?

There's no existing public thread on this issue, so head over toAnswerHub just mention UE-59090 in the post.

12
Login to Vote

Non-Issue
ComponentXR
Affects Versions4.19.2
Target Fix4.20
CreatedMay 14, 2018
ResolvedMay 18, 2018
UpdatedMar 9, 2020