[GZDoom][pull request]Stereoscopic 3D in gzdoom
Moderator: GZDoom Developers
[GZDoom][pull request]Stereoscopic 3D in gzdoom
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.
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.
Re: [GZDoom][pull request]Stereoscopic 3D in gzdoom
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!. 

Re: [GZDoom][pull request]Stereoscopic 3D in gzdoom
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.
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.
- 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
I suggest this be moved to Code Submissions.
Re: [GZDoom][pull request]Stereoscopic 3D in gzdoom
Oops. Good point. I probably should have submitted this thread to the Code Submissions subforum originally.Major Cooke wrote:I suggest this be moved to Code Submissions.
Is there a way for me to move this thread to that subforum? Or do I need to enlist the help of an administrator?
- 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
I got it, don't worry.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?
Re: [GZDoom][pull request]Stereoscopic 3D in gzdoom
Yellow/Blue anaglyph should be easy to implement, especially if it can be done using glColorMask(...), like I did with the other anaglyph modes.Skermoth wrote:Is there a possibility to include yellow/blue anaglyph (ala Colorcode3d)?
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.
Re: [GZDoom][pull request]Stereoscopic 3D in gzdoom
Thanks wildweasel. Much appreciated.wildweasel wrote:I got it, don't worry.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?
- 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
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.
Re: [GZDoom][pull request]Stereoscopic 3D in gzdoom
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.biospud wrote:Yellow/Blue anaglyph should be easy to implement, especially if it can be done using glColorMask(...), like I did with the other anaglyph modes.Skermoth wrote:Is there a possibility to include yellow/blue anaglyph (ala Colorcode3d)?
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.
Re: [GZDoom][pull request]Stereoscopic 3D in gzdoom
Can you verify that the yellow lens covers the left eye, and the blue lens covers the right eye?Skermoth wrote:Is there a possibility to include yellow/blue anaglyph (ala Colorcode3d)?
Re: [GZDoom][pull request]Stereoscopic 3D in gzdoom
Yes, yellow on the left eye and blue on the right.

Re: [GZDoom][pull request]Stereoscopic 3D in gzdoom
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.
Re: [GZDoom][pull request]Stereoscopic 3D in gzdoom
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.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.
Re: [GZDoom][pull request]Stereoscopic 3D in gzdoom
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.
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.