[4.9 P1] "isHeadmountedDisplayEnabled" always reporting TRUE

Hi there,

VR preview seems to work again (yay!) but now the node ‘isHeadmountedDisplayEnabled’ doesn’t work as before as in the previous versions:

Reproduction:

  • Switch Oculus Rift ON
  • Start project
  • VR preview is active, isHeadmountedDisplayEnabled returns TRUE
  • Switch Rift OFF
  • Start normal PIE session (non-VR)
  • isHeadmountedDisplayEnabled reports still TRUE (should be FALSE)

This essentially means two things:

  • If Rift WASN’T switched on when UE4 starts, it will never be detected
  • If Rift WAS switched on when UE4 starts, it will always be reported as enabled, even when switched of

BTW: We have still no ability to determine if the Rift is available (but currently switched off), maybe that’s an SDK-issue. Events like HMDEnabled and HMDDisabled would also be very useful, so we could switch to VR mode automatically, apply special graphic settings, change controls and so on.

Hello ,

I was able to reproduce this issue on our end. I have written up a report ( UE-19533) and I have submitted it to the developers for further consideration. I will provide updates with any pertinent information as it becomes available. Thank you for your time and information.

Make it a great day

Thank you. How are the changes to get this fixed for the final? As you know, 4.8 was quite problematic for VR developers.

Hello ,

I am assuming when you say final that you mean the release for 4.9. It’s too early to have a time frame for the resolution of this issue. I am a little unclear as to what it is you are asking exactly. I hope that answers your question.

Er, not really? :wink:

I basically just wanted to know if basic VR functionality (like detecting if there is actually a HMD enabled or not) will be working in the final, when UE 4.9 will be released or if it will be handled like in UE 4.8 where this obviously wasn’t that important (and wasn’t fixed during the whole lifetime of this version). That’s all.

In other words: Is something like this important enough to be fixed? Is this more like “Of course this will work again in the final” or “Maybe, let’s see…”?

Don’t get me wrong, it’s not about creating pressure (how could I?), it’s just that I simply have no clue, how important this kind of bugs really are internally, especially since 4.8 which just, well, changed my expectations in some ways. Maybe I am just a little bit too - enthusiastic - about VR after all these months.

Hello ,

To answer your question about priority, VR is high priority for Epic and we have a lot staff working to improve this section of the engine. That being said, priority can shift depending on the severity of other issues. Crashes and show stoppers tend to take focus. This is especially true for hot fixes. So there is no solid timeline for improvements. This is not to say that 4.8 did not have a a bumpy release as it relates to VR. We appreciate you enthusiasm towards VR, the information and feedback helps us improve and optimize this feature.

Make it a great day

Seriously, it feels like we really, really need this long-waited, public, read-only bugtracker along with a voting system for the dev community or something like that. You then still can decide what you do with that feedback.

For now, I still don’t know if this bug is planned to get fixed for 4.9 (final). I really appreciate your answer but it’s hard to plan when this essentially means 'We’ll see, just wait for the final, maybe it’s gonna be fixed then."

But thanks anyway.

Looking at the function it returns true if there is a valid pointer to the device as well as isHMDEnabled() returning true.

bool UHeadMountedDisplayFunctionLibrary::IsHeadMountedDisplayEnabled()
{
	return GEngine->HMDDevice.IsValid() && GEngine->HMDDevice->IsHMDEnabled();
}

IsHMDEnabled() just returns the bool bHMDEnabled.

bool FHeadMountedDisplay::IsHMDEnabled() const
{
	return (Settings->Flags.bHMDEnabled);
}

What is strange is that they dont seem to be using bHMDEnabled for its original purpose acording to the comments.
If that is or was its purpose it was poorly named.

HeadMountedDisplayCommon.h

/** Whether stereo is currently on or off. */
    			uint64 bStereoEnabled : 1;
    
    			/** Whether stereo was enforced by the console command. Doesn't make sense w/o bStereoEnabled == true. */
    			uint64 bStereoEnforced : 1;
    
    			/** Whether or not switching to stereo is allowed */
    			uint64 bHMDEnabled : 1;

In the meantime you could always modify the function in Engine\Source\Runtime\Engine\Private\HeadMountedDisplayFunctionLibrary.CPP

From,

bool UHeadMountedDisplayFunctionLibrary::IsHeadMountedDisplayEnabled()
{
	return GEngine->HMDDevice.IsValid() && GEngine->HMDDevice->IsHMDEnabled();
}

To,

bool UHeadMountedDisplayFunctionLibrary::IsHeadMountedDisplayEnabled()
{
	return GEngine->HMDDevice.IsValid() && GEngine->HMDDevice->IsStereoEnabled();
}

Consider this a temporary hack rather than a fix as I have’nt had a proper look at the code as all those virtual functions make my head hurt. :slight_smile:

Many thanks. I’ll link that from the Oculus Forum as well, maybe this fix could be integrated in the Oculus Branch of UE4: https://github.com/Oculus-VR/UnrealEngine (currently the recommended source for a working VR-integration).

See https://forums.oculus.com/viewtopic.php?f=60&t=25640&p=290512#p290512

I agree. That method was changed in 4.9. Previously that method looked like this:

bool UHeadMountedDisplayFunctionLibrary::IsHeadMountedDisplayEnabled()
{
return GEngine->HMDDevice.IsValid() && GEngine->HMDDevice->IsHeadTrackingAllowed();
}

I am not sure why it was changed to return IsHMDEnabled (which is pretty useless anyway).