Changing the projection matrix

Advanced OpenGL source port fork from ZDoom, picking up where ZDoomGL left off.
[Home] [Download] [Git builds (Win)] [Git builds (Mac)] [Wiki] [Repo] [Bugs&Suggestions]

Moderator: Graf Zahl

Locked
User avatar
Nash
Developer
Developer
Posts: 1226
Joined: Sun Sep 25, 2005 1:49
Location: Kuala Lumpur, Malaysia
Contact:

Changing the projection matrix

Post by Nash » Sat Jul 28, 2012 18:39

Where in the code is GZDoom doing the aspect ratio correction? I'd like to get rid of the view stretching for my project.

Gez
Developer
Developer
Posts: 1399
Joined: Mon Oct 22, 2007 16:47

Re: Changing the projection matrix

Post by Gez » Sat Jul 28, 2012 19:09


NeuralStunner
Heresy!
Posts: 253
Joined: Tue Dec 29, 2009 3:46
Location: IN SPACE
Contact:

Re: Changing the projection matrix

Post by NeuralStunner » Sat Jul 28, 2012 21:54

I'd still quite like a mod-available setting for both GL and software. (As many folks as are using widescreen nowadays, I don't think it would hurt visibility. Personally I'd hate seeing screenshots of my mod stretched the hell out when a cube should really be a cube.)
Dean Koontz wrote:Human beings can always be relied upon to exert, with vigor, their God-given right to be stupid.
Spoiler: System Specs

User avatar
Nash
Developer
Developer
Posts: 1226
Joined: Sun Sep 25, 2005 1:49
Location: Kuala Lumpur, Malaysia
Contact:

Re: Changing the projection matrix

Post by Nash » Sun Jul 29, 2012 8:58

Graf Zahl wrote:The aspect ratio stretching is currently done in the projection matrix but that's the wrong place
This is what I'd like to find, so I can "undo" the stretching. Changing the code to do stretching in the modelview matrix seems like a huge change. I just want a "quick fix"...

User avatar
Nash
Developer
Developer
Posts: 1226
Joined: Sun Sep 25, 2005 1:49
Location: Kuala Lumpur, Malaysia
Contact:

Re: Changing the projection matrix

Post by Nash » Mon Jul 30, 2012 19:16

Any help with this please? I really need to get rid of the stretching for my game project...

User avatar
Nash
Developer
Developer
Posts: 1226
Joined: Sun Sep 25, 2005 1:49
Location: Kuala Lumpur, Malaysia
Contact:

Re: Changing the projection matrix

Post by Nash » Wed Aug 01, 2012 23:52

Well I found this under FGLRenderer::RenderView in gl_scene.cpp:

Code: Select all

#define RMUL (1.6f/1.333333f)
Changing it to 1.0f seems to do what I want it to do. :dunno: Tested in all aspect ratios too, seems to work.

User avatar
Enjay
There is no dark side in the moon, really...
Developer
Developer
Posts: 4627
Joined: Tue Aug 30, 2005 23:19
Location: Scotland
Contact:

Re: Changing the projection matrix

Post by Enjay » Thu Aug 02, 2012 2:12

I'm intrigued how does it look - both with your mod and when running a Doom game?

User avatar
Nash
Developer
Developer
Posts: 1226
Joined: Sun Sep 25, 2005 1:49
Location: Kuala Lumpur, Malaysia
Contact:

Re: Changing the projection matrix

Post by Nash » Sat Aug 04, 2012 2:43

Hi Enjay, sorry for the late reply.

I don't have much to show yet, but I guess you can see the difference in these WIP shots.

4:3

Square pixels:

Image

Squashed pixels:

Image

16:10

Square pixels:

Image

Squashed pixels:

Image

(DISCLAIMER: Car model is a placeholder by real_trisk and WILL NOT BE USED in final production. It was added just to demonstrate the scaling)

It seems that with square pixels, the horizontal FOV does become slightly smaller, but I'm sure that can be compensated by altering the FOV code so that 1:1 pixels match the FOV of 1:1.2 pixels...

Locked

Return to “GZDoom”