Changing the projection matrix
Moderator: Graf Zahl
- Nash
- Developer
- Posts: 1226
- Joined: Sun Sep 25, 2005 1:49
- Location: Kuala Lumpur, Malaysia
- Contact:
Changing the projection matrix
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
- Posts: 1399
- Joined: Mon Oct 22, 2007 16:47
- NeuralStunner
- Posts: 253
- Joined: Tue Dec 29, 2009 3:46
- Location: IN SPACE
- Contact:
Re: Changing the projection matrix
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
- Nash
- Developer
- Posts: 1226
- Joined: Sun Sep 25, 2005 1:49
- Location: Kuala Lumpur, Malaysia
- Contact:
Re: Changing the projection matrix
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"...Graf Zahl wrote:The aspect ratio stretching is currently done in the projection matrix but that's the wrong place
- Nash
- Developer
- Posts: 1226
- Joined: Sun Sep 25, 2005 1:49
- Location: Kuala Lumpur, Malaysia
- Contact:
Re: Changing the projection matrix
Any help with this please? I really need to get rid of the stretching for my game project...
- Nash
- Developer
- Posts: 1226
- Joined: Sun Sep 25, 2005 1:49
- Location: Kuala Lumpur, Malaysia
- Contact:
Re: Changing the projection matrix
Well I found this under FGLRenderer::RenderView in gl_scene.cpp:
Changing it to 1.0f seems to do what I want it to do.
Tested in all aspect ratios too, seems to work.
Code: Select all
#define RMUL (1.6f/1.333333f)

- Enjay
- Developer
- Posts: 4748
- Joined: Tue Aug 30, 2005 23:19
- Location: Scotland
- Contact:
Re: Changing the projection matrix
I'm intrigued how does it look - both with your mod and when running a Doom game?
- Nash
- Developer
- Posts: 1226
- Joined: Sun Sep 25, 2005 1:49
- Location: Kuala Lumpur, Malaysia
- Contact:
Re: Changing the projection matrix
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:

Squashed pixels:

16:10
Square pixels:

Squashed pixels:

(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...
I don't have much to show yet, but I guess you can see the difference in these WIP shots.
4:3
Square pixels:

Squashed pixels:

16:10
Square pixels:

Squashed pixels:

(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...