Page 2 of 3
Re: r_newrenderer pixel ratio support - partial implementation (for now)
Posted: Thu Nov 17, 2016 20:31
by Rachael
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.
Re: r_newrenderer pixel ratio support - partial implementation (for now)
Posted: Thu Nov 17, 2016 20:33
by dpJudas
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.
Re: r_newrenderer pixel ratio support - partial implementation (for now)
Posted: Thu Nov 17, 2016 20:34
by Rachael
Indeed I am.
I expanded the screen without it and indeed there's quite a difference.
- Screenshot_Doom_20161117_143332.png (303.12 KiB) Viewed 2759 times
- Screenshot_Doom_20161117_143336.png (322.83 KiB) Viewed 2759 times
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);
The problem with this is - you're scaling *after* the pitch rotation, which causes looking 90-degree up/down view to look distorted.
Re: r_newrenderer pixel ratio support - partial implementation (for now)
Posted: Thu Nov 17, 2016 20:58
by dpJudas
Okay, so the world is vertically scaled by 1.2 for reasons only Carmack knows.
Re: r_newrenderer pixel ratio support - partial implementation (for now)
Posted: Thu Nov 17, 2016 21:08
by dpJudas
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.
Re: r_newrenderer pixel ratio support - partial implementation (for now)
Posted: Thu Nov 17, 2016 21:19
by Rachael
I haven't tested it yet - but looking at it, it looks like the code should run perfectly now.
dpJudas wrote:Okay, so the world is vertically scaled by 1.2 for reasons only Carmack knows.
Actually, I think this is all Randi. The code worked perfectly without scaling in ye olde 320x200 days.
But that is not the aspect ratio that true VGA resolutions run at.
Re: r_newrenderer pixel ratio support - partial implementation (for now)
Posted: Thu Nov 17, 2016 21:21
by dpJudas
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.
Re: r_newrenderer pixel ratio support - partial implementation (for now)
Posted: Thu Nov 17, 2016 21:24
by Rachael
Ugh. Well, Graf solved this problem once with GZDoom.
Re: r_newrenderer pixel ratio support - partial implementation (for now)
Posted: Thu Nov 17, 2016 21:28
by dpJudas
Maybe by doing the same distortion as we are doing?
Re: r_newrenderer pixel ratio support - partial implementation (for now)
Posted: Thu Nov 17, 2016 21:31
by Rachael
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.
Re: r_newrenderer pixel ratio support - partial implementation (for now)
Posted: Thu Nov 17, 2016 21:42
by Graf Zahl
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));
Re: r_newrenderer pixel ratio support - partial implementation (for now)
Posted: Thu Nov 17, 2016 21:44
by dpJudas
Oh I see - so you patch the pitch used for rendering rather than the other way around. That makes sense.
Re: r_newrenderer pixel ratio support - partial implementation (for now)
Posted: Thu Nov 17, 2016 21:46
by Rachael
Thank you, Graf.
dpJudas - obviously this will require more modification of the viewmatrix code - do you want to do it or should I?
Re: r_newrenderer pixel ratio support - partial implementation (for now)
Posted: Thu Nov 17, 2016 22:09
by dpJudas
Was about to do it, but if you want to that's fine by me too.
Re: r_newrenderer pixel ratio support - partial implementation (for now)
Posted: Thu Nov 17, 2016 22:46
by Rachael
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.