Jump to content

Black screen when starting the project with Wave VR plugin with HMD disabled in Unreal Engine 4.27


NikitaAksenov

Recommended Posts

Hi!

I'm working on a VR project using Unreal Engine 4.27.
It needs support of different VR HMD's and controllers, including VIVE Focus 3. That's why I've installed Wave VR plugin into my project several days ago.

I'm using SteamVR and for ease of debuging sometimes I start my project without HMD enabled. Setting Start in VR is set to true in Project Setiings, so when HMD is enabled it starts in VR, but often I just disable HMD and play the game without VR.
Before installing Wave VR plugin it all worked fine, but after installing it the game is trying to start in VR mode even with HMD disabled. At least as far as I can tell, because there are no image after starting the game, only black screen. The game is definetly started (I hear sounds from the game), but no image is rendered.

If I disable Start in VR, then it works fine, but then I need to implicitly tell the game to start in VR when I need to test it with HMD. I would like to avoid that.

Does anyone met this problem?

Thanks in advance!

Link to comment
Share on other sites

Hi @Johnson_Wu!

Thanks for your reply!

I've digged a little bit in our project and found logic that forces enabling stereo rendering if HMD is enabled.

Somehow, if WaveVR plugin is enabled, function 

UHeadMountedDisplayFunctionLibrary::IsHeadMountedDisplayEnabled()

returns true even if no HMD is connected.

If I disabled WaveVR plugin, then this function return false when no HMD is connected, and everything works as we expect.

I will look into WaveVR's realisation of IXRTrackingSystem interface, I think I can find an answer there.
If i will find anything worth sharing - I will submit it here.

Link to comment
Share on other sites

I've checked how SteamVR handles it tracking system and it fails with error VRInitError_Init_HmdNotFound.
You can debug and check that in bool Initialize() of FSteamVRPlugin implmentation.

When WaveVR creates it's tracking system it does not check if HMD is enabled, at least I cannot find it. And so it always creates it, and this is not right, as far as I can tell.

Link to comment
Share on other sites

I've seem to find a solution for my particular problem.

I added check like in SteamVR plugin into TSharedPtr< class IXRTrackingSystem, ESPMode::ThreadSafe > FWaveVRPlugin::CreateTrackingSystem() to check if our VR system can be initialized and now it works as I want.

This is the code:
 

TSharedPtr< class IXRTrackingSystem, ESPMode::ThreadSafe > FWaveVRPlugin::CreateTrackingSystem()
{
  	// Custom logic --- Start
	// Used logic from FSteamVRPlugin::Initialize().
	vr::EVRInitError VRInitErr = vr::VRInitError_None;
	vr::VR_Init(&VRInitErr, vr::VRApplication_Other);
	if (VRInitErr != vr::VRInitError_None)
	{
		LOGI(WVRHMD, "Failed to create tracking system, OpenVR error code: [%d]", (int32)VRInitErr);
		return nullptr;
	}
  	// Custom logic --- End
	
	TSharedRef< FWaveVRHMD, ESPMode::ThreadSafe > WaveVRHMD = FSceneViewExtensions::NewExtension<FWaveVRHMD>();
	FWaveVRHMD::SetARSystem(WaveVRHMD);

	return WaveVRHMD;
}

 

Link to comment
Share on other sites

Hi @NikitaAksenov,

Glad you found the solution and thanks for your code snippet feedback.

The reason why the HMD is always enabled is that because WaveVR is only for a standalone device, we will not check if the headset is connecting to PC or not. And we assume there is no other VR plugin that was enabled.

Again, thanks a lot!

  • Like 1
Link to comment
Share on other sites

Hi @Johnson_Wu,

Thanks a lot for explaining the reason behind this plugin! Now it's much clearer to me.

In our project we need to support as much HMD's as possible, and Focus 3 was fairly recent addition to our requirements. We cannot ignore other VR plugins so I have to use that hack, but maybe it will help someone in the same situation as myself.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...