/ Forums
New To The Forum? Click Here To Read The How To Guide. -- Developers Click Here.

Unity Plugin 0.4.4 for Linux

taphostaphos Posts: 15
edited March 2015 in General
As 0.4.4 version is out the Unity plugin now contains libOculusPlugin.so (64 bit only), which means the plugin should work on Linux.
I've managed to run my project on Linux but FPS is very low, do anyone got it working properly?

My steps are:
* Build project for Linux 64bit platform
* Using Ubuntu 14.10 open Nvidia X settings
* Set oculus as a separate primary display with left rotation
* Enable syncing oculus display 'export __GL_SYNC_DISPLAY_DEVICE="DFP-1"'
* Start oculusd and run game from oculus display

Game runs fine and positional tracking working but FPS never goes above 40 which makes it unplayable.

I also tried to set oculus display as an independent X screen but it didnt help.
LINUX_README suggests to disable the display rotation and use ovrDistortionCap_LinuxDevFullscreen distortion cap instead, but I it seems Unity plugin does not expose the required API.

I would greatly appreciate any help.

Comments

  • vrdavebvrdaveb Posts: 1,557 Oculus Staff
    The Linux plugin is indeed part of 0.4.4, but it is experimental. Stability should improve in a future release. It looks like you set things up fine. Right now, I'm seeing similar frame rate issues, too. You may be able to avoid them by turning off vsync and timewarp stalls. You can also set ovrDistortionCap_LinuxDevFullscreen from C#. Just do the following in one of your Start methods:
    OVRManager.display.distortionCaps |= 0x200 /*In lieu of Ovr.DistortionCaps.LinuxDevFullscreen*/ | Ovr.DistortionCaps.ProfileNoTimewarpSpinWaits;
    
    uint caps = OVRManager.capiHmd.GetEnabledCaps();
    caps |= (uint)HmdCaps.NoVSync;
    OVRManager.capiHmd.SetEnabledCaps(caps);
    
    This still might not work. We will continue to improve the plugin's Linux support and let you know when it's ready for broader use.
  • SyylkSyylk Posts: 13
    taphos wrote:
    As 0.4.4 version is out the Unity plugin now contains libOculusPlugin.so (64 bit only), which means the plugin should work on Linux.

    [...]

    This must be the newbiest of the questions. Where is that lib? I don't have it in the linux SDK nor in the unity zip file. What am I doing wrong?
    Sys: i7-4790K / 32GB / GTX770 / Kubuntu 14.04.1 (krn 3.13.0, nv 346) / SDK 0.4.4B / DK2
  • haagchhaagch Posts: 95
    Syylk wrote:
    This must be the newbiest of the questions. Where is that lib? I don't have it in the linux SDK nor in the unity zip file. What am I doing wrong?
    Maybe it's hidden in OculusUnityIntegration.unitypackage somewhere or so. In any case, when you export a 64 bit unity application for linux, it should land in yourproject_Data/Plugins/x86_64/libOculusPlugin.so
    As has been said, it's only for 64 bit and unity won't do that for a 32 bit linux build.
    In any way, it should happen pretty much automatically.



    As for the topic: I guess you already tried it, but with
    -screen-quality Fastest
    and
    -screen-quality Fantastic
    I get both exactly 30 fps in my simple "first steps with unity" application and neither my cpu nor my gpu is anywhere near full usage.
    With a windows build and wine and -force-opengl I get pretty much stable 75fps, but head tracking is significantly worse with the oculus-wine-wrapper hack than even on the 30 fps native build. :/
  • SyylkSyylk Posts: 13
    haagch wrote:
    Maybe it's hidden in OculusUnityIntegration.unitypackage somewhere or so. In any case, when you export a 64 bit unity application for linux, it should land in yourproject_Data/Plugins/x86_64/libOculusPlugin.so
    As has been said, it's only for 64 bit and unity won't do that for a 32 bit linux build.
    In any way, it should happen pretty much automatically.
    I see.

    Uhm, so the godzillion of Unity demos/games claiming linux support but NOT having that shared object, actually won't work at all? I found that even the ones that do have the plugin fail to work on my setup.

    And I found the .so in the unity package (damn, it's SO hard to use a simple archiver, without messing up with filename reference tables in 2014?), and copied it where it would have mattered. Only it doesn't!

    I'm not asking your help or anything. Just trying to learn the ecosystem and its implicit rules without annoying too many people too deeply. So far my results vary from disappointing to non-existent, but I want to understand before blindly following some google'd resolutive steps.
    Sys: i7-4790K / 32GB / GTX770 / Kubuntu 14.04.1 (krn 3.13.0, nv 346) / SDK 0.4.4B / DK2
  • taphostaphos Posts: 15
    vrdaveb wrote:
    OVRManager.display.distortionCaps |= 0x200 /*In lieu of Ovr.DistortionCaps.LinuxDevFullscreen*/ | Ovr.DistortionCaps.ProfileNoTimewarpSpinWaits;
    
    uint caps = OVRManager.capiHmd.GetEnabledCaps();
    caps |= (uint)HmdCaps.NoVSync;
    OVRManager.capiHmd.SetEnabledCaps(caps);
    
    This still might not work. We will continue to improve the plugin's Linux support and let you know when it's ready for broader use.

    Thanx very much for response!
    That fixed the fps and screen rotation, but some stuttering still present. Fullscreen doesnt work either (blinking black screen), I was able to run in windowed mode stretched to the whole screen. Still unplayable :(( I guess we should wait for the new version.
  • haagchhaagch Posts: 95
    So I made a short video showing the current status with the 0.4.4 SDK on mesa.

    This is what you get when you do not set anything up: youtube. com/watch?v=Awff1WqkLK8

    The oculus rift overlay says 37.5 fps, the application itself renders at 75 fps.
    There is intense black flickering. It's diagonal/tearing because of this, but unity applications are the only applications where this happens.

    There need to be two small changes in the code:
    OVRManager.display.distortionCaps |= 0x200 /* In lieu of Ovr.DistortionCaps.LinuxDevFullscreen */ | (uint) Ovr.DistortionCaps.ProfileNoTimewarpSpinWaits;
    
    				uint caps = OVRManager.capiHmd.GetEnabledCaps();
    				caps |= (uint) Ovr.HmdCaps.NoVSync;
    				OVRManager.capiHmd.SetEnabledCaps(caps);
    
    First is casting Ovr.DistortionCaps.ProfileNoTimewarpSpinWaits to uint before the binary |.
    Second NoVSync is in Ovr.HmdCaps.NoVSync, if one is not using OVR or however that works in c#.

    For beginners: Create a new asset, c# script, edit it and paste just this into Start() {} and drag the asset to any object in the scene.

    With these I can confirm, it runs at 75 fps. But the black flickering is way worse.

    When rendering on a slower intel ivy bridge on my 60 hz display the intel gpu doesn't keep up with 60 fps and is somewhere at 50 fps. There is an interesting effect where the flickering periodically gets worse, then it gets better and vanishes completely for few seconds, then it returns, gets worse, gets better, etc.

    Because of the obvious suspicion of something being wrong with low persistence I tried caps &= ~(uint) Ovr.HmdCaps.LowPersistence; but that doesn't help at all.
  • haagchhaagch Posts: 95
    So, do you at oculus know how to fix this by now?

    I built tuscany for linux (http://haagch.frickel.club/files/oculus/tuscany-0.4.4-linux.tar.xz, if anyone is interested) and experimented a bit with the flags, but nothing seems to help.

    (I'm currently running on my 60 hz monitor, so no 75 fps:)

    When vsync is enabled in the sdk it looks like the SDK thinks it's rendering at 30 fps (the overlay displays this) while the application is actually rendering at 60 fps. I believe every second frame is one of those "missing" frames that are just black.

    Interestingly, when I disable vsync in the sdk, the sdk thinks it renders at 60 fps, but my windowmanager is supposed to cap the fps to vsync itself, but it looks like it does not do it at 60 fps, but at 120 fps.

    Weird...
  • haagchhaagch Posts: 95
    With the oculus rift unity integration accompanying the 0.5.0.1 SDK they completely dropped the linux plugin. So far nobody has said anything here: viewtopic.php?f=26&t=21712&p=257891#p257891 or elsewhere I have seen.

    edit: Soon: viewtopic.php?f=26&t=21712&p=258668#p258651

    edit2: Not so soon: viewtopic.php?f=26&t=21712&start=60#p258877

    This video (https://youtu.be/fmu6rzYDt1w?t=3795) shows, there is a unity 5 beta supposed to come that has "built in support". But of course they did not say whether this will come with linux support.

    edit3: Also no linux support in the native integration yet: https://docs.google.com/document/d/1GkS ... edit?pli=1
Sign In or Register to comment.