VOGONS

Common searches


First post, by KBABZ

User metadata
Rank Newbie
Rank
Newbie

I've had this problem (if it is a problem) for a while now; I get some rows of pixels stretched vertically so that they're double the height. I've attached an image showing what I mean; the cursor in the Raptor menu will appear thicker in some places due to the pixel stretch.

Is this intentional, and is there a way to get rid of it?

Attachments

  • DOSBox Stretch.jpg
    Filename
    DOSBox Stretch.jpg
    File size
    222.26 KiB
    Views
    2777 views
    File license
    Fair use/fair dealing exception

Reply 1 of 19, by Mau1wurf1977

User metadata
Rank l33t++
Rank
l33t++

Yes this is because of aspect ratio and to do with pixels on CRT monitors being rectangles, whereas on LCDs they are square.

It's a basic Maths problem. The game on a CRT has 320 x 200 pixels, but the image is shown in a 4:3 aspect ratio.

On modern LCDs the only resolution that integer scales (no pixel getting stretched to take two pixels) is the 1600 x 1200 resolution (1920 x 1200 monitors can also do this).

You can minimize this effect by:

Having a very high resolution monitor with small dot pitch (27" 1440p for example)

or you can use render output openglnb which will smoothen out the image. It will look less sharp, but more consistent.

I visually explain the whole thing in this video:

http://www.youtube.com/watch?v=KwDZnKBa-5o

http://www.youtube.com/watch?v=T80o3Rf3MhU

My website with reviews, demos, drivers, tutorials and more...
My YouTube channel

Reply 2 of 19, by KBABZ

User metadata
Rank Newbie
Rank
Newbie

Thanks for the help, although I realize that I should have specified that I only have this issue in windowed mode. In full screen it doesn't seem to matter what the render output is for me; the pixels are all the same height every time.

To give a bit of clarification, currently I'm taking screenshots of the DOS games I used to play as a kid so I can make some album art for their music. Sometimes, as is the case for Commander Keen, I need to take a 4:3 image and move elements around to fit into a 1:1 square. When doing this it's a lot easier to have DOSBox in windowed mode at 'actual size' rather than blown up to fit the screen in full screen mode. The offset however is that in windowed mode I get the rows of taller pixels, hence me asking how to change it above.

Reply 3 of 19, by Mau1wurf1977

User metadata
Rank l33t++
Rank
l33t++

What is the native resolution of your monitor?

How do you take screenshots? If you use the DOSBox built-in screenshot function then it saves them as 320 x 200 images, no matter what resolution you have on the screen. You will then manually have to aspect correct the images.

Do you have

aspect=true

in your config file?

My website with reviews, demos, drivers, tutorials and more...
My YouTube channel

Reply 4 of 19, by Licentious Howler

User metadata
Rank Newbie
Rank
Newbie

Huh, openglnb is supposed to smooth out the stretch artifacts? Funny enough it gives me the sharpest image, whereas everything else looks like it has a fairly simple bilinear filter over it. This seems consistent across 3 different GPUs and monitors as well. In any case, it worked a charm for me.

As for the issue at hand, could it be that your GPU driver is smoothing things out in fullscreen, but not Windowed mode? It's farfetched considering how little it's involved with DOSBox, but I've always noticed my AMD drivers don't do Anti-Aliasing in Windowed mode, for whatever reason. Unfortunately, I never bothered to find a fix for this ever, so no advice if that's the issue.

Reply 5 of 19, by KBABZ

User metadata
Rank Newbie
Rank
Newbie

The native resolution of my monitor is 1600x900. But it doesn't matter because the screenshot function worked! Dunno why I didn't think to try it before, although it makes me wonder why windowed DOSBox doesn't have an option to turn this vertical-pixel-CRT-stretch thing on and off.

As a 'for the record' thing, taking a screenshot with PrtScrn and cropping the window results in an image that is 320x240, meaning that windowed DOSBox effectively 'adds' an extra 40 pixels in height.

Reply 6 of 19, by Mau1wurf1977

User metadata
Rank l33t++
Rank
l33t++

320 x 240 is aspect corrected 320 x 200 😀

That's what aspect=true does.

Set it to false and you will get your 320 x 200 pixels.

BUT because the LCD has square pixels, the image will be like widescreen.

95% of YouTube DOSBox videos have the wrong aspect ratio 😀

Licentious Howler wrote:

Huh, openglnb is supposed to smooth out the stretch artifacts? Funny enough it gives me the sharpest image, whereas everything else looks like it has a fairly simple bilinear filter over it. This seems consistent across 3 different GPUs and monitors as well. In any case, it worked a charm for me.

As for the issue at hand, could it be that your GPU driver is smoothing things out in fullscreen, but not Windowed mode? It's farfetched considering how little it's involved with DOSBox, but I've always noticed my AMD drivers don't do Anti-Aliasing in Windowed mode, for whatever reason. Unfortunately, I never bothered to find a fix for this ever, so no advice if that's the issue.

😊 My bad

It's the other way round!

opengl smoothens it out, openglnb for razor sharp pixels...

My website with reviews, demos, drivers, tutorials and more...
My YouTube channel

Reply 8 of 19, by Aplha Strike 21

User metadata
Rank Newbie
Rank
Newbie

Hi, this problem bothered me a long time, so this thread realy helped.
My LCD monitor has a max resolution of 1080p and it helped if i set the dosbox resolution to 1776x1000 one among my max resolution.

Now it seems that no pixel is getting stretched.

I seems that Mau1wurf1977 is realy into this, so i have an other question. Is there a filter or any possibility to emulate a screen like the old days with scanlines cause that is the only thing im missing right now for the perfekt retro atmosphere. Is there any way to create something like that or will there be any further development?

Thanks

Reply 9 of 19, by Mau1wurf1977

User metadata
Rank l33t++
Rank
l33t++

I'm the wrong person to ask about scanlines and other "rertro CRT" filters. I don't miss CRTs, blurry pixels and scanlines one bit 😀

My website with reviews, demos, drivers, tutorials and more...
My YouTube channel

Reply 10 of 19, by Aplha Strike 21

User metadata
Rank Newbie
Rank
Newbie

It seems i was wrong with my resolution 1776x1000 creates much coherent pixels but not to 100%.
So 1600 x 1200 is the only resoltion that creates no stretched pixels on LCDs?
sadly my monitor does not support this resolution.

When i set the resolution on "original" all pixel seem 100% correct, why is this?
My only problem with this is that now the screen is blurred of the low resolution that my lcd is not supporting.

Reply 11 of 19, by Aplha Strike 21

User metadata
Rank Newbie
Rank
Newbie

@ Mau1wurf1977

i watched your video. So if i understand it right, there are three options for optimal pixel size.

First,the use of open gl and second a resolution of 1600 x 1200 pixel and third an 16:10 monitor.

If i had an LCD with 4:3 the pixels will be always in the right size too ?

Thanks

Reply 12 of 19, by Mau1wurf1977

User metadata
Rank l33t++
Rank
l33t++
Aplha Strike 21 wrote:

If i had an LCD with 4:3 the pixels will be always in the right size too ?

Thanks

No! 1024 x 768 15" monitors are 4:3, but will not integer scale 320 x 200.

Yes your options are:

4:3 LCD with 1600 x 1200
16:10 LCD with 1920 x 1200

ANY LCD with more than 1200 lines and playing letterboxed / pillarboxed.

My website with reviews, demos, drivers, tutorials and more...
My YouTube channel

Reply 13 of 19, by TeddyTheBear

User metadata
Rank Newbie
Rank
Newbie

I've had to deal with this issue recently and I came up with a slightly different solution that I've only seen one other person briefly mention here but he didn't really explain the idea behind it.

My goals were to play on my 1920x1080 resolution square pixel monitor and have the image take up the full height, maintain the intended aspect ratio, use the tv scalers but not have the extra rows from aspect=true which look horrible, pixels as sharp as possible but also, more importantly because it really bothers me, NOT have pixels that are different sizes due to non integer scaling which means the pixels have to be slightly blurry and there will be some scaling artifacts but for me they were much less noticeable, at least for games with 320x200 resolution.

Because I could not get DosBOX to scale to full height after using the tv scaler, the only solution I could come up with was to create a custom resolution that is a wider aspect ratio than than my monitor so that when it is rescaled by either the monitor's circuitry or the graphics driver it will be the correct 4:3 aspect ratio with pillar boxing.

To calculate the resolution isn't too difficult.
Height = height of dos game * integer scaler you are using (2x/3x)
Width = aspect ratio of your monitor / aspect ratio of dos game resolution / aspect ratio of non-square pixels * width of dos game * integer scaler

So in my case it would be:
Height = 200 * 3 = 600
Width = (16/9) / (8/5) / (5/6) * 320 * 3 = 1280

I only have nVidia hardware so I'm only familiar with their drivers but I assume it's similar with AMD and Intel. If you choose to have the graphics driver perform the scaling you need to remember to set the scaling to Full-screen. I prefer to leave it on Aspect ratio for other reasons however so I opted to have the monitor scale it instead so I don't have to change any settings. To do this you could change the scale setting in the driver from GPU to Display but again this is something I would have to remember to do every time I want to play. However, when you are creating your custom resolution you will notice that the timing values are for your native resolution. If you change the timing standard dropdown from automatic to one of the other options it will recalculate the "correct" timings for you and your custom resolution will always be scaled by the display (if it is capable of scaling your custom resolution) no matter what scaling settings you have set in the driver.

In the dosbox.conf file (it's a good idea to have one for each game) the relevant settings are:

[sdl]
fullscreen=true
fullresolution=1280x600
output= You can actually put anything you want here, even surface. The scaling isn't done by DosBOX.

[render]
aspect=false
scaler=tv3x (or any scaler you prefer, you will have to calculate a different resolution for x2 scalers)

In the game Descent 2 it allows you to change the resolution from in-game and I guess this works different in DosBOX or something because I had to put "scaler=tv2x forced" in the conf file, there may be other games that need this as well.

Of course because aspect=false DosBOX, screenshots/videos will still be square pixels so you will have to scale them in your image/video editor of choice so this doesn't really solve the op's issue but I still think it's relevant if you are actually playing the games.

Reply 14 of 19, by Mau1wurf1977

User metadata
Rank l33t++
Rank
l33t++

You complain about blurry scaling, then use a TV scaler 😲

Madness...

Still trying to wrap my head around what your solution is meant to do, but whatever you try, you simply cannot cheat mathematics rules. And this problem is as good as a maths problem will ever get 😀

Lets call the resolution width and height:

To get integer scaling these three conditions need to be true:

width x 4/3 = height
MODULO(width/320)=0
MODULE(height/200)=0

Up to a resolution of 4K there is only a single resolution that matches all 3 conditions: 1600 x 1200.

You cannot argue against Maths 🤣

My website with reviews, demos, drivers, tutorials and more...
My YouTube channel

Reply 15 of 19, by TeddyTheBear

User metadata
Rank Newbie
Rank
Newbie

I don't think I was complaining about blurry scaling? It's more about DoxBOX's lack of being able to scale to full resolution after it's done a 2x/3x scale with aspect=false. I obviously want it as sharp as I can get it but I also want full height so that means non-integer scaling and I'm OK with the artifacts that this particular resolution mismatch give.

Last edited by TeddyTheBear on 2014-01-25, 02:17. Edited 1 time in total.

Reply 16 of 19, by Mau1wurf1977

User metadata
Rank l33t++
Rank
l33t++

I see, but then why so complicated?

Check out this video on exactly this topic:

http://www.youtube.com/watch?v=T80o3Rf3MhU

and

http://www.youtube.com/watch?v=KwDZnKBa-5o

My website with reviews, demos, drivers, tutorials and more...
My YouTube channel

Reply 17 of 19, by TeddyTheBear

User metadata
Rank Newbie
Rank
Newbie

Non-integer scaling made all the columns and rows different sizes and this was the only solution that I tried that fixed it. I guess I'm more sensitive to that artifact than the others. I don't consider it complicated but complete 🤣 ...maby convoluted...

Reply 18 of 19, by Auzner

User metadata
Rank Member
Rank
Member

I'm puzzled by this. Can or can't DOS Box apply scaling algorithms to upscaled resolutions?
Could the 320x200 be upscaled 5x to 1600x1000, and then that 1600x1000 is the data which is used to do like a live bicubic (or some optimal nice looking algorithm) to stretch it into 1600x1200? Otherwise if that's all done at 640x400 or 320x200 the results are much poorer.
I've looked into this before but could never get satisfactory results. I have bought some CRTs recently in case there is no solution.

Please read attachment comments

Attachments

  • Filename
    1920x1200 nearest neighbor.png
    File size
    26.86 KiB
    Downloads
    No downloads
    File comment
    320x200 image data has every pixel drawn 6x to fill a modern 16:10 LCD
    File license
    Fair use/fair dealing exception
  • 640x480 nearest neighbor.png
    Filename
    640x480 nearest neighbor.png
    File size
    13.74 KiB
    Views
    2406 views
    File comment
    320x200 image data is input into a nearest neighbor filter to produce a 4:3 640x480 pixel image
    File license
    Fair use/fair dealing exception
  • Filename
    1600x1200 bicubic fix.png
    File size
    73.12 KiB
    Downloads
    No downloads
    File comment
    1600x1000 image data is input into a bicubic filter to interpolate an extra 200 vertical lines to achieve 4:3 from 16:10 data
    File license
    Fair use/fair dealing exception
  • 640x480 bicubic fix.png
    Filename
    640x480 bicubic fix.png
    File size
    51.24 KiB
    Views
    2406 views
    File comment
    640x400 image data is input into a bicubic filter to interpolate an extra 80 vertical lines to achieve 4:3 from 16:10 data
    File license
    Fair use/fair dealing exception
  • 320x240 bicubic fix.png
    Filename
    320x240 bicubic fix.png
    File size
    42.67 KiB
    Views
    2406 views
    File comment
    320x200 image data is input into a bicubic filter to interpolate an extra 40 vertical lines to achieve 4:3 from 16:10 data. (2x NN resize for viewing clarity)
    File license
    Fair use/fair dealing exception

Reply 19 of 19, by VileR

User metadata
Rank l33t
Rank
l33t
Auzner wrote:

I'm puzzled by this. Can or can't DOS Box apply scaling algorithms to upscaled resolutions?
Could the 320x200 be upscaled 5x to 1600x1000, and then that 1600x1000 is the data which is used to do like a live bicubic (or some optimal nice looking algorithm) to stretch it into 1600x1200?

There's a patch that adds a normal5x scaler. Rather CPU-hungry unfortunately, but does what you want if you add aspect=true and use an appropriate output renderer.
What truly baffles me is that graphics chipsets/drivers *still* don't offer a decent solution across the board for implementing this sort of behavior on the GPU.

[ WEB ] - [ BLOG ] - [ TUBE ] - [ CODE ]