Skip to main content
kojack
Honored Contributor
March 30, 2013

Ogre3D Integration

I grabbed the Oculus sdk earlier today and have been working on a sample of using it with the open source 3d engine Ogre3D.

I've got the rendering working fairly well and I wrote a parser to load the tuscany scene from the sdk. Head tracking is almost implemented.

Since I don't have an actual oculus rift, I'll give out a test version soon to see if it works for anyone else.

http://www.ogre3d.org/forums/viewtopic.php?f=5&t=76970



Edited in Latest Status:
06/04/2013
Source (MIT licensed) released at https://bitbucket.org/rajetic/ogreoculus

08/04/2013
Latest binary demo: https://bitbucket.org/rajetic/ogreoculus/downloads/OgreOculusDemo1_v0.5.1.7z

    38 replies

    Inspiring
    April 2, 2013
    Awesome work Kojack! Nice to see you here (I'm cybereality on the Ogre forums).

    I have actually been working on an Oculus demo using Ogre, it was surprisingly easy to get up and running.

    OculusOgre.jpg

    I will have to see if I can get the OK to release the code.
    AMD Ryzen 7 1800X | MSI X370 Titanium | G.Skill 16GB DDR4 3200 | EVGA SuperNOVA 1000 | Corsair Hydro H110i Gigabyte RX Vega 64 x2 | Samsung 960 Evo M.2 500GB | Seagate FireCuda SSHD 2TB | Phanteks ENTHOO EVOLV
    Up and Coming
    April 3, 2013
    You image comparison look like it should be perfect. Unfortunately I cannot get your latest exe to run in DX9 or OpenGL. The Ogre Configure Window comes up but the app crashes before it starts to render anything.

    If you are able to post any code I would love to check it out and try to compile myself. Thanks.
    kojack
    kojackAuthor
    Honored Contributor
    April 3, 2013
    I really shouldn't make releases at 5:30am after not sleeping. :)
    I had added back in the tuscany level for testing the appearance against the official demo, but then changed back to the sibenik mesh (the one in the pic above) but forgot to remove the line that loads the tuscany resources. Since they aren't in the 7z file (it would make the release 10 times bigger, and I don't know the redistribution rights for them) it failed to load.

    Fixed now, version 0.4: http://www.mediafire.com/download.php?ayr5h2316mhb64t


    Hey cybereality. :D
    Author: Oculus Monitor , Auto Oculus Touch , Forum Dark Mode , Phantom Touch Remover , X-Plane Fixer Hardware: Threadripper 1950x, MSI Gaming Trio 2080TI, Asrock X399 Taich Headsets: Wrap 1200VR, DK1, DK2, CV1, Rift-S, GearVR, Go, Quest, Quest 2, Reverb G2, Quest 3
    Up and Coming
    April 3, 2013
    Success!!! Looks great. It still refuses to exit cleanly and release hold of the sensor so you have to kill the task before you can run it again and get head tracking. Aside from that looks good!
    kojack
    kojackAuthor
    Honored Contributor
    April 3, 2013
    Awesome. Thanks for the help. :)
    Now I can start cleaning up the code a bit and give it out.

    The exit problems are odd. I'm doing everything the docs and samples do, things are released and deleted. I'll have to take a look inside of the ovr lib to see if there's something I'm not doing.
    Author: Oculus Monitor , Auto Oculus Touch , Forum Dark Mode , Phantom Touch Remover , X-Plane Fixer Hardware: Threadripper 1950x, MSI Gaming Trio 2080TI, Asrock X399 Taich Headsets: Wrap 1200VR, DK1, DK2, CV1, Rift-S, GearVR, Go, Quest, Quest 2, Reverb G2, Quest 3
    kojack
    kojackAuthor
    Honored Contributor
    April 6, 2013
    I think I've got the cleanup issue fixed, I missed one reference counted object. Should be fine now.

    Source release time.

    Mercurial repository:
    https://bitbucket.org/rajetic/ogreoculus
    Binary using the same code:
    https://bitbucket.org/rajetic/ogreoculus/downloads/OgreOculusDemo1_v0.5.7z

    It still needs work. Like docs, more comments, etc. But it's in working order and should be fairly easy to use.
    The included demo is a simple ogre windows app. It includes a Visual Studio 2010 solution, but the oculus class code should be compiler independent.

    Basic use for Oculus class:

    • Add the ogreoculus.h and ogreoculus.cpp to your project.

    • Include ogreoculus.h

    • Add the following code to set everything up (after setting up ogre):
      Oculus oculus;
      oculus.setupOculus();
      oculus.setupOgre(sceneManager, window);

      (where sceneManager is your scene manager and window is the render window returned by creating ogre's root)

    • In your game loop, you can update the ogre cameras to the oculus orientation using:
      oculus.update();

      Or you can manually do it (in case you have a hierarchy like a body and head):
      oculus.getCameraNode()->setOrientation(oculus.getOrientation());

    • If you want to move around, use something like:
      oculus.getCameraNode()->translate(velocity);

      (getCameraNode returns a standard SceneNode that contains the two cameras used for stereo rendering)

    • At the end, shut down using:
      oculus.shutDownOgre();
      oculus.shutDownOculus();


    Build instructions for OgreOculusDemo1:
    • You'll need an Ogresdk (with the OGRE_HOME environment variable set

    • You'll also need the Oculus sdk. The demo is set to look for the sdk in the subdirectory OculusSDK in the parent of the demo's solution directory. You may need to change that in the include and library settings.

    • Build and enjoy.


    I've got plans for more advanced demos (and especially better looking). Don't judge Ogre by how my demo looks, take a look at other examples like Torchlight 2. :)
    Author: Oculus Monitor , Auto Oculus Touch , Forum Dark Mode , Phantom Touch Remover , X-Plane Fixer Hardware: Threadripper 1950x, MSI Gaming Trio 2080TI, Asrock X399 Taich Headsets: Wrap 1200VR, DK1, DK2, CV1, Rift-S, GearVR, Go, Quest, Quest 2, Reverb G2, Quest 3
    Up and Coming
    April 7, 2013
    Thank you for posting this, I do notice something interesting. After getting your demo to compile and testing it out, Sinbad was not looking the same as I remembered from your version 4 demo. He wasn't "double" but I was having a harder time "focusing" on him.

    I tried the included exe and noticed the same thing.

    Going back to version 4 he looks much better, immediately I was able to see and register both eyes on him. Is there any difference between the 2 version in the projection matrix?

    Attached you will see a screen shot of both versions, with a 50% transparency on the new version. There is a definite difference in the shape of the distortion as well as Sinbad is closer to the center of the screen in both eyes.

    The good news is the program does exit nicely now! :)
    kojack
    kojackAuthor
    Honored Contributor
    April 8, 2013
    That's the fun thing about writing code I can't see running on it's intended target platform. :)

    When refactoring the source code for release, I broke the per eye LensCentre value for the shader.

    At least I kept the file size small, rather than releasing a bunch of broken 100MB+ demos. :)

    Yet another release: https://bitbucket.org/rajetic/ogreoculu ... _v0.5.1.7z

    Another change that was made between 0.4 and 0.5 (and 0.5.1) is that I'm now using a higher res render target. So the centre of the view won't be a little blurry like before.
    Author: Oculus Monitor , Auto Oculus Touch , Forum Dark Mode , Phantom Touch Remover , X-Plane Fixer Hardware: Threadripper 1950x, MSI Gaming Trio 2080TI, Asrock X399 Taich Headsets: Wrap 1200VR, DK1, DK2, CV1, Rift-S, GearVR, Go, Quest, Quest 2, Reverb G2, Quest 3
    Inspiring
    April 8, 2013
    Awesome work, kojack! Thanks for taking the time to do this.
    AMD Ryzen 7 1800X | MSI X370 Titanium | G.Skill 16GB DDR4 3200 | EVGA SuperNOVA 1000 | Corsair Hydro H110i Gigabyte RX Vega 64 x2 | Samsung 960 Evo M.2 500GB | Seagate FireCuda SSHD 2TB | Phanteks ENTHOO EVOLV
    Up and Coming
    April 9, 2013
    Looks great!!

    Thanks.