[4.8] VR preview sometimes doesn't work, bad GPU-utilisation

Hey guys,
I’ve found the reason for the issue. The fix is available in Oculus-VR branch (https://github.com/Oculus-VR/UnrealEngine/tree/4.8), this commit: https://github.com/Oculus-VR/UnrealEngine/commit/cb729b8ed9508519e43787a23818f3a602959ba7

Basically, what is necessary to do is to move a couple lines in the Engine\Plugins\Runtime\OculusRift\Source\OculusRift\Private\HeadMountedDisplayCommon.cpp file, method bool FHeadMountedDisplay::OnStartGameFrame():

bool FHeadMountedDisplay::OnStartGameFrame()
{
	check(IsInGameThread());

	if (!GWorld || !GWorld->IsGameWorld())
	{
		// ignore all non-game worlds
		return false;
	}

	Frame.Reset();             // MOVE THESE LINES HERE
	Flags.bFrameStarted = true;// MOVE THESE LINES HERE

I’ll notify Epic guys to integrate this fix into 4.8 and main UE.

Many thanks.

I really don’t know why Epic wasn’t able or willing to fix this horrible bug more than 3 weeks now and leave us back with a broken VR preview instead.

So please at least accept this commit from Oculus and release a hotfix. I hope this isn’t too much work. :wink:

Thanks, that helped me too, testing was a nightmare on the rift because of this bug.

I hope this gets implemented asap too

Seriously, would you please push out this hotfix?

Hello ,

I did some digging and I have not found a pull request from Art_Oculus. I will ask around to see if he has mentioned this to anyone else. However, until he submits a pull request we cannot begin the process of consideration/implementation of the suggestion that he has provided above.

Yes, please? Please?

I talked to and the fix is already integrated via perforce into UE4 main (CL #2607744). However, I am not sure if it will be a part of 4.8.2 (I just don’t know).
I am not a big fan of github. I tried to create a pull request, but I can’t make it to select only one particular commit, it always wants to grab more commits into the pull request.

Hello Art_Oculus,

I received an email from , I am happy to hear that the fix was integrated. Thanks for following up with a response.

Make it a great day

Hi Rudy,

UE-17053 isn’t mentioned in the [4.8.2 release notes][1]…

And it’s still broken.


This is week 5 now with a broken VR preview.

Hello ,

I apologize for the miscommunication. I was referring to the integration of the solution into main (4.9). This issue did not make into the 4.8.2 hotfix as you said. However, I have included a link to the commit below if you would like to cherry pick this change list and integrate it into your project. You will need a source version of the engine if you don’t already have one. (I have included a link on how to build the engine from source). I have also provided a link to get you started on cherry picking change lists to integrate them into your project. I hope that this information helps.

Commit:

https://github.com/Crtriplett/UnrealEngine/commit/c6899b95de6c75f992249cefc97650c104621d57

Building from source

Video:

or

Documentation:

How to Cherry pick (This should get you started):

Make it a great day

1 Like

I just installed 4.8.3 and now just having one window does NOT fix the problem anymore.VR flashes for about 1 full second, with tracking and the warning message, then blinks again and becomes fully black. A mirrored window shows it working, but with no head tracking.

Hello ,

This issue has been resolved internally. I don’t currently have another workaround for this issue, however if you are working from a source version of the engine you could try integrating the change list (provided in a post below) from github into your project.

Running 4.9 rel 3 and still have the same issue, i can’t do any VR testing right now. This needs to be addressed.

Hmmm… I’ve check the source code of the 4.9-rel3 and the issue is definitely fixed there. I also use it a lot and I didn’t have any problems since the fix was applied…

Yes, preview is working in 4.9 again, but now the detection process is broken: [4.9 P1] "isHeadmountedDisplayEnabled" always reporting TRUE - XR Development - Epic Developer Community Forums

I see. Yup, I see that that method was changed in 4.9 for some reasons. It should use IsHeadTrackingAllowed() (or, IsHMDConnected()) method instead of IsHMDEnabled().

For me VR preview is still broken on 4.9, latest preview builds built from source. I was waiting for the 0.7 runtime to see if it made a difference and sadly the error is still there. Preview window goes black and nothing shows up on the HMD. Standalone builds are working perfectly however. I’ve rebuilt the complete engine source multiple times to no avail.

Can you provide with the .log file? (attach to the topic)?

Attached. The preview failing is when I launch the external preview window specifically and alt+enter. The in editor preview actually works every time. The logs attached show where it hangs or stops outputting logs before I kill it, the works log shows what happens when it randomly works, and the after launching log shows that if I launch and have it hang, then launch the oculus config tool and show the demo scene and hit escape the app will un-hang and actually show the scene perfectly. Of course UE4 is using the 0.6.0.1 SDK so maybe there is another fix in 0.7, but as it stands, even with the new runtime and 0.6 SDK I have that black screen hang.

Thanks again!