Since the sound stuff for GZDoom is built into the source code now, I'm able to compile a completely functional build for myself!
Yeah, so, I have stereoscopic 3D glasses, and I'm digging that 3D is an actual display feature. But... it wasn't done right.
Let me explain what happens: the screen splits into a splitscreen with a left eye view and a right eye view. Good... except it's all still fullscreen with the resolution settings, meaning the X axis got smooshed on both sides. This is almost negligible on most of the FOV, but it's most noticeable on the HUD in Hexen. (I usually use the classic 320x200 to with no texture filtering for classic authenticity)
Normal 2D view:
Stereoscopic 3D view
Note that the X axis is chopped in half at each side, narrowing the view, and squeezing the HUD. The wall/pedestal on the right side has completely disappeared from view.
What needs to be done is the Y axis must also be shrunk 50%, with the resolution doubled on both axises. This would have the effect of cinematic black bars taking half the screen as a border on all sides, but it's what must be done.
I want to learn how to code the GZDoom engine, but just getting started is intimidating. The source code is nothing short of labyrinthian. Can someone point me in the direction to where the code files for the 3D views can be found so I can attempt a fix myelf? Or is there already a way to adjust this correctly in the video settings menu somehow?
Stereoscopic 3D needs fixing
Moderator: GZDoom Developers
-
- Posts: 439
- Joined: Fri Oct 14, 2005 2:21 pm
Stereoscopic 3D needs fixing
You do not have the required permissions to view the files attached to this post.
-
- Posts: 13793
- Joined: Tue Jan 13, 2004 1:31 pm
- Preferred Pronouns: She/Her
Re: Stereoscopic 3D needs fixing
Unfortunately, this likely never will be fixed, as the original developer for this has mostly gone MIA, and the other developer who's worked with this code has left the project for personal reasons.
I personally do not have any 3d glasses so there isn't much I can do here, so this is going on hold until a developer for this shows up.
I personally do not have any 3d glasses so there isn't much I can do here, so this is going on hold until a developer for this shows up.
-
- Posts: 439
- Joined: Fri Oct 14, 2005 2:21 pm
Re: Stereoscopic 3D needs fixing
I guess that translates to "you're on your own."
Well, I plunged into this rat maze looking for cheese and I found src->Common->Rendering->Hardware Renderer->Data->hw_vrmodes.h and hw_vrmodes.cpp.
I found the definition which is the thing I want to work with.
This led me towhich I used to trace over to this:
So, uh, can someone translate that? I'm guessing all the 2s are doubling something, the .5 is cutting a value in half, and the 1f is setting something to normal scale. But... what are each of these arguments? I could trial and error as much as I want but compiling takes a long time.
Well, I plunged into this rat maze looking for cheese and I found src->Common->Rendering->Hardware Renderer->Data->hw_vrmodes.h and hw_vrmodes.cpp.
I found the definition
Code: Select all
VR_SIDEBYSIDEFULL
This led me to
Code: Select all
case VR_SIDEBYSIDEFULL:
return &vrmi_sbsfull;
Code: Select all
static VRMode vrmi_sbsfull = { 2, .5f, 1.f, 2.f,{ { -.5f, .5f },{ .5f, .5f } } };
-
- Posts: 439
- Joined: Fri Oct 14, 2005 2:21 pm
Re: Stereoscopic 3D needs fixing
I've done some fiddling, and those numbers ABSOLUTELY SHOULD NOT BE CHANGED.
However, this is what they're getting set to
What needs to happen is, instead of the screen getting split in half, the resolution of the window should get doubled, but it should render two views with half the window's resolution somehow (so say, you set the resolution to 320x200, the video mode should change to 640x400, but show the left eye at 0x, .5y with 320x200, and the left eye view with 320x200 at 0.5x,0.5y.
So, somewhere after OpenGLFrameBuffer is called, it shoud do something like
However, this is what they're getting set to
Code: Select all
void OpenGLFrameBuffer::SetViewportRects(IntRect *bounds)
{
Super::SetViewportRects(bounds);
if (!bounds)
{
auto vrmode = VRMode::GetVRMode(true);
vrmode->AdjustViewport(this);
}
}
So, somewhere after OpenGLFrameBuffer is called, it shoud do something like
Code: Select all
OpenGLFrameBuffer.SetViewportRect(bounds);
if (VRMode == VR_SIDEBYSIDEFULL)
{
//do the stuff I talked about above
}
-
- Posts: 439
- Joined: Fri Oct 14, 2005 2:21 pm
Re: Stereoscopic 3D needs fixing
Hey, I actually made progress on fixing this. Only one problem... there's a bunch of old screen in the borders. How do I get rid of that and paint it black?
These are the adjustments I made:
These are the adjustments I made:
Code: Select all
void FGLRenderer::PresentSideBySide()
{
mBuffers->BindOutputFB();
ClearBorders();
// Compute screen regions to use for left and right eye views
int leftWidth = screen->mOutputLetterbox.width / 2;
int rightWidth = screen->mOutputLetterbox.width - leftWidth;
//vbb added this
int height = screen->mOutputLetterbox.height / 2;
int top = height * .5;
IntRect leftHalfScreen = screen->mOutputLetterbox;
leftHalfScreen.width = leftWidth;
//vbb added this
leftHalfScreen.height = height;
leftHalfScreen.top = top;
IntRect rightHalfScreen = screen->mOutputLetterbox;
rightHalfScreen.width = rightWidth;
rightHalfScreen.left += leftWidth;
//vbb added this
rightHalfScreen.height = height;
rightHalfScreen.top = top;
mBuffers->BindEyeTexture(0, 0);
DrawPresentTexture(leftHalfScreen, true);
mBuffers->BindEyeTexture(1, 0);
DrawPresentTexture(rightHalfScreen, true);
}
Code: Select all
#define isqrt2 0.7071067812f
static VRMode vrmi_mono = { 1, 1.f, 1.f, 1.f,{ { 0.f, 1.f },{ 0.f, 0.f } } };
static VRMode vrmi_stereo = { 2, 1.f, 1.f, 1.f,{ { -.5f, 1.f },{ .5f, 1.f } } };
//vbb fix vr mode
static VRMode vrmi_sbsfull = { 2, 1.f, 1.f, 1.f,{ { -.5f, 1.f },{ .5f, 1.f } } };
//static VRMode vrmi_sbsfull = { 2, 0.5f, 1.f, 2.f,{ { -.5f, 2.f },{ .5f, 2.f } } };
static VRMode vrmi_sbssquished = { 2, .5f, 1.f, 1.f,{ { -.5f, 1.f },{ .5f, 1.f } } };
static VRMode vrmi_lefteye = { 1, 1.f, 1.f, 1.f, { { -.5f, 1.f },{ 0.f, 0.f } } };
static VRMode vrmi_righteye = { 1, 1.f, 1.f, 1.f,{ { .5f, 1.f },{ 0.f, 0.f } } };
static VRMode vrmi_topbottom = { 2, 1.f, .5f, 1.f,{ { -.5f, 1.f },{ .5f, 1.f } } };
static VRMode vrmi_checker = { 2, isqrt2, isqrt2, 1.f,{ { -.5f, 1.f },{ .5f, 1.f } } };
You do not have the required permissions to view the files attached to this post.
-
- Posts: 281
- Joined: Mon Jun 08, 2015 7:32 am
Re: Stereoscopic 3D needs fixing
I just wanted to comment I am using a poor person's VR setup with a goggle case and mobile phone.
All 3D rendering is squished into a square aspect ratio as the per eye resolution is half of a widescreen format.
But I really like what you are doing to try to preserve the original and correct aspect ratios.
I believe with VR, we simply need 2x WIDESCREENS, for each eye, vs simply halving a widescreen into two squares. All the mainstream VR goggles are like this except for the Primax Wide FOV goggles.
All 3D rendering is squished into a square aspect ratio as the per eye resolution is half of a widescreen format.
But I really like what you are doing to try to preserve the original and correct aspect ratios.
I believe with VR, we simply need 2x WIDESCREENS, for each eye, vs simply halving a widescreen into two squares. All the mainstream VR goggles are like this except for the Primax Wide FOV goggles.
-
- Posts: 439
- Joined: Fri Oct 14, 2005 2:21 pm
Re: Stereoscopic 3D needs fixing
Okay, I figured out that I had to set mOutputLetterbox's top in order to wipe it away.
located in "gl_stereo3.cpp"
For some reason, the title screen scales up by like twice its size and you're looking at the top left corner of it as it gets wiped away when you start a new game. I have no idea how that happened, and if it's even anything to do with my coding or just something I randomly did in the video/display settings options.
Edit: Oh yeah, i removed the .ini, and it was definitely my display settings that did that last irrelevant bit.
located in "gl_stereo3.cpp"
Code: Select all
void FGLRenderer::PresentSideBySide()
{
mBuffers->BindOutputFB();
screen->mOutputLetterbox.top = screen->mOutputLetterbox.height;
ClearBorders();
screen->mOutputLetterbox.top = 0; //reset so screenshots can be taken
// Compute screen regions to use for left and right eye views
int leftWidth = screen->mOutputLetterbox.width / 2;
int rightWidth = screen->mOutputLetterbox.width - leftWidth;
//vbb added this
int height = screen->mOutputLetterbox.height / 2;
int top = height * .5;
IntRect leftHalfScreen = screen->mOutputLetterbox;
leftHalfScreen.width = leftWidth;
//vbb added this
leftHalfScreen.height = height;
leftHalfScreen.top = top;
IntRect rightHalfScreen = screen->mOutputLetterbox;
rightHalfScreen.width = rightWidth;
rightHalfScreen.left += leftWidth;
//vbb added this
rightHalfScreen.height = height;
rightHalfScreen.top = top;
mBuffers->BindEyeTexture(0, 0);
DrawPresentTexture(leftHalfScreen, true);
mBuffers->BindEyeTexture(1, 0);
DrawPresentTexture(rightHalfScreen, true);
}
Edit: Oh yeah, i removed the .ini, and it was definitely my display settings that did that last irrelevant bit.
You do not have the required permissions to view the files attached to this post.