Oculus Rift in Ogre

A place for users of OGRE to discuss ideas and experiences of utilitising OGRE in their games / demos / applications.
User avatar
Kojack
OGRE Moderator
OGRE Moderator
Posts: 7134
Joined: Sun Jan 25, 2004 7:35 am
Location: Brisbane, Australia

Re: Oculus Rift in Ogre

Post by Kojack » Wed Apr 03, 2013 6:17 am

Cool, I've now had confirmation that the sample version 0.4 works correctly for rendering and tracking.
But it's cleanup code is breaking. That's hard to test because without the headset I can't fully set up all the objects, so I can't test how they are being cleaned up afterwards. I might need to hack the oculus sdk to make a fake headset available. Or just stare at code until I get inspiration.
Enough Oculus for today, got three other coding projects to do in the next 12 hours. :)

I'll get a code release ready soon (in a couple of days).
0 x

sintax
Gnoblar
Posts: 6
Joined: Thu Mar 28, 2013 8:56 am
Location: Japan

Re: Oculus Rift in Ogre

Post by sintax » Wed Apr 03, 2013 9:04 am

I'll be happy to help test this, but even as a kickstarter backer, I'm not likely to get my headset for a couple more weeks. This looks awesome!
0 x

User avatar
Kojack
OGRE Moderator
OGRE Moderator
Posts: 7134
Joined: Sun Jan 25, 2004 7:35 am
Location: Brisbane, Australia

Re: Oculus Rift in Ogre

Post by Kojack » Sat Apr 06, 2013 4:43 pm

Source release time.

Mercurial repository:
https://bitbucket.org/rajetic/ogreoculus
Binary using the same code:
https://bitbucket.org/rajetic/ogreoculu ... o1_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):

    Code: Select all

    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:

    Code: Select all

    oculus.update();
    Or you can manually do it (in case you have a hierarchy like a body and head):

    Code: Select all

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

    Code: Select all

    oculus.getCameraNode()->translate(velocity);
    (getCameraNode returns a standard SceneNode that contains the two cameras used for stereo rendering)
  • At the end, shut down using:

    Code: Select all

    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.
0 x

User avatar
Jabberwocky
OGRE Moderator
OGRE Moderator
Posts: 2819
Joined: Mon Mar 05, 2007 11:17 pm
Location: Canada
Contact:

Re: Oculus Rift in Ogre

Post by Jabberwocky » Sun Apr 07, 2013 5:32 pm

Kojack wrote:Source release time.
Some of the sweetest words in the english language. ;)
Nice work Kojack.
0 x
Image

User avatar
Klaim
Old One
Posts: 2565
Joined: Sun Sep 11, 2005 1:04 am
Location: Paris, France
Contact:

Re: Oculus Rift in Ogre

Post by Klaim » Sun Apr 07, 2013 11:13 pm

Excellent Kojack!

This and other things motivates me a lot to get my game finish ASAP (certainly around the end of the year) so that I can port it to Occulus Rift, as I think it would be perfect match!
0 x

User avatar
Kojack
OGRE Moderator
OGRE Moderator
Posts: 7134
Joined: Sun Jan 25, 2004 7:35 am
Location: Brisbane, Australia

Re: Oculus Rift in Ogre

Post by Kojack » Mon Apr 08, 2013 2:59 am

It was also a good excuse to get around to trying bitbucket, some of my students want to use it so I need a bit of practice. :)

What we really need now is a good looking scene using acceptably licensed art assets.
I'd love something like the NeoAxis village demo, or something like Dear Esther.
I can rip the look of the Unity demo, but I don't want to just copy it.

Damn, looks like I've broken the rendering again (hard to test without a headset). While cleaning up my code I broke part of it. But the fix is annoying.
Sigh. Using a listener class to set one float on a compositor instance just seems such a waste of code. Or I need to clone materials and give out two identical compositors. :(
0 x

User avatar
AshMcConnell
Silver Sponsor
Silver Sponsor
Posts: 591
Joined: Fri Dec 14, 2007 11:44 am
Location: Northern Ireland
Contact:

Re: Oculus Rift in Ogre

Post by AshMcConnell » Mon Apr 08, 2013 7:52 am

Thanks for all your hard work Kojack, I can't wait to try it out in ORC. It'll probably be a long 4-6 weeks before it arrives! Should be fun :)

Thanks!
Ash
0 x

User avatar
Kojack
OGRE Moderator
OGRE Moderator
Posts: 7134
Joined: Sun Jan 25, 2004 7:35 am
Location: Brisbane, Australia

Re: Oculus Rift in Ogre

Post by Kojack » Mon Apr 08, 2013 11:33 am

I've got some ideas for a future demo. But it may not be popular with everyone. I'm interested in the amount of motion sickness people are getting (not everyone, but a lot), so I want to see how far I can push vertigo in a vr world. :)

But for now I'll probably just stick in some paged geometry, skyx, hydrax, etc. That should be cool. :)
0 x

User avatar
AshMcConnell
Silver Sponsor
Silver Sponsor
Posts: 591
Joined: Fri Dec 14, 2007 11:44 am
Location: Northern Ireland
Contact:

Re: Oculus Rift in Ogre

Post by AshMcConnell » Mon Apr 08, 2013 11:37 am

A tightrope over a gushing waterfall? :P
0 x

User avatar
Kojack
OGRE Moderator
OGRE Moderator
Posts: 7134
Joined: Sun Jan 25, 2004 7:35 am
Location: Brisbane, Australia

Re: Oculus Rift in Ogre

Post by Kojack » Mon Apr 08, 2013 11:38 am

AshMcConnell wrote:A tightrope over a gushing waterfall? :P
Adding to the list...
:)
0 x

sintax
Gnoblar
Posts: 6
Joined: Thu Mar 28, 2013 8:56 am
Location: Japan

Re: Oculus Rift in Ogre

Post by sintax » Wed Apr 10, 2013 7:14 am

Kojack wrote:I've got some ideas for a future demo. But it may not be popular with everyone. I'm interested in the amount of motion sickness people are getting (not everyone, but a lot), so I want to see how far I can push vertigo in a vr world. :)
I think if you have an environment that is user-paced, you won't have any issues with popularity. If the user can choose to just walk around peacefully if they want, or if they're curious about vertigo, thy can walk up to a cliff/across a tightrope/onto a roller coaster/etc. Leaving that out would be sad ^_^
0 x

bstone
OGRE Expert User
OGRE Expert User
Posts: 1920
Joined: Sun Feb 19, 2012 9:24 pm
Location: Russia

Re: Oculus Rift in Ogre

Post by bstone » Wed Apr 10, 2013 7:10 pm

No-o-o... Let them all suffer! Pure evil :mrgreen:
0 x

User avatar
Kojack
OGRE Moderator
OGRE Moderator
Posts: 7134
Joined: Sun Jan 25, 2004 7:35 am
Location: Brisbane, Australia

Re: Oculus Rift in Ogre

Post by Kojack » Thu Apr 11, 2013 4:16 am

Extreme vertigo, strobing lights and sudden jump scare shock images, while justin bieber music circles around you.
0 x

User avatar
AshMcConnell
Silver Sponsor
Silver Sponsor
Posts: 591
Joined: Fri Dec 14, 2007 11:44 am
Location: Northern Ireland
Contact:

Re: Oculus Rift in Ogre

Post by AshMcConnell » Thu Apr 11, 2013 6:34 am

Kojack wrote:Extreme vertigo, strobing lights and sudden jump scare shock images, while justin bieber music circles around you.
It started off as a demo, it became A LIVING HELL :o
0 x

User avatar
Klaim
Old One
Posts: 2565
Joined: Sun Sep 11, 2005 1:04 am
Location: Paris, France
Contact:

Re: Oculus Rift in Ogre

Post by Klaim » Thu Apr 11, 2013 2:57 pm

Kojack wrote:Extreme vertigo, strobing lights and sudden jump scare shock images, while justin bieber music circles around you.
If you make something scary first, it will create a big buzz.
0 x

User avatar
Kojack
OGRE Moderator
OGRE Moderator
Posts: 7134
Joined: Sun Jan 25, 2004 7:35 am
Location: Brisbane, Australia

Re: Oculus Rift in Ogre

Post by Kojack » Fri Apr 12, 2013 9:42 am

Good point. I'll focus on the Justin Bieber music first.
:D
0 x

User avatar
Klaim
Old One
Posts: 2565
Joined: Sun Sep 11, 2005 1:04 am
Location: Paris, France
Contact:

Re: Oculus Rift in Ogre

Post by Klaim » Fri Apr 12, 2013 9:46 am

Kojack wrote:Good point. I'll focus on the Justin Bieber music first.
:D
I wasn't thinking about that kind of scary. It's highly unethical. :mrgreen:
0 x

User avatar
saejox
Goblin
Posts: 260
Joined: Tue Oct 25, 2011 1:07 am

Re: Oculus Rift in Ogre

Post by saejox » Fri Apr 12, 2013 9:51 am

He gets all the chicks and you are jealous of him. 8)
If you make a Bieber game, you'll get filthy rich. I'm sure of it.
0 x
Nimet - Advanced Ogre3D Mesh/dotScene Viewer
asPEEK - Remote Angelscript debugger with html interface
ogreHTML - HTML5 user interfaces in Ogre

User avatar
Klaim
Old One
Posts: 2565
Joined: Sun Sep 11, 2005 1:04 am
Location: Paris, France
Contact:

Re: Oculus Rift in Ogre

Post by Klaim » Fri Apr 12, 2013 9:55 am

saejox wrote:He gets all the chicks and you are jealous of him. 8)
Indeed! But I'm not jealous of what he makes or his hair. :twisted:
If you make a Bieber game, you'll get filthy rich. I'm sure of it.
Haha I'm sure that's true.
0 x

hedphelym
Halfling
Posts: 97
Joined: Tue Nov 25, 2008 10:58 am

Re: Oculus Rift in Ogre

Post by hedphelym » Tue Apr 30, 2013 5:57 am

Found this yesterday, I wonder if it would work with ogre:
http://www.vireio.com/

as you can see here it already works with a lot of games:
http://www.mtbs3d.com/phpbb/viewtopic.php?f=141&t=15570
0 x

User avatar
Wookiee
Gnoblar
Posts: 22
Joined: Sun Feb 20, 2005 10:17 pm
Location: Armidale, Australia

Re: Oculus Rift in Ogre

Post by Wookiee » Fri May 03, 2013 3:21 am

Hey Kojack you asked how much nausea etc we were experiencing with our rifts?

For me a fair amount at the moment but it is getting better, however some are much worse than others.
This vid: http://youtu.be/bxKQdckCigQ full screened nearly made my eyes bleed and me vomit all over the keyboard, I hear it is better with it linked to your own head motions but holy crap!

So if you want to hurt people with your demo's this is the kind of way to go imo. :D
0 x

User avatar
saejox
Goblin
Posts: 260
Joined: Tue Oct 25, 2011 1:07 am

Re: Oculus Rift in Ogre

Post by saejox » Fri May 03, 2013 3:52 am

One one got a Rift yet?

I am wondering about how much it stains the eyes.
Normally if i stand to my monitor less than 50cm or so my eyes starts burning, tears come out and vision gets blurry. Much worse if screen flashes frequently.
How does Rift feel after a few hours?
0 x
Nimet - Advanced Ogre3D Mesh/dotScene Viewer
asPEEK - Remote Angelscript debugger with html interface
ogreHTML - HTML5 user interfaces in Ogre

User avatar
Kojack
OGRE Moderator
OGRE Moderator
Posts: 7134
Joined: Sun Jan 25, 2004 7:35 am
Location: Brisbane, Australia

Re: Oculus Rift in Ogre

Post by Kojack » Sat May 04, 2013 12:15 pm

Well, since the rift lenses sit close enough that your eyelashes will probably touch them every time you blink, I'd guess it would be worse than sitting 50cm from a monitor.

I should get a new code update out to support the 0.2 sdk (it has yaw drift correction, which must be started manually). I'd like Razer Hydra support in there too, but I haven't got the positioning working as well as I'd like (the joysticks and buttons/triggers are easy, but my code for hand movement seems to have a flaw).
Oh, and I need to make a new shader. The oculus sdk now has a chromatic aberration shader (it compensates for the colour fringing that the lenses cause). It will be dx11 hlsl, so I'll need to convert it to SM2.0 CG (or SM3.0, this one might be too complicated for SM2.0).

Hehe, that wingsuit video is awesome.
(I don't have the oculus yet, but I can just diverge my eyes (like a magic eye book) and see the video in 3d. Not wide fov though)
0 x

User avatar
Kojack
OGRE Moderator
OGRE Moderator
Posts: 7134
Joined: Sun Jan 25, 2004 7:35 am
Location: Brisbane, Australia

Re: Oculus Rift in Ogre

Post by Kojack » Sat May 04, 2013 2:36 pm

Argh, WTF cg?

Here's a part of my new oculus distortion shader, ported from the official dx11 hlsl to sm2.0 cg:

Code: Select all

	float blue = tex2D(RT, tcBlue).b*1.0000;
	float green = tex2D(RT, tcGreen).g*1.0000;
	float red = tex2D(RT, tcRed).r*1.0000;

	return float4(red, green, blue, 1);
There's a bunch of stuff above that's different but not important to see. Ignore the *1.0000 bit, that will be explained soon.
So we have one render texture, the render of a single viewport (left or right eye). To correct the chromatic aberrations I need to read each colour channel from a different set of uv coords.
I've rendered the tcBlue, tcGreen and tcRed texture coords to the screen, they are all different.
But when I combine the channels like in the last line, I get a result which looks like all three channels use the same texture coords.

If I change the above code to have 1.00001 instead, it works correctly. Each channel is now scaled differently and overlap each other. Why is scaling the brightness of a colour channel by a non 1.0 value changing it's texture coordinates?

I bet if I renamed the file to hlsl and changed the program definition to hlsl it would work fine (I've had that in the past).

It's like it's caching the texture read and reusing it instead of doing three reads.
0 x

bstone
OGRE Expert User
OGRE Expert User
Posts: 1920
Joined: Sun Feb 19, 2012 9:24 pm
Location: Russia

Re: Oculus Rift in Ogre

Post by bstone » Sat May 04, 2013 7:28 pm

Weird stuff, but have you looked into the differences between the compiler output for both cases?
0 x

Post Reply