r_newrenderer pixel ratio support - partial implementation (for now)

Moderators: Rachael, dpJudas

User avatar
Rachael
Developer
Developer
Posts: 3617
Joined: Sat May 13, 2006 10:30

Re: r_newrenderer pixel ratio support - partial implementation (for now)

Post by Rachael » Thu Nov 17, 2016 20:31

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.
Spoiler: Zen Sarcasm

dpJudas
Developer
Developer
Posts: 798
Joined: Sat Jul 23, 2016 7:53

Re: r_newrenderer pixel ratio support - partial implementation (for now)

Post by dpJudas » Thu Nov 17, 2016 20:33

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. :)

User avatar
Rachael
Developer
Developer
Posts: 3617
Joined: Sat May 13, 2006 10:30

Re: r_newrenderer pixel ratio support - partial implementation (for now)

Post by Rachael » Thu Nov 17, 2016 20:34

Indeed I am.

I expanded the screen without it and indeed there's quite a difference.
Screenshot_Doom_20161117_143332.png
Screenshot_Doom_20161117_143332.png (303.12 KiB) Viewed 159 times
Screenshot_Doom_20161117_143336.png
Screenshot_Doom_20161117_143336.png (322.83 KiB) Viewed 159 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.
Spoiler: Zen Sarcasm

dpJudas
Developer
Developer
Posts: 798
Joined: Sat Jul 23, 2016 7:53

Re: r_newrenderer pixel ratio support - partial implementation (for now)

Post by dpJudas » Thu Nov 17, 2016 20:58

Okay, so the world is vertically scaled by 1.2 for reasons only Carmack knows. :)

dpJudas
Developer
Developer
Posts: 798
Joined: Sat Jul 23, 2016 7:53

Re: r_newrenderer pixel ratio support - partial implementation (for now)

Post by dpJudas » Thu Nov 17, 2016 21:08

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.

User avatar
Rachael
Developer
Developer
Posts: 3617
Joined: Sat May 13, 2006 10:30

Re: r_newrenderer pixel ratio support - partial implementation (for now)

Post by Rachael » Thu Nov 17, 2016 21:19

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.
Spoiler: Zen Sarcasm

dpJudas
Developer
Developer
Posts: 798
Joined: Sat Jul 23, 2016 7:53

Re: r_newrenderer pixel ratio support - partial implementation (for now)

Post by dpJudas » Thu Nov 17, 2016 21:21

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.

User avatar
Rachael
Developer
Developer
Posts: 3617
Joined: Sat May 13, 2006 10:30

Re: r_newrenderer pixel ratio support - partial implementation (for now)

Post by Rachael » Thu Nov 17, 2016 21:24

Ugh. Well, Graf solved this problem once with GZDoom.
Spoiler: Zen Sarcasm

dpJudas
Developer
Developer
Posts: 798
Joined: Sat Jul 23, 2016 7:53

Re: r_newrenderer pixel ratio support - partial implementation (for now)

Post by dpJudas » Thu Nov 17, 2016 21:28

Maybe by doing the same distortion as we are doing? ;)

User avatar
Rachael
Developer
Developer
Posts: 3617
Joined: Sat May 13, 2006 10:30

Re: r_newrenderer pixel ratio support - partial implementation (for now)

Post by Rachael » Thu Nov 17, 2016 21:31

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.
Spoiler: Zen Sarcasm

User avatar
Graf Zahl
GZDoom Developer
GZDoom Developer
Posts: 7148
Joined: Wed Jul 20, 2005 9:48
Location: Germany
Contact:

Re: r_newrenderer pixel ratio support - partial implementation (for now)

Post by Graf Zahl » Thu Nov 17, 2016 21:42

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));

dpJudas
Developer
Developer
Posts: 798
Joined: Sat Jul 23, 2016 7:53

Re: r_newrenderer pixel ratio support - partial implementation (for now)

Post by dpJudas » Thu Nov 17, 2016 21:44

Oh I see - so you patch the pitch used for rendering rather than the other way around. That makes sense.

User avatar
Rachael
Developer
Developer
Posts: 3617
Joined: Sat May 13, 2006 10:30

Re: r_newrenderer pixel ratio support - partial implementation (for now)

Post by Rachael » Thu Nov 17, 2016 21:46

Thank you, Graf. :)

dpJudas - obviously this will require more modification of the viewmatrix code - do you want to do it or should I?
Spoiler: Zen Sarcasm

dpJudas
Developer
Developer
Posts: 798
Joined: Sat Jul 23, 2016 7:53

Re: r_newrenderer pixel ratio support - partial implementation (for now)

Post by dpJudas » Thu Nov 17, 2016 22:09

Was about to do it, but if you want to that's fine by me too. :)

User avatar
Rachael
Developer
Developer
Posts: 3617
Joined: Sat May 13, 2006 10:30

Re: r_newrenderer pixel ratio support - partial implementation (for now)

Post by Rachael » Thu Nov 17, 2016 22:46

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.
Spoiler: Zen Sarcasm

Locked

Return to “Closed Suggestions”