Oculus Rift

General discussion of the port and Doom-related chat.
biospud
New User
Posts: 16
Joined: Thu Oct 31, 2013 4:37 pm
Location: Virginia
Contact:

RE: Oculus Rift

#21

Post by biospud » Sat Nov 02, 2013 8:20 pm

Torr Samaho wrote: Can you elaborate the difficulties a bit? Since you already have code that renders left and right view, I'd naively guess it should only be necessary to initialize render mode and feed the two views to the right buffers to get this working. I think about giving this a shot myself, but probably I'm overlooking some difficulties and would be happy about every hint you can give.
Sure. The difficulties are probably limited. Here is a post I made earlier, where I speculated about what would be required to reproduce the behavior of that tiny test example:
http://www.mtbs3d.com/phpBB/viewtopic.p ... 63#p144881

The gzdoom source code is somewhat complex, so I have not yet figured out where to request a stereo OpenGL context, where I would be able to insert a glutEnterGameMode() call, and how I would deal with the fact the players would apparently need to re-set their monitor refresh rate between invocations of the game. I'm concerned they might blame me for that, and for any other idiosyncrasies of this recent 3D hack.

I definitely do render the left and right eye views, and if a stereo context were available, vr_mode 7 would render to the BACK_LEFT and BACK_RIGHT GL buffers. So it might not be far off.

My source changes are all available https://github.com/cmbruns/gzdoom, in case you want to take a crack at it, or to give me suggestions based on your knowledge of the gzdoom code base.

I definitely intend to pursue rendering for 3D vision glasses eventually. But probably not right now. I am totally focused on the Oculus Rift implementation at the moment. If you get it working, please send me a pull request.

biospud
New User
Posts: 16
Joined: Thu Oct 31, 2013 4:37 pm
Location: Virginia
Contact:

RE: Oculus Rift

#22

Post by biospud » Tue Nov 05, 2013 2:47 pm

Zeberpal wrote: ...GZ3D crashes in few gz hugedetail wads (Winter's Fury and Patrifier)...
What is Patrifier? Where can I find that wad to test it?


biospud
New User
Posts: 16
Joined: Thu Oct 31, 2013 4:37 pm
Location: Virginia
Contact:

RE: Oculus Rift

#24

Post by biospud » Fri Nov 08, 2013 2:17 am

Torr Samaho wrote: [3D Vision glasses]
I have made some progress on 3D vision glasses. Most notably, tonight I got 3D vision glasses working with my dev version of Doomsday, on a non-Quadro graphics card. All I had to do was to request a stereo OpenGL context (via Qt QGLFormat, as Doomsday uses Qt), and do the usual GL_BACK_LEFT/GL_BACK_RIGHT rendering. Which is easier than I thought it would be.

But I have not yet got this working with GZ3Doom. I found a few places in the code where it seems like I could request a stereo OpenGL context. And when I tried running it on a computer with an actual Quadro video card, the nvidia emitter actually lit up, but the display was not in stereo. And with my regular consumer card (GTX 650), the emitter does not even light up. (The emitter lights up with Doomsday). So I suspect I have been requesting stereo for the wrong OpenGL context.

I have not yet spent a huge amount of time with this. I expect I will eventually figure it out. As I mentioned before, I am still mostly focused on Oculus Rift for the time being.

User avatar
Torr Samaho
Lead Developer
Posts: 1543
Joined: Fri May 25, 2012 6:03 pm
Location: Germany

RE: Oculus Rift

#25

Post by Torr Samaho » Fri Nov 08, 2013 7:06 am

Thanks for the update! I didn't have a chance to look at this myself, but should be able to do so during the weekend. Knowing that it's most likely just configuring the OpenGL context should be very helpful.

User avatar
Torr Samaho
Lead Developer
Posts: 1543
Joined: Fri May 25, 2012 6:03 pm
Location: Germany

RE: Oculus Rift

#26

Post by Torr Samaho » Sat Nov 09, 2013 11:02 am

I managed to get it working on my consumer card. Will post a patch later today.

biospud
New User
Posts: 16
Joined: Thu Oct 31, 2013 4:37 pm
Location: Virginia
Contact:

RE: Oculus Rift

#27

Post by biospud » Sat Nov 09, 2013 1:37 pm

Torr Samaho wrote: I managed to get it working on my consumer card. Will post a patch later today.
Awesome. I can't wait to try it.

User avatar
Torr Samaho
Lead Developer
Posts: 1543
Joined: Fri May 25, 2012 6:03 pm
Location: Germany

RE: Oculus Rift

#28

Post by Torr Samaho » Sat Nov 09, 2013 4:38 pm

Since I couldn't be bothered to create a GitHub account, I cloned your repo to Bitbucket. So I can't send a pull request, but you should still be able to pull from my repo: https://bitbucket.org/Torr_Samaho/gzdoom

BTW: Switching between quad buffered stereo and other modes still needs some work. Also the HUD stuff is only displayed on the left eye. I guess this is a simple oversight since one couldn't test the quad buffered rendering mode before.
Last edited by Torr Samaho on Sat Nov 09, 2013 5:02 pm, edited 1 time in total.

biospud
New User
Posts: 16
Joined: Thu Oct 31, 2013 4:37 pm
Location: Virginia
Contact:

RE: Oculus Rift

#29

Post by biospud » Sat Nov 09, 2013 5:08 pm

Torr Samaho wrote: Since I couldn't be bothered to create a GitHub account, I cloned your repo to Bitbucket. So I can't send a pull request, but you should still be able to pull from my repo: https://bitbucket.org/Torr_Samaho/gzdoom

BTW: Switching between quad buffered stereo and other modes still needs some work. Also the HUD stuff is only displayed on the left eye. I guess this is a simple oversight since one couldn't test the quad buffered rendering mode before.
I pulled your changes and 3d vision now works with gz3doom. This is great. Thank you so much. You rock.

Thanks too for fixing the don't-have-rift-sdk build problem. Much appreciated.

User avatar
Torr Samaho
Lead Developer
Posts: 1543
Joined: Fri May 25, 2012 6:03 pm
Location: Germany

RE: Oculus Rift

#30

Post by Torr Samaho » Sat Nov 09, 2013 6:04 pm

You're welcome! Now I have to think about whether it makes sense to port this to Zandronum 2.0. I didn't go through the diffs yet. Did you have to make many changes to the GZDoom code base or is the stereo code rather centralized?

biospud
New User
Posts: 16
Joined: Thu Oct 31, 2013 4:37 pm
Location: Virginia
Contact:

RE: Oculus Rift

#31

Post by biospud » Sat Nov 09, 2013 6:53 pm

Torr Samaho wrote: You're welcome! Now I have to think about whether it makes sense to port this to Zandronum 2.0. I didn't go through the diffs yet. Did you have to make many changes to the GZDoom code base or is the stereo code rather centralized?
Well, I tried to keep my changes centralized at first. I tried to keep most changes restricted to my new src/gl/scene/gl_stereo3d.[cpp,h] files. But then I also rearranged some details of the opengl rendering.

The widest impact change I made was to set up an offscreen render buffer for all non-3D content, so I could show menus/console/intermission twice, once for each eye. Most dramatically, I overrode screen->Update() in the doom main loop. I'm activating this mechanism only for Oculus Rift mode at the moment, but I intend to extend this mechanism to side-by-side, cross-eye, parallel, and top-bottom 3D modes (i.e. all modes that require two copies of those GUI items)

I also enhanced the CMake build system to create a nice installer, via cpack. That feature is not related to stereo 3D, and could be taken or left a la carte.

If my changes touch too many things that are not in common between GZDoom and Zandronum, I would recommend looking at the very first changes I made, to support anaglyph 3D. If you just implement those first change sets, that should get you within shooting distance of supporting 3D vision, at least.

Plus I'm happy to consult with you or to help with implementation. Especially if I can get the Zandronum build system working on my computer.

User avatar
Torr Samaho
Lead Developer
Posts: 1543
Joined: Fri May 25, 2012 6:03 pm
Location: Germany

RE: Oculus Rift

#32

Post by Torr Samaho » Sat Nov 09, 2013 7:24 pm

biospud wrote: I also enhanced the CMake build system to create a nice installer, via cpack. That feature is not related to stereo 3D, and could be taken or left a la carte.
Sounds nice. I have never used cpack before, but I wouldn't mind retiring our installer if cmake offers a similar functionality.
biospud wrote: If my changes touch too many things that are not in common between GZDoom and Zandronum, I would recommend looking at the very first changes I made, to support anaglyph 3D. If you just implement those first change sets, that should get you within shooting distance of supporting 3D vision, at least.
Thanks for the hint! I'll have a look at this.
biospud wrote: Plus I'm happy to consult with you or to help with implementation.
Thanks!
biospud wrote: Especially if I can get the Zandronum build system working on my computer.
If you need help with that just let me know.

User avatar
Torr Samaho
Lead Developer
Posts: 1543
Joined: Fri May 25, 2012 6:03 pm
Location: Germany

RE: Oculus Rift

#33

Post by Torr Samaho » Sat Nov 09, 2013 7:57 pm

biospud wrote: If my changes touch too many things that are not in common between GZDoom and Zandronum, I would recommend looking at the very first changes I made, to support anaglyph 3D. If you just implement those first change sets, that should get you within shooting distance of supporting 3D vision, at least.
That hint was wonderful! I have very basic 3D Vision support hacked in a 2.0 beta build. If anybody wants to try it, here is a very experimental binary. Now I'd just need a simple way to render the HUD to both eyes. For the weapon sprite this was easy, but I didn't immediately find a way to do this for all HUD elements.

biospud
New User
Posts: 16
Joined: Thu Oct 31, 2013 4:37 pm
Location: Virginia
Contact:

RE: Oculus Rift

#34

Post by biospud » Sat Nov 09, 2013 8:11 pm

Torr Samaho wrote: ...Now I'd just need a simple way to render the HUD to both eyes. For the weapon sprite this was easy, but I didn't immediately find a way to do this for all HUD elements.
After I pulled your patch, I added "glDrawBuffer(GL_BACK)", after rendering the two 3D views. This got me menus etc. in both eyes for GZ3Doom. Perhaps similar would work for Zandronum.
Torr Samaho wrote:
biospud wrote: Especially if I can get the Zandronum build system working on my computer.
If you need help with that just let me know.
Cool. I'll probably try to set up the build system this week. My top priority right now is Doomsday, where we currently have a lot of momentum, but I would like to see Zandronum eventually get all the 3D candy too.
Last edited by biospud on Sat Nov 09, 2013 8:16 pm, edited 1 time in total.

User avatar
Torr Samaho
Lead Developer
Posts: 1543
Joined: Fri May 25, 2012 6:03 pm
Location: Germany

RE: Oculus Rift

#35

Post by Torr Samaho » Sat Nov 09, 2013 8:31 pm

biospud wrote: After I pulled your patch, I added "glDrawBuffer(GL_BACK)", after rendering the two 3D views. This got me menus etc. in both eyes for GZ3Doom. Perhaps similar would work for Zandronum.
Yeah, that's it. Thanks a lot!

User avatar
Ænima
Addicted to Zandronum
Posts: 3523
Joined: Tue Jun 05, 2012 6:12 pm

RE: Oculus Rift

#36

Post by Ænima » Sat Nov 09, 2013 8:36 pm

...... Is there a tracker ticket for this yet or is it just an experiment? :p


Because if you guys can get this working decently, then I don't see a reason not to add it to Zandronum. Besides, it gives me a reason to actually buy an OR.
­ ­ ­ ­ ­ ­ ­ ­ ­ ­ ­ ­ ­ ­ ­ ­ ­
Doom64: Unabsolved: New weapons, monsters, and gameplay features for coop !


ZandroSkins
: a pack made by our community

biospud
New User
Posts: 16
Joined: Thu Oct 31, 2013 4:37 pm
Location: Virginia
Contact:

RE: Oculus Rift

#37

Post by biospud » Sat Nov 09, 2013 8:37 pm

Announcing release 1.8.2_f of GZ3Doom:
* Implement Nvidia 3D Vision mode (vr_mode 7, Thanks Torr Samaho!)
* Avoid crash with Alien Colonial Marines wad
* Fix compile problem when Oculus SDK not available

http://rotatingpenguin.com/gz3doom/

User avatar
Torr Samaho
Lead Developer
Posts: 1543
Joined: Fri May 25, 2012 6:03 pm
Location: Germany

RE: Oculus Rift

#38

Post by Torr Samaho » Sat Nov 09, 2013 8:48 pm

Ænima wrote: ...... Is there a tracker ticket for this yet or is it just an experiment? :p
It's an experiment. I personally wanted to use my 3D Vision glasses with Skulltag/Zandronum for quite a while now, but so far never tried to implement it (there is always so much else to do ;)). With GZ3Doom and Quad Buffer OpenGL support in the newer NVIDIA drivers, I thought the time was right to give this a shot.
Ænima wrote: Because if you guys can get this working decently, then I don't see a reason not to add it to Zandronum. Besides, it gives me a reason to actually buy an OR.
Well, I have to keep compatibility with the GZDoom code base in mind. The 3D Vision stuff only requires very few changes and should be quite manageable. The Oculus Rift may be another story.

User avatar
Torr Samaho
Lead Developer
Posts: 1543
Joined: Fri May 25, 2012 6:03 pm
Location: Germany

RE: Oculus Rift

#39

Post by Torr Samaho » Sun Nov 17, 2013 11:26 am

I played around with this a bit more and noticed rendering errors on Doom2 MAP02. Here is a vr_mode 4 screenshot from GZ3Doom 1.8.2_f:
[spoiler]
Image
[/spoiler]
The 3D vision only code I use in Zandronum right now has the same problem. Do you have any idea what's causing this?

EDIT: Seems to have to do with rendering hacks for missing textures. Not calling DrawUnhandledMissingTextures seems to fix the issue.
Last edited by Torr Samaho on Sun Nov 17, 2013 11:33 am, edited 1 time in total.

biospud
New User
Posts: 16
Joined: Thu Oct 31, 2013 4:37 pm
Location: Virginia
Contact:

RE: Oculus Rift

#40

Post by biospud » Sun Nov 17, 2013 7:20 pm

Torr Samaho wrote: I played around with this a bit more and noticed rendering errors on Doom2 MAP02.
The 3D vision only code I use in Zandronum right now has the same problem. Do you have any idea what's causing this?

EDIT: Seems to have to do with rendering hacks for missing textures. Not calling DrawUnhandledMissingTextures seems to fix the issue.
Because this glitch appears to affect just one of the two views, it seems this problem might be a side effect of drawing the scene twice per render. Perhaps something is being done twice that should only be done once.

I don't know what DrawUnhandledMissingTextures() does. My stereo modifications have been organized to require the least possible understanding on my part of the existing rendering code.

I opened an issue for this:
https://github.com/cmbruns/gzdoom/issues/27

Post Reply