x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

How do you switch stereo rendering devices at run time?

Hello,

Engine version 4.4.3

I'm looking to switch stereo rendering between stereo and OVR devices at run time. Currently I am using the FFakeStereoRenderingDevice for use with 3DTV and the OculusHMD plugin for VR. My current implementation allows me to switch from 3DTV to OVR at run time with no problems, but when I switch back, the window appears to be stuck on the last frame rendered for the oculus renderer. I can hear audio and the game continues to run.

My current implementation creates both renderers when UEngine::InitializeHMDDevice() and stores shared pointers to each as members of the engine. then, in my player controller just swap which pointer is currently assigned to UEngine::StereoRenderingDevice

 bool UEngine::InitializeHMDDevice()
 {
     if( !GIsEditor )
     {
 
 
         if (FParse::Param(FCommandLine::Get(), TEXT("renderswitchenabled")))
         {
             // Start the rendering device in 3D
             TSharedPtr<FFakeStereoRenderingDevice> FakeStereoDevice(new FFakeStereoRenderingDevice());
             StereoRenderingDevice = FakeStereoDevice;
             Stereo3DRenderingDevice = FakeStereoDevice;
 
             // Start the HMD and don't enable or set it as the renderer
             if (!HMDDevice.IsValid() && !IsRunningDedicatedServer())
             {
                 // Get a list of plugins that implement this feature
                 TArray<IHeadMountedDisplayModule*> HMDImplementations = IModularFeatures::Get().GetModularFeatureImplementations<IHeadMountedDisplayModule>(IHeadMountedDisplayModule::GetModularFeatureName());
                 for (auto HMDModuleIt = HMDImplementations.CreateIterator(); HMDModuleIt && !HMDDevice.IsValid(); ++HMDModuleIt)
                 {
                     HMDDevice = (*HMDModuleIt)->CreateHeadMountedDisplay();
                 }
             }
 
             return StereoRenderingDevice.IsValid();
         }

As mentioned, when I switch from stereo to OVR HMD the switch occurs normally. However, switching from OVR to stereo doesn't seem to utilize the other device.

Is there a legitimate method for notifying the engine of a request to change rendering devices?

Product Version: UE older version
Tags:
more ▼

asked Jul 27 '15 at 07:23 PM in C++ Programming

avatar image

ZeroParadigm
275 8 9 16

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

1 answer: sort voted first

The solution was to add a second shared pointer to hold the reference to the hmd device when it wasn't in use. Then call

         // Reset the HMDDevice pointer to clear the HMD reference
         GEngine->HMDDevice.Reset();

to ensure that the engine does not think that HMDDevice is valid.

I would still be interested to hear if there is a more natural way to accomplish this behavior without altering the engine header and implementation.

more ▼

answered Aug 31 '15 at 02:29 PM

avatar image

ZeroParadigm
275 8 9 16

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question