[GZDoom][pull request]Stereoscopic 3D in gzdoom

Moderator: GZDoom Developers

User avatar
biospud
Posts: 206
Joined: Mon Oct 14, 2013 2:19 pm
Location: California, USA
Contact:

[GZDoom][pull request]Stereoscopic 3D in gzdoom

Post by biospud »

I created a pull request on github just now:
https://github.com/coelckers/gzdoom/pull/31

This pull request adds five stereoscopic 3D modes to gzdoom. These 3D modes permit players to use 3D glasses to play gzdoom in 3D. The five modes implemented represent a second generation reimplementation of the simplest and most complete modes from my forked project GZ3Doom, which I have been working on for the past two years.

I hope these five modes are a) varied enough to exercise many of the architecture changes needed for stereo 3D, but b) simple enough to keep this pull request to a manageable size.

I inserted access to these modes under the existing Menu->Options->Display Options->OpenGL Options->Preferences menu. Players can also set the console variable "vr_mode" to a integer value to switch between the modes.

These five modes are NOT the most useful 3D modes from GZ3Doom. I'll wait the see the reaction from the community to this pull request before completing the more useful (but also more complex and in more in need of final polish) modes. Each one of those remaining other modes will probably merit a pull request of its own.

Overview of the code changes:

Added new game menu item: Options->Display Options->OpenGL Options->Preferences->Stereo 3D VR
Added multiple-viewpoint stereo 3d mode-based rendering loop toward end of method FGLRenderer::RenderViewpoint() in src/gl/scene/gl_scene.cpp
Added revertible glColorMask management in gl_drawinfo.cpp and gl_portal.cpp, so anaglyph 3D modes could orchestrate the glColorMask. It looks like a lot of changes in the diff viewer, but really it's mostly indentation changes, owing to the addition of code blocks containing lexically scoped ScopedColorMask instances.
Added several new source files under src/gl/stereo3d

The five stereo 3D modes are as follows:
vr_mode 0: Mono, the default normal non-3D play mode
vr_mode 1: Green-magenta anaglyph mode; uses glasses with colored green and magenta color filters as lenses.
vr_mode 2: Red-cyan anaglyph mode; uses traditional anaglyph 3D glasses
vr_mode 5: Left eye view; single viewpoint as seen from the player's left eye
vr_mode 6: Right eye view: single viewpoint as seen from the player's right eye

I skipped some numbers there to maintain consistency with GZ3Doom. Any number other than 1, 2, 5, or 6 will default to Mono mode.
cmw1986
Posts: 154
Joined: Mon Jan 09, 2012 1:41 pm

Re: [GZDoom][pull request]Stereoscopic 3D in gzdoom

Post by cmw1986 »

A fabulous idea!. I would love to see this in regular GZDoom. It will be great for my project so keep up the good work!. :D
Skermoth
Posts: 4
Joined: Sun Nov 15, 2015 8:44 am

Re: [GZDoom][pull request]Stereoscopic 3D in gzdoom

Post by Skermoth »

Really good work, man.
Is there a possibility to include yellow/blue anaglyph (ala Colorcode3d)?
This could be one of the best functionalities for ZDoom since soundfont support.
Last edited by Skermoth on Mon Nov 16, 2015 5:18 pm, edited 1 time in total.
User avatar
Major Cooke
Posts: 8209
Joined: Sun Jan 28, 2007 3:55 pm
Preferred Pronouns: He/Him
Operating System Version (Optional): Windows 10
Graphics Processor: nVidia with Vulkan support
Location: GZBoomer Town
Contact:

Re: [GZDoom][pull request]Stereoscopic 3D in gzdoom

Post by Major Cooke »

I suggest this be moved to Code Submissions.
User avatar
biospud
Posts: 206
Joined: Mon Oct 14, 2013 2:19 pm
Location: California, USA
Contact:

Re: [GZDoom][pull request]Stereoscopic 3D in gzdoom

Post by biospud »

Major Cooke wrote:I suggest this be moved to Code Submissions.
Oops. Good point. I probably should have submitted this thread to the Code Submissions subforum originally.

Is there a way for me to move this thread to that subforum? Or do I need to enlist the help of an administrator?
User avatar
wildweasel
Posts: 21706
Joined: Tue Jul 15, 2003 7:33 pm
Preferred Pronouns: He/Him
Operating System Version (Optional): A lot of them
Graphics Processor: Not Listed
Contact:

Re: [GZDoom][pull request]Stereoscopic 3D in gzdoom

Post by wildweasel »

biospud wrote:Is there a way for me to move this thread to that subforum? Or do I need to enlist the help of an administrator?
I got it, don't worry.
User avatar
biospud
Posts: 206
Joined: Mon Oct 14, 2013 2:19 pm
Location: California, USA
Contact:

Re: [GZDoom][pull request]Stereoscopic 3D in gzdoom

Post by biospud »

Skermoth wrote:Is there a possibility to include yellow/blue anaglyph (ala Colorcode3d)?
Yellow/Blue anaglyph should be easy to implement, especially if it can be done using glColorMask(...), like I did with the other anaglyph modes.

If you actually have a pair of those glasses, and you genuinely want to play doom using them, would you be willing to test the new mode if I were to implement it? There is a possibility my pull request will never get incorportated into gzdoom, in which case you might want to open a new issue in gz3doom, where I exert dictatorial control. https://github.com/cmbruns/gz3doom/issues . I might be able to get such a feature in the next release of gz3doom, especially if someone offers to help test it.
User avatar
biospud
Posts: 206
Joined: Mon Oct 14, 2013 2:19 pm
Location: California, USA
Contact:

Re: [GZDoom][pull request]Stereoscopic 3D in gzdoom

Post by biospud »

wildweasel wrote:
biospud wrote:Is there a way for me to move this thread to that subforum? Or do I need to enlist the help of an administrator?
I got it, don't worry.
Thanks wildweasel. Much appreciated.
User avatar
Major Cooke
Posts: 8209
Joined: Sun Jan 28, 2007 3:55 pm
Preferred Pronouns: He/Him
Operating System Version (Optional): Windows 10
Graphics Processor: nVidia with Vulkan support
Location: GZBoomer Town
Contact:

Re: [GZDoom][pull request]Stereoscopic 3D in gzdoom

Post by Major Cooke »

Just know this, Graf's got a busy schedule. You'll have to wait a while, but you're not alone. It'll just make it all the more sweeter when he does take a look at it.
Skermoth
Posts: 4
Joined: Sun Nov 15, 2015 8:44 am

Re: [GZDoom][pull request]Stereoscopic 3D in gzdoom

Post by Skermoth »

biospud wrote:
Skermoth wrote:Is there a possibility to include yellow/blue anaglyph (ala Colorcode3d)?
Yellow/Blue anaglyph should be easy to implement, especially if it can be done using glColorMask(...), like I did with the other anaglyph modes.

If you actually have a pair of those glasses, and you genuinely want to play doom using them, would you be willing to test the new mode if I were to implement it? There is a possibility my pull request will never get incorportated into gzdoom, in which case you might want to open a new issue in gz3doom, where I exert dictatorial control. https://github.com/cmbruns/gz3doom/issues . I might be able to get such a feature in the next release of gz3doom, especially if someone offers to help test it.
Yeah, I could test it and report any issues with it. If the implementation is the same as the other anaglyph modes, there shouldn´t be any major issue with it.
User avatar
biospud
Posts: 206
Joined: Mon Oct 14, 2013 2:19 pm
Location: California, USA
Contact:

Re: [GZDoom][pull request]Stereoscopic 3D in gzdoom

Post by biospud »

Skermoth wrote:Is there a possibility to include yellow/blue anaglyph (ala Colorcode3d)?
Can you verify that the yellow lens covers the left eye, and the blue lens covers the right eye?
Skermoth
Posts: 4
Joined: Sun Nov 15, 2015 8:44 am

Re: [GZDoom][pull request]Stereoscopic 3D in gzdoom

Post by Skermoth »

Yes, yellow on the left eye and blue on the right.Image
User avatar
cacouser
Posts: 17
Joined: Sun Jun 23, 2013 10:50 pm

Re: [GZDoom][pull request]Stereoscopic 3D in gzdoom

Post by cacouser »

May I suggest an interactive color adjuster? No pair of glasses and monitor filter the opposite color perfectly because there is so much variation in those two variables. Every 3d anaglyph thing I have tried on any computer has been at least slightly off, so a slider for this would be a big advance over these other systems.
User avatar
biospud
Posts: 206
Joined: Mon Oct 14, 2013 2:19 pm
Location: California, USA
Contact:

Re: [GZDoom][pull request]Stereoscopic 3D in gzdoom

Post by biospud »

cacouser wrote:May I suggest an interactive color adjuster? No pair of glasses and monitor filter the opposite color perfectly because there is so much variation in those two variables. Every 3d anaglyph thing I have tried on any computer has been at least slightly off, so a slider for this would be a big advance over these other systems.
That's a clever idea, but unfortunately it will not work. At least not until a future in which we have monitors that actually emit a continuously adjustable set of wavelengths. Current monitors emit a mixture of red, green, and blue light, to *simulate* a continuous spectrum. If your glasses do not perfectly filter out, for example, the green phosphor, they won't do a much better job of filtering green-mixed-with-a-bit-of-blue. In the meantime, the best you can do is try to select a combination of monitor and glasses that are well matched to one another.
User avatar
cacouser
Posts: 17
Joined: Sun Jun 23, 2013 10:50 pm

Re: [GZDoom][pull request]Stereoscopic 3D in gzdoom

Post by cacouser »

You're right, sorry, I didn't think that through. Perhaps being able to adjust intensity along each channel separately would still help a little, though? (i.e. one lens might be more opaque than the other, artifacts in one eye might be more troublesome than in the other, etc.)

Also, doesn't newer display technology sometimes produce color through changing the backlighting in addition to the lcd filtering? Might be relevant in those (still relatively rare) cases.
Post Reply

Return to “Closed Feature Suggestions [GZDoom]”