[CODE SUBMISSION] Choosing/forcing Aspect Ratio

Moderator: GZDoom Developers

User avatar
Enjay
 
 
Posts: 26936
Joined: Tue Jul 15, 2003 4:58 pm
Location: Scotland
Contact:

Re: Choosing Acspect Ratio

Post by Enjay »

:trippy:

Nope, still lost. Any chance you could insert a pic in the frame that I editied into my last post whilst you were typing your reply?
User avatar
Rachael
Posts: 13914
Joined: Tue Jan 13, 2004 1:31 pm
Preferred Pronouns: She/Her
Contact:

Re: Choosing Acspect Ratio

Post by Rachael »

Would show this:
Image

in this:
nqqkg8-modified.png
nqqkg8-modified.png (214.58 KiB) Viewed 909 times
Last edited by Rachael on Wed Apr 08, 2009 12:59 pm, edited 1 time in total.
User avatar
Enjay
 
 
Posts: 26936
Joined: Tue Jul 15, 2003 4:58 pm
Location: Scotland
Contact:

Re: Choosing Acspect Ratio

Post by Enjay »

SoulPriestess wrote:So, squishy 4:3 image (which is the 3rd image I posted) gets expanded by the cheap ass monitor
Oh, hang on. I think I get it. Zdoom forces the view from a 480x300 image into 320x240 and then (and this is the bit that I didn't realise was part of the equation) the monitor then stretches the 320x240 image back to its full screen thereby seting the ratio back to 16:10 but based on a 320x240 image that had the same FOV (etc) as a 16:10 image. Is that it?

[edit] Thanks for the image. It looks like I am correct - yes? [/edit]
User avatar
Rachael
Posts: 13914
Joined: Tue Jan 13, 2004 1:31 pm
Preferred Pronouns: She/Her
Contact:

Re: Choosing Acspect Ratio

Post by Rachael »

Yes, you are correct.
User avatar
Enjay
 
 
Posts: 26936
Joined: Tue Jul 15, 2003 4:58 pm
Location: Scotland
Contact:

Re: Choosing Acspect Ratio

Post by Enjay »

Phew! Thanks. That means I'll be able to sleep tonight. ;)

How much difference do those few extra pixels at the side of the screen make to a machine's performance? I mean, my setup gives me 16:10 ratios from 360x240 upwards. Would that be significantly slower than a 16:10 image squashed to 320x240 then stretched back out by the monitor?
User avatar
phi108
Posts: 976
Joined: Sat Dec 01, 2007 6:28 pm

Re: Choosing Acspect Ratio

Post by phi108 »

Well, in terms of performance, 1360X768 (the only widescreen mode that my TV supports), can have low performance on detailed maps or with many transparent textures. So If I could just use 800x600 (much better performance), stretched to fill the 16x9 tv screen, I would get a whole widescreen wiew (map01 showing all of both pillars), without having to run at a huge 1360x768 resolution.
User avatar
Rachael
Posts: 13914
Joined: Tue Jan 13, 2004 1:31 pm
Preferred Pronouns: She/Her
Contact:

Re: Choosing Acspect Ratio

Post by Rachael »

Enjay wrote:How much difference do those few extra pixels at the side of the screen make to a machine's performance? I mean, my setup gives me 16:10 ratios from 360x240 upwards. Would that be significantly slower than a 16:10 image squashed to 320x240 then stretched back out by the monitor?
Not much difference - however the point here is the availability of those 16:10 resolutions - 768x480, for example, is rarely supported, and it's the only true 16:10 aspect ratio with 480 lines.
User avatar
phi108
Posts: 976
Joined: Sat Dec 01, 2007 6:28 pm

Re: Choosing Acspect Ratio

Post by phi108 »

Anyway I think the needed changes would be in v_video.cpp, near the bottom below these lines:

// Tries to guess the physical dimensions of the screen based on the
// screen's pixel dimensions. Can return:

Somewhere a cvar would need to be added: Vid_forceaspectratio, that overrides any of the engine's guesses of the correct aspect ratio.
User avatar
HotWax
Posts: 10002
Joined: Fri Jul 18, 2003 6:18 pm
Location: Idaho Falls, ID

Re: Choosing/forcing Aspect Ratio

Post by HotWax »

Is it too late to point out that what the OP is asking for has been around for a long time and is called anamorphic widescreen? :) Many DVD players and some game consoles (including the Wii) use this method of rendering to widescreen displays. The system "squeezes" a widescreen image into a standard 4:3 screen area and relies on the display device to stretch the image back to the proper width.

Here's an adequate (if amateurish) explanation of how it works with pretty pictures! :P The bottom shot is what it looks like when viewing the Wii's widescreen mode on a standard TV, or with your 16:9 TV incorrectly set to 4:3 mode. The one three images up from the bottom is the result after your TV/monitor stretches that same image out to fill all the available space.
User avatar
phi108
Posts: 976
Joined: Sat Dec 01, 2007 6:28 pm

Re: Choosing/forcing Aspect Ratio

Post by phi108 »

So THAT's what anamorphic means. I noticed that this is how the Xbox does it's widescreen as well.
User avatar
Rachael
Posts: 13914
Joined: Tue Jan 13, 2004 1:31 pm
Preferred Pronouns: She/Her
Contact:

Re: Choosing/forcing Aspect Ratio

Post by Rachael »

This is now a code submission.

Added new cvar: vid_aspect
Integer, accepts the following arguments:
0 - Let engine decide
1 - 16:9
2 - 16:10
3 - 4:3
4 - 5:4 (Only if vid_tft is enabled)

vid_nowidescreen overrides this cvar.

EDIT: Fixed a bug.
Attachments
vid_aspect.zip
Applied against r1557
.diff's are changes only, .cpp's are full sources
(33.37 KiB) Downloaded 38 times
User avatar
Rachael
Posts: 13914
Joined: Tue Jan 13, 2004 1:31 pm
Preferred Pronouns: She/Her
Contact:

Re: Choosing/forcing Aspect Ratio

Post by Rachael »

I hate to bump this - but is there any chance of this being added, now that this is a code submission?

It works solidly and I have not had any issues with it yet. I have a test build available also which shows that it is working. If needed, I'll make a menu option for it.
User avatar
phi108
Posts: 976
Joined: Sat Dec 01, 2007 6:28 pm

Re: Choosing/forcing Aspect Ratio

Post by phi108 »

Many thanks SoulPriestess for the new build! This option is perfect!
Gez
 
 
Posts: 17938
Joined: Fri Jul 06, 2007 3:22 pm

Re: Choosing/forcing Aspect Ratio

Post by Gez »

This thread (and the ammo_checkboth one too) should be moved to Code Submission...
User avatar
Rachael
Posts: 13914
Joined: Tue Jan 13, 2004 1:31 pm
Preferred Pronouns: She/Her
Contact:

Re: Choosing/forcing Aspect Ratio

Post by Rachael »

I guess it just needs a menu update. I hate the idea of messing around with the menu, but it seems I have no other choice.

The way I am going to do it is if the value is non-zero, it makes the default aspect ratio selector invisible (since it has no use when vid_aspect is set, anyway), and presents this CVar in its place. You can modify the CVar from the new menu option.

There will be a second menu option that reads whether this cvar is set at all, and it will be named "Anamorphic Aspect Ratio" (or something shorter if there's a good way to shorten it). If it is, it sets itself to "yes", if not, it sets itself to "no". When switched, the following will happen:

If switched to "yes", it copies the current aspect ratio selection (which will become invisible) to the vid_aspect cvar, which can be updated with the menu option which will now become visible.

If switched to "no", it copies from the vid_aspect cvar to the aspect ratio selection, set vid_aspect to zero, allowing you to interact with the resolution menu as previous.
Post Reply

Return to “Closed Feature Suggestions [GZDoom]”