Theoretical Performance

Recently I’ve been trying to get the highest framerate possible because DK2 has ~75 hz refresh rate and maintaing 60-75FPS is very important. Using 4.2 And to a little bit better success (on 4.3 source, because update SDK and nice rendering changes). I have not been able to get above ~40 fps no matter the settings, configurations. I’ve tried Using most of the suggestions from ( https://docs.unrealengine.com/latest/INT/Engine/Rendering/Scalability/ScalabilityReference/index.html ). I only bring this up cause i can get the game to have really nice performance increased with 120-150FPS without VR mode. But as soon as stereo is turned on its almost as if vsync is set for ~30 (doesn’t get higher or lower).

Current Setup:
GTX 680 SLI (i know sli is not supported but boy i wish it was ._.)

I’m mainly looking for the designers/render team to weigh in on what they utilize to maximize performance and what settings are almost required for a good VR experience (Ex: what settings or best practices were used for Couch Knights). Will we see this get better without making scene look terrible/unrealistic?

I would hope to think that a GTX 680 would have enough horsepower to easily run in stereo with a bare minimal scene at atleast 60-75 fps

I’ll ping the designer from Couch Knights to come in and talk about how we got such a high framerate with that, but thought I’d chime in to talk about why there’s a bigger drop going to stereoscopic.

The biggest frame rate killer is that when the VR headsets are enabled, we flush the current frame at the end of rendering, instead of letting the driver buffer up frames. This does wonders for reducing latency, but it does cost framerate. In practice, this costs about 30% - 40% of your total frames. Additionally, depending on what you have your screen percentage set to, this can cost frames in exchange for graphical fidelity. To play with that, you can use “hmd sp 100” in the console. Using a higher number will use a bigger buffer and slow things down, and using a lower number will speed things up but make them appear lower quality.

Your best friend with this stuff is the graphics profiler, which you can use by hitting Ctrl + Shift + Comma. That will let you see what’s costing you lots of frame time, and hopefully point you towards some easy things to fix in your scene.

Finally, when you go into stereo mode with the HMD, it automatically turns vsync on. So, it may very well be locking your framerate to 30. You can try turning it off with r.vsync 0 to see if you get more frames. When you plug in the DK2, the vsynced framerate should be at 75.

HMD SP 100 is what i was looking for, as soon as i used “hmd sp 100” fps instantly jumped to ~90-100 fps and like you said the fidelity went down (which is perfectly fine till i can tune the settings/scene look at the profiler and get a nice balance). But It would be good to see how the Couch Knight people got “the best of both worlds” to maximize the user experience. I know it was briefly discussed about maybe releasing it :stuck_out_tongue: as far a “best practices” for vr template/demo (with regards to UE4).

For those who also may be visiting this, this is also helpful: https://www.youtube.com/watch?v=2aVJWIrvunM

Ahh yes! Thanks Nick this is what i was looking for, the graphics profiler (google failed me!). This helps a bunch! Possible Suggestion: It would be a little helpful for this to be added as a quick link or embed in that documentation page (since its about many of the graphical scaling configs, which usually goes hand in hand with performance/profiling).

It seems like its disabled by default, or i turned it off a while back and it saved.

Subscribing to this thread. Should be some performance tuning coming up with the release of DK2.
Running a 780Ti but still concerned about potential dips below 75hz. TimeWarp implementation will be helpful.

Currently 4.3 Github source is using the latest SDK (3.2 preview). It looks and “feels” better, and that includes timewarp (i think they are still working on a couple things in regard to timewarp). But 4.3 will be a nice release for VR, and Rendering in general for UE4.

After the release of 4.3, I’ll be sure to try to create a quick guide with a good guidelines for developers working with VR. Mainly focusing on the UE4 specific aspects of VR development.

Note: HMDwarp has been changed/removed so it won’t work for those that try it.

Is Couch Knights going to become a Marketplace example per chance?

Glad those tips helped out! I just realized that the content guy from Couch Knights is on out of the office at the moment, so it might be a week or two before he chimes in :slight_smile:

Yes! We’re going to make sure to release this soon for you guys as a free content example. Look for it in a few weeks!

Correct, the 4.3 preview does not currently include time warping, because of some integration changes we’re making to the engine to better enable the functionality. However, if you’re really interested, you can get the code directly from Oculus as a patch. However, that patch is likely to change with the official integration of timewarping into main, so please only do that if you’re confident you can handle the code merging :slight_smile:

A friend has a different approach to creating 3D than in the vanilla UE4, which coincidently was something Carmack was experimenting with a few years back (although it’s not clear if he continued using it. Rather than drawing the two different view one at a time he uses the geometry shaders to draw each object twice with minimal CPU overhead and no extra draw calls.

He ported the technique to UE4 a few months back and released a playable demo & code (you’ll need Visual Basic so you can compile the Code) for anyone to download.

https://developer.oculusvr.com/forums/viewtopic.php?t=8032

It’s worth grabbing this demo seeing if his method has significant gains for you.

Very useful document on optimizing the engine for high framerate, by our very own Joe Conley:

https://docs.google.com/document/d/14m3ETemiIXkAwcZhkV7CTZv2k5qb0VhXwr79jT5zH3I/edit#

Thanks for that Nick (and Joe!)

Will study for sure!

Would be interesting to know how fast one could expect to get UE4 going if one were to strip it down as much as possible (without resorting to digging into the source.) Would anything close to UT99/Q3 be possible, or is there simply too much unavoidable overhead in the more modern engine pipeline to get anything like that.

Nick, any chance the Couch Knights designer is available to chime in on this topic? My team is considering whether to use UE4 for an upcoming two year VR project and a big sticking point is the engine’s performance for high frame rate applications.

Couch Knights is holding a solid 120 FPS+ on our dev machines, and so far we think it’s due to some kind of black magic :slight_smile:

Any guidance would be much appreciated.

120 fps? may I ask what kind of system you have? I can only get a very unstable mayb if the sun and the stars are aligned correctly 15 to 30 fps… with all kind of tricks I tried from lots of different forum posts… really slowly i’m beginning to think UE4 engine is not going to work for me.

I can play really all kind of demo’s with enough fps (non UE4) but with UE4 I can’t do anything, a simple box with a 256pixel texture is already way to demanding on dk2

UE4 seems not the best engine for stereo mode (like Unity or other modern engine) but if you get 15-30fps in couch knights what do you need its new graphic card.

Do you know if/when the HMDwarp command will be returning to the engine? Because it seems all HMD commands, including hmd sp, no longer work in 4.4

“hmd sp” works for us in 4.4 (LandscapeMountains).
We got our GTX780 Ti today and can run CouchKnights 4.3 now at 75fps (DK2, hmd sp 150).
LandscapeMountains 4.4 runs for us now at around 28fps (DK2, hmd sp 130) and also doesn’t get much faster when reducing the screen percentage.

Oh, interesting, I am getting “invalid command” in the 4.4 build of my project, are you using the 4.4.1 preview, or does it only register the command if there’s a HMD attached?

4.4.0 have ‘hmd sp’ too.

Don’t be discouraged! There are ways to get this great engine to work well for VR’s high FPS requirements. Hopefully something in the write-up below will prove of use to you or others.

To clarify my previous comment, we removed all game functionality from Couch Knights when we ran our 120 FPS test. We wanted a proof of concept that a standalone detailed indoor environment can reach 120 FPS in VR on the DK2 in UE4.

Couch Knights at high FPS in VR - What we learnt
The most important optimization made in Couch Knights to have it run so well in VR, from our analysis, was the PostProcessVolume3 found in the scene outliner. Once you select it, on the details page you can see how the designer masterfully adjusted the graphic settings downward while keeping a great look and feel for the scene. If you simply float out of the Couch Knights apartment and cross the PostProcessVolume3 box, you’ll see graphics get bumped up.

System specs
DK2 Rift
GPU: GTX 680 SLI (though SLI was disabled for the test, i.e. it ran on one card)
CPU: i7-3820 3.6GHz
Monitor: 120hz 1080p
Windows 7
Couch Knights for Unreal Engine 4.3 (from UE4 Marketplace)
Opened in Unreal Engine 4.4
Oculus SDK v0.4.1 Beta (OVR service was disabled)

Three key points

  1. We removed all code/blueprints/scoreboards from the game and adjusted the player start so that we could move around the room. We also removed the two guys in the room as this was an environment proof of concept
  2. We launched the game standalone, not from the editor, but from windows explorer (file system)
    a. Launching the game from the editor, as has been previously pointed out, will mean considerably lower FPS
  3. We measured 120 FPS after launching the game, bringing up the console (with the “`” keyboard key), typing “stat fps”, then “stereo on”
    a. The window was kept on the 120hz monitor, not the DK2. Sending the screen to the DK2 capped us at 60/75 FPS, i.e. DK2 screen refresh rate

Hope this helps. To further optimize your levels during run-time, we found this documentation link to be very useful:
https://docs.unrealengine.com/latest/INT/Engine/Rendering/Scalability/ScalabilityReference/index.html

Also, the VR community has thankfully put together a number of guides to help with getting better FPS out of UE4, though keep in mind a setting or two advised below might not work anymore with newer UE4 versions:
http://www.reddit.com/r/oculus/comments/24g92u/guide_to_getting_good_fps_and_quality_in_ue4/

Great post Chrono!