[VR][Vive] FViewExtensionPreDrawCommand pulsing with huge cost
There are already threads that encountered this problem, but the issue seems to occour on different scenarios. https://forums.unrealengine.com/development-discussion/rendering/112255-serious-proformance-issue-when-use-4-15-forward-shading-pipeline-with-msaa
This issue only seems to occour when using the HTC Vive.
We are creating actors at runtime dynamically and merge them together. How big the scene gets, is up to the user. The more objects are created, the more annoying the issue gets. However, it is not only related to the number of objects in the scene. If viewing the objects from afar (no LODs here), the scene might render without issue and 90FPS. When viewing part of the exact same scene up close, the FViewExtensionPredrawCommand starts to pulse with high cost. The closer to an object, the stronger the pulsing (more pulses).
From the profiler: Here is you can see the high cost for FViewExtensionPredrawCommand. The render time itself seems fine ~4ms.
This also shows that the issue persists not only for some single frames, but for multiple seconds once it started. Note: The camera has been kept steady as much as possible.
In the code: Which results in this function beeing called: Which again tells the views that rendering is going to start and the views can do something now. Which again results into VR device transform updates and late update for objects in the scene (no late update objects on our end).
As stated in one of the linked posts, the issue seems to be related to the VR Compositor for the Vive (SteamVR in this case) and getting data from it. Which makes it more confusing. Why is the compositor going slow in case the player is close to an object, when the compositor is not aware of the scene beeing rendered (nor is the tracking system) at all?
I would do a more precise breakdown of the costly code by placing timers, but it is engine code and we do not have a custom build.
See my other posts above.
TLDR: In other words: FViewExtensionPreDrawCommand displaying with 7ms for the VIVE, means you still have 7ms more time on the RenderThread to do stuff, as long as it is enqueued in the RenderCommandQueue before FViewExtensionPreDrawCommand.
If you get this frame pulsing from the picture in the first post, and high value for FViewExtensionPreDrawCommand, means the RenderThread is fine (most likely). You need to either optimize the GameThread or GPU time.
Follow this question
Once you sign in you will be able to subscribe for any updates here