r_newrenderer pixel ratio support - partial implementation (for now)
- Rachael
- Developer
- Posts: 3646
- Joined: Sat May 13, 2006 10:30
Re: r_newrenderer pixel ratio support - partial implementation (for now)
The map that I used for the majority of test cases was e2m6. Maybe YaspectMul matters more than we thought. My default testing resolution is 1600x900.
-
- Developer
- Posts: 798
- Joined: Sat Jul 23, 2016 7:53
Re: r_newrenderer pixel ratio support - partial implementation (for now)
Ah, you're playing with the status bar on, aren't you? Think I recall in the past that you did. If you do then that explains it.
- Rachael
- Developer
- Posts: 3646
- Joined: Sat May 13, 2006 10:30
Re: r_newrenderer pixel ratio support - partial implementation (for now)
Indeed I am.
I expanded the screen without it and indeed there's quite a difference.
I expanded the screen without it and indeed there's quite a difference.
The problem with this is - you're scaling *after* the pitch rotation, which causes looking 90-degree up/down view to look distorted.Code: Select all
TriMatrix worldToView = TriMatrix::scale(1.0f, glset.pixelstretch, 1.0f) * TriMatrix::rotate((float)ViewPitch.Radians(), 1.0f, 0.0f, 0.0f) * TriMatrix::rotate((float)(ViewAngle - 90).Radians(), 0.0f, -1.0f, 0.0f) * TriMatrix::swapYZ() * TriMatrix::translate((float)-ViewPos.X, (float)-ViewPos.Y, (float)-ViewPos.Z);
-
- Developer
- Posts: 798
- Joined: Sat Jul 23, 2016 7:53
Re: r_newrenderer pixel ratio support - partial implementation (for now)
Okay, so the world is vertically scaled by 1.2 for reasons only Carmack knows.
-
- Developer
- Posts: 798
- Joined: Sat Jul 23, 2016 7:53
Re: r_newrenderer pixel ratio support - partial implementation (for now)
I've pushed a fix that changes the scaling to be before rotation and also fixes the viewheight for when the status bar is active.
- Rachael
- Developer
- Posts: 3646
- Joined: Sat May 13, 2006 10:30
Re: r_newrenderer pixel ratio support - partial implementation (for now)
I haven't tested it yet - but looking at it, it looks like the code should run perfectly now.
But that is not the aspect ratio that true VGA resolutions run at.
Actually, I think this is all Randi. The code worked perfectly without scaling in ye olde 320x200 days.dpJudas wrote:Okay, so the world is vertically scaled by 1.2 for reasons only Carmack knows.
But that is not the aspect ratio that true VGA resolutions run at.
-
- Developer
- Posts: 798
- Joined: Sat Jul 23, 2016 7:53
Re: r_newrenderer pixel ratio support - partial implementation (for now)
I moved the scaling back to after rotation. Distorted look or not - if its not after the rotation the bullets don't hit where you look at (vertically). Something in the playsim and/or decal code must be doing it in this order.
- Rachael
- Developer
- Posts: 3646
- Joined: Sat May 13, 2006 10:30
Re: r_newrenderer pixel ratio support - partial implementation (for now)
Ugh. Well, Graf solved this problem once with GZDoom.
-
- Developer
- Posts: 798
- Joined: Sat Jul 23, 2016 7:53
Re: r_newrenderer pixel ratio support - partial implementation (for now)
Maybe by doing the same distortion as we are doing?
- Rachael
- Developer
- Posts: 3646
- Joined: Sat May 13, 2006 10:30
Re: r_newrenderer pixel ratio support - partial implementation (for now)
No - looking up at the ceiling or floor yields square pixels. The geometry is actually scaled vertically.
I think what he does is he changes the pitch to match. This is probably going to require some arccos(cos(pitch)*pixelstretch) type functions.
I think what he does is he changes the pitch to match. This is probably going to require some arccos(cos(pitch)*pixelstretch) type functions.
- Graf Zahl
- GZDoom Developer
- Posts: 7148
- Joined: Wed Jul 20, 2005 9:48
- Location: Germany
- Contact:
Re: r_newrenderer pixel ratio support - partial implementation (for now)
Playsim pitch to render pitch:
Code: Select all
// We have to scale the pitch to account for the pixel stretching, because the playsim doesn't know about this and treats it as 1:1.
double radPitch = ViewPitch.Normalized180().Radians();
double angx = cos(radPitch);
double angy = sin(radPitch) * glset.pixelstretch;
double alen = sqrt(angx*angx + angy*angy);
mAngles.Pitch = (float)RAD2DEG(asin(angy / alen));
-
- Developer
- Posts: 798
- Joined: Sat Jul 23, 2016 7:53
Re: r_newrenderer pixel ratio support - partial implementation (for now)
Oh I see - so you patch the pitch used for rendering rather than the other way around. That makes sense.
- Rachael
- Developer
- Posts: 3646
- Joined: Sat May 13, 2006 10:30
Re: r_newrenderer pixel ratio support - partial implementation (for now)
Thank you, Graf.
dpJudas - obviously this will require more modification of the viewmatrix code - do you want to do it or should I?
dpJudas - obviously this will require more modification of the viewmatrix code - do you want to do it or should I?
-
- Developer
- Posts: 798
- Joined: Sat Jul 23, 2016 7:53
Re: r_newrenderer pixel ratio support - partial implementation (for now)
Was about to do it, but if you want to that's fine by me too.
- Rachael
- Developer
- Posts: 3646
- Joined: Sat May 13, 2006 10:30
Re: r_newrenderer pixel ratio support - partial implementation (for now)
It's done now.
You should know, however, your screenblocks commit broke some things. First off, you cannot start the game if screenblocks <= 10 and the new renderer is enabled - otherwise a write access violation occurs.
Secondly, the screen is not shifted upward to accommodate the change. Vanishing Y should be shifted up by half as many pixels as the status bar takes.
You should know, however, your screenblocks commit broke some things. First off, you cannot start the game if screenblocks <= 10 and the new renderer is enabled - otherwise a write access violation occurs.
Secondly, the screen is not shifted upward to accommodate the change. Vanishing Y should be shifted up by half as many pixels as the status bar takes.