JNechaevsky / international-doom

Small, functional and simple source ports, created with help, efforts and bits of code from people around the world.
https://jnechaevsky.github.io/inter-doom/
GNU General Public License v2.0
25 stars 1 forks source link

Aspect ratio of 16:9 seems to be a "strange" aspect ratio. #139

Closed Meerschweinmann closed 3 months ago

Meerschweinmann commented 3 months ago

Hi Julia,

here i am on a 16:9 screen again ;)

Fiddling around with widescreen assets i have found another strange happening with that aspect ratio.

This is a problem that only very few people will see, so no reason to get in panic. But i wanted to show it to you. because i have that feeling that this could be related to the bunny screen yesterday, before your "bunny fix".

As we all know, the DOOM intermission screens have animated parts. And when showing those screens with widescreen assets in 16:9 our yesterdays bunny screen unfriendly x4 resolution shifts the background picture a bit to the right and so the animated parts do not fit correct.

This does not happen in 16:10 or ultrawide. Or not so strong that i have noticed it.

Switching back to any other res except x4 in 16:9 makes the widescreen intermission screen fit correct to the animated parts.

At Doomworld i have send you the widescreen assets per message if you want to see it with your own eyes.

One thing i have noticed. When selecting the resolution, ID shows the true resolution at the bottom with a stretch of factor 1.2 in vertical.

In 16:9 those resolutions are a bit off. Could that be the problem, even for the bunny yesterday?

For x4 res that is exactly 1706.666x960(800) and is shown as 1704x960(800). Should that not be 1708x960(800) to show all pixels and be dividable with 4? Long time ago i had read that resolutions should be dividable with 4.

When switching the resolutions in 16:9 you can see how the widescreen intermission asset moves around and cut pixels at the borders. In ultrawide and 16:10 it stands still while switching around resolutions.

Here are two 16:9 pictures with 3x and 4x res to show what i mean.

DOOM00 DOOM01

Sorry for that wall of text :)

JNechaevsky commented 3 months ago

Thank you! I see, fortunately, it's not related to bunny screen, which is drawing via totally different functions. Must be a rounding up problem, brought by multiple resolutions. This should do the trick, but I have to check it deeper, as this function will also affects other games, notably while widescreen assets are loaded:

+++ international-doom\src\v_video.c

void V_DrawPatchFullScreen(patch_t *patch, boolean flipped)
{
---    int x = (((SCREENWIDTH / vid_resolution) - SHORT(patch->width)) / 2 - WIDESCREENDELTA);
+++    int x = (((SCREENWIDTH / vid_resolution) - SHORT(patch->width)) / 2 - WIDESCREENDELTA) & (int)~3;
Meerschweinmann commented 3 months ago

That was fast. Thank you too :) I will have a look tomorrow with your fix and will give you feedback. Now i am not near by a computer anymore, because in five hours my night is over.

Meerschweinmann commented 3 months ago

I have tested your fix and it works. The animated DOOM intermission screen does not shift its animations anymore. Luckily DOOM 2, Heretic and Hexen do not have such animated screens like DOOM. Heretic has this cross at the intermission maps, but it should be hard to notice If it is shifted depending on the used resolution. But i will have a look at that later.

Meerschweinmann commented 3 months ago

To complete my feedback what i have tested with the new fix. Heretic intermission screen the arrow stays in place with 16:9 when switching resolutions with widescreen assets. Heretic demon Scroll works when switching resolutions. Hexen ending works too with widescreen assets while switching resolutions.

JNechaevsky commented 3 months ago

Thank you again! Turns out, there was a lot of possible imprecisions in 16:9, but surprisingly happening only in higher that 3x resolutions. Oh well, that's a small price for multiple resolutions.

For x4 res that is exactly 1706.666x960(800) and is shown as 1704x960(800). Should that not be 1708x960(800) to show all pixels and be dividable with 4? Long time ago i had read that resolutions should be dividable with 4.

Probably should be, but 16:9 have problems with precision. Fabian even left a comment about it, and I never tried to do something about it, except small tweaks like this one for multiple resolutions.

Also, rendering resolution indication always showing values for aspect corrected approach. Honestly, I never bothered to update if for non-corrected and even though about removing non-corrected itself, as now it's config-file variable only. But probably better leave it "as it", someone may find it "useful".

Bunny fix needs small revision. A crash is no longer happening, but when not using wide screen assest, second screen shows small black pixel on the left side. If you open and close help screen, it will left a blue vertical line of pixels on bunny screen, meaning "there is a 1px vertical gap between screen buffer and bunny screen". Deffinitly better than possible crash, but ideally should be fixed somehow.

Sorry, still not replied to you on DoomWorld, head feels very dizzy in the evening after long and highly exciting hours at day job.

P.S. Today I have a four years wedding aniversary, oh my! Where has equality gone? Why me? 😱

Meerschweinmann commented 3 months ago

Yeah, dividing even numbers by 9 and multiply them with 16 often gets strange numbers. Eventually it would be better in the 16:9 case to use 427 as horizontal base, even it gets more uneven numbers, but more fitting to the standard 16:9 resolutions. Or in the case of 16:9 using fix non ID self-calculated resolutions. The other side is who counts if the horizontal resolution is 1278, 1280 or 1281? That is only noticeable when you are switching resolutions back and forth like crazy.

The really good aspect ratios are 16:10 and 24:10(12:5). Those match perfect without uneven numbers.

Even the wide spread fantasy aspect ratio 21:9, that none real ultrawide monitor/tv has, fits good in terms of numbers with a horizontal base of 560. By the way this shitty 21:9... All the widescreen assets are 560 pixels wide. Why? Even the narrowest ultrawide ratio 64:27 (2560x1080) needs 569 pixels and the widest 24:10 (3840x1600) needs horizontal 576 pixels.

Apropos pixel counting and resolution switching. This fiddling around with the widescreen assets made me sensible to look at the borders and i had noticed that Inter-DOOM can not deliver more than 3408 pixels horizontally at 6x res on my 3440x1440 monitor. With 6x there are tiny borders left and right. Switching down to 5x, 4x down shows that those tiny borders go away. Even when i replaced the 21:9 ratios numbers in the code to 24 and 10 to emulate a 24:10 screen with selecting aspect ratio of 21:9 it stops at 3408. There is something that limits. That should be enhanced to up to 3456pixels to support the widest of the three UW ratios, an 24:10 UW monitor.

And because i made a new test-copy of ID and switched resolutions, the default wipe was set. So i could see that on my 3440x1440 monitor the wipe was diagonal at 6x res. Every other resolution the wipe was ok. Is it possible that it has something to do with that ID does not go over 3408 pixels in horizontal at 6x?

As i am a 3x to max 4x res user with crossfade on, that does not affect me, but others could be.

Sometimes it is better to play only games instead of doing technical stuff with them. Now i am sensible for things i never noticed before :)

The bunny pixel row i had not noticed. But i had tested only with widescreen assets when i remember correctly.

And about Doomworld. I can wait.

Happy wedding day. You both have a nice day and be good to each other. My wife has forgotten this day more often than me :)

Meerschweinmann commented 3 months ago

Regarding the horizontal resolution limit i have made another test. I have changed the 21:9 aspect ratio against a whopping 32:9 in the code. And i could confirm that the horizontal resolution won't go beyond 3408/3410 pixels depending on wwhich resolution i choose (x4, x5, x6). And when choosing such a horizontal limited resolution the aspect ratio changes, because the height does not fit to the limited width. That confirms what i have noticed a bit on my 3440x1440 monitor with 6x resolution.

And here too, the wipe goes diagonal when i choose a resolution which is horizontally limited. With 32:9 i get this phenomen already from 4x onwards.

Here is an Inter-DOOM screenshot with 32:9 and 3x. If i had such a monitor that could be fun.

DOOM02

JNechaevsky commented 3 months ago

And because i made a new test-copy of ID and switched resolutions, the default wipe was set. So i could see that on my 3440x1440 monitor the wipe was diagonal at 6x res

I'll be short again. I can't reproduce it on 16:9 monitor with 21:9 ingame ratio and 6x resolution. I'll check it on real 21:9 today at evening, for now have some responsibilities with wedding anniversary. Or have you changed something in config file manually?

Here is an Inter-DOOM screenshot with 32:9 and 3x. If i had such a monitor that could be fun.

This would be a good training excursive for neck and head rotation!

Meerschweinmann commented 3 months ago

Do you get more than 3408/3410 pixels in horizontal?

With 21:9 ingame ratio and 6x resolution it is impossible to notice, because you only get 3360 pixels horizontal with 6x and 21:9.

The limit begins to show up more on 43:18 (3440x1440) and 24:10 (3840x1600) monitors with "match screen" ratio, because that are the widest of those three 21:9 marketed ultrawide ratios. When switching back to 5x or lower resolution the picture fills up to the left and right borders of the screen. With 6x i have tiny borders left and right, because i get only horizontal 3408 instead of 3440 or 3456 depending on which monitor ratio i have.

If Inter-DOOM had 32:9 it would show clearly up i had seen in my test. With that ratio i had to go down to 3x res to get not in the hoizontal 3408/3410 limit.

I have tested this with a fresh copy of Inter-DOOM 7.4 and only DOOM2.WAD in the folder. Only aspect ratio and resolution settings were touched. I have learned from yesterdays mysterious chainsaw :)

Meerschweinmann commented 3 months ago

That you don't have to search long after your wedding day responsibilities i have prepared something for you :)

Here is an .exe file with modified aspect ratios to show you the problem even on a 16:9 screen.

Aspect ratios available are match screen, 43:18, 24:10 and 32:9.

Of course on a 16:9 monitor you can not see the tiny borders left and right shown on a real ultrawide monitor, but you can see when getting in that 3408 horizontal pixel limit the wipe gets diagonal and even when you choose 32:9 the horizontal resolution does not get over that limit and affects the shown aspect ratio on screen clearly with higher res.

The diagonal wipe and running into a 3408 limit happens on my 3440x1440 (43:18) ultrawide monitor with the latest official release at 6x res and match screen.

Meerschweinmann commented 3 months ago

inter-doom_AR_test.zip

JNechaevsky commented 3 months ago

I see, thanks! Looks likes it works on 32:9 ratio:

+++ international-doom/src/i_video.c    Fri Jun 21 23:48:07 2024
@@ -1807,7 +1807,7 @@
        }

        // [crispy] ... but never exceeds MAXWIDTH (array size!)
-       SCREENWIDTH = MIN(SCREENWIDTH, MAXWIDTH / 3);
+       SCREENWIDTH = MIN(SCREENWIDTH, MAXWIDTH);
    }

    WIDESCREENDELTA = ((SCREENWIDTH - NONWIDEWIDTH) / vid_resolution) / 2;

Seems to be needed to remove / 3 divider in maximum screen screen resolution variable. Besides from fixing diagonal wiping, it also should preventing picture shrinking in 4x and higher resolutions.

Meerschweinmann commented 3 months ago

Hooray, that does the trick.

Here are two screenshots that show horizontal resolutions higher than 3408 :) Unfortunately the screenshot button works only after the wipe, but i can confirm that the wipe works as intended now at resolutions above 3408 pixels.

By the way. 32:9 was only meant by me to show a resolution that has clearly a higher horizontal res than 3408, but i had no problems playing DOOM with it. For those hardcores with such monitors a nice thing.

24:10 (3840x1600) scales perfect in horizontal 576 pixel width steps without rounding errors.

DOOM04 DOOM05

With 32:9 i have to go down to 5x res, better 4x, with my Ryzen 8700G to achieve stable high framerates i am used to :) But future CPUs are getting surely faster.