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 »

Where in the code is GZDoom doing the aspect ratio correction? I'd like to get rid of the view stretching for my project.
User avatar
Gez
Developer
Developer
Posts: 1399
Joined: Mon Oct 22, 2007 16:47

Re: Changing the projection matrix

Post by Gez »

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

Re: Changing the projection matrix

Post by NeuralStunner »

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 »

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 »

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 »

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
Developer
Developer
Posts: 4748
Joined: Tue Aug 30, 2005 23:19
Location: Scotland
Contact:

Re: Changing the projection matrix

Post by Enjay »

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 »

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”