VOGONS


DOSBox ECE (for Windows & Linux)

Topic actions

Reply 1200 of 1347, by 7F20

User metadata
Rank Member
Rank
Member
TomVDJ wrote on 2021-01-14, 14:20:

Quick question: can I achieve this in Dosbox ECE at this moment: scale a 640 x 400 game to a 1280 x 1000 resolution (resulting in "pixels" that are 2 by 2,5). I want to run Lemmings like this. Original resolution is 640 x 400, but you can see that the game itself already has pixels of 2 x 2 (see attachment "original").

Did you try using opengl and the glshader=sharp?

Reply 1201 of 1347, by jmarsh

User metadata
Rank Oldbie
Rank
Oldbie

Pixel-perfect isn't going to help you run a game at an abnormal pixel aspect ratio (4:5 is neither 1:1 which is what aspect=false implies, nor is it 5:6 which is what aspect=true would give). You would need a custom shader to map the vertices to a 4:3 screen area.

Reply 1202 of 1347, by TomVDJ

User metadata
Rank Newbie
Rank
Newbie
jmarsh wrote on 2021-01-15, 05:34:

Pixel-perfect isn't going to help you run a game at an abnormal pixel aspect ratio (4:5 is neither 1:1 which is what aspect=false implies, nor is it 5:6 which is what aspect=true would give). You would need a custom shader to map the vertices to a 4:3 screen area.

I'm not looking for "aspect ratio perfect", just for sharp pixels. I know 4x5 pixels is a bit off what aspect ratio is concerned, but that doesn't bother me (it will take up most part of my screen with sharp pixels and a very close aspect ratio). Like mentioned in my question, I'm after the result this patch is giving me: https://github.com/bladeSk/DOSBox-pixel-perfect , but the patch fails to work with the vgaonly.

Reply 1203 of 1347, by TomVDJ

User metadata
Rank Newbie
Rank
Newbie
7F20 wrote on 2021-01-15, 00:34:

Did you try using opengl and the glshader=sharp?

I tried glshader=pixel-perfect.glsl and also this gives the correct result when "machine = svga_s3" is used (with wrong color pallette), but once you use "machine = vgaonly" the doublescan seems to kick in, and the game screen does not scale correctly.

(I also don't seem to be able to take a screenshot in this configuration?)

Reply 1204 of 1347, by jmarsh

User metadata
Rank Oldbie
Rank
Oldbie
TomVDJ wrote on 2021-01-15, 09:44:
7F20 wrote on 2021-01-15, 00:34:

Did you try using opengl and the glshader=sharp?

I tried glshader=pixel-perfect.glsl

OK, so how about trying glshader=sharp like what was suggested instead of something completely different?

None of the pixel-perfect patches will give you 4:5, because they are explicitly designed to preserve the original aspect ratio and that's not it.

Reply 1205 of 1347, by TomVDJ

User metadata
Rank Newbie
Rank
Newbie

Don't I need a sharp.glsl file then or something? Don't have a shader that's called "sharp". Where do I find it?

-- Edit --
Oh, OK, it's a build-in one! Tried it and seems to do the trick, also with VGAONLY! But when looking up close, the resolution is not 1000 but 960 in height (resulting in some nice 4x5 pixels, and some square 4x4 pixels). So close, but no cigar 🙁.

Attachments

  • SquarePixelst.gif
    Filename
    SquarePixelst.gif
    File size
    5.07 KiB
    Views
    426 views
    File comment
    Square Pixels
    File license
    Public domain
  • Result.gif
    Filename
    Result.gif
    File size
    93.47 KiB
    Views
    426 views
    File comment
    Result
    File license
    Public domain

Reply 1206 of 1347, by 7F20

User metadata
Rank Member
Rank
Member
TomVDJ wrote on 2021-01-15, 14:03:

Oh, OK, it's a build-in one! Tried it and seems to do the trick, also with VGAONLY! But when looking up close, the resolution is not 1000 but 960 in height (resulting in some nice 4x5 pixels, and some square 4x4 pixels). So close, but no cigar 🙁.

You have to force the output resolution to 1000. Set the output resolution manually in fullscreen.

Reply 1207 of 1347, by TomVDJ

User metadata
Rank Newbie
Rank
Newbie
7F20 wrote on 2021-01-15, 15:30:

You have to force the output resolution to 1000. Set the output resolution manually in fullscreen.

Yep, did that. My config file in attachment...

Attachments

  • Filename
    dosbox-ECE.conf
    File size
    22.75 KiB
    Downloads
    10 downloads
    File comment
    Config file
    File license
    Public domain

Reply 1208 of 1347, by jmarsh

User metadata
Rank Oldbie
Rank
Oldbie
TomVDJ wrote on 2021-01-15, 14:03:

But when looking up close, the resolution is not 1000 but 960 in height (resulting in some nice 4x5 pixels, and some square 4x4 pixels). So close, but no cigar 🙁.

You were told to use output=opengl, you used output=openglnb. That's basically the same as using no shader at all.

You will not get 4:5 pixels because that is not the correct aspect ratio. The sharp shader will give a close approximation of integer resizing while preserving the real aspect ratio. If that's not good enough either buy a monitor with a higher resolution or learn how to write your own shader to force the aspect ratio. Nothing else will do what you're trying to do.

Reply 1209 of 1347, by TomVDJ

User metadata
Rank Newbie
Rank
Newbie

Opengl doesn't do the trick either. I tried all output modes, actually. I see that the pixels are blurry with opengl, while with openglnb they are razor sharp?

This patch actually does perfectly what I'm after: https://github.com/bladeSk/DOSBox-pixel-perfect

Only thing is that this patch does not work well with the machine=vgaonly option (needed to get the colors correct). Opened a ticket for that, and the developer said he'd look into it.

To be clear: what I want is that a 320 x 200 game scales 4 times in with, and 5 times in height, resulting in nice 4x5 pixels in a 1280 x 1000 resolution, with an aspect ratio of 1,28 instead of the classic 1,33. I don't mind that the aspect ration is a tiny bit off. I do mind that in one picture there are different shaped pixels, though! The fact that there are patches out there is proof that there are other people thinking the same way. Also the pixel-perfect patch that was included in ECE in the past (this one: VIDEO Patch for pixel-perfect scaling (SDL1)) does exactly what I'm after. But also that one didn't handle machine=vgaonly. So I'm looking for such a patch / functionality, but that also works with machine=vgaonly.

So again: I KNOW that the aspect ratio is a bit off! That's not the point for me.

Reply 1210 of 1347, by Ringding

User metadata
Rank Newbie
Rank
Newbie

Interesting. The vgaonly setting should not have anything to do with the output side, as it only specifies what is being emulated. So the fact that it manages to mess up a shader is somewhat surprising.

Reply 1211 of 1347, by jmarsh

User metadata
Rank Oldbie
Rank
Oldbie
TomVDJ wrote on 2021-01-15, 23:06:

Opengl doesn't do the trick either. I tried all output modes, actually. I see that the pixels are blurry with opengl, while with openglnb they are razor sharp?

Because you've also got the scaler set to normal2x. The sharp shader emulates integer scaling, but you're forcing 2x scaling before it even gets to the shader.
Vgaonly mode is outputting 400 lines (200 lines doubled).
The normal2x scaler is doubling that to 800.
The sharp shader is doubling it again to 1600 lines then doing a bilinear resize back down to 960. That's where the blurring is coming from.

To be clear: what I want is that a 320 x 200 game scales 4 times in with, and 5 times in height, resulting in nice 4x5 pixels in a 1280 x 1000 resolution, with an aspect ratio of 1,28 instead of the classic 1,33.

You're not getting it.
I'm not saying it's the wrong thing to do because the aspect ratio will be incorrect.
I'm saying it will not work because DOSBox isn't capable of displaying the video with an arbitrary aspect ratio like you are trying to do. Neither are the patches you are referencing.
Your choices are either 1:1 PAR (aspect=false) or 4:3 DAR (aspect=true).
The only other option is to use a custom vertex shader to force the aspect ratio you want. Anything else is a waste of time.

Ringding wrote on 2021-01-16, 08:18:

Interesting. The vgaonly setting should not have anything to do with the output side, as it only specifies what is being emulated. So the fact that it manages to mess up a shader is somewhat surprising.

vgaonly duplicates doubled pixels and/or lines instead of just tweaking the aspect ratio. It doesn't affect shaders, but confuses the pixel-perfect patch because that's implemented in C code that relies on the internal doublewidth/doubleheight flags accurately describing the input buffer to the scalers.

Reply 1212 of 1347, by TomVDJ

User metadata
Rank Newbie
Rank
Newbie
jmarsh wrote on 2021-01-16, 08:32:

Because you've also got the scaler set to normal2x. The sharp shader emulates integer scaling, but you're forcing 2x scaling before it even gets to the shader.

Also with scaler = none, this is not working.

jmarsh wrote on 2021-01-16, 08:32:

Vgaonly mode is outputting 400 lines (200 lines doubled).

That's also what I suspect, but one of the developers of such a patch tells me it should not have an impact on scaling, since it still is a source of 320x200.

jmarsh wrote on 2021-01-16, 08:32:

Neither are the patches you are referencing.

The patches do EXACTLY what I want, but only when machine=svga_s3. See the attachment. This is a screenshot of an old version of DosBox ECE with this patch included: VIDEO Patch for pixel-perfect scaling (SDL1) . So it works perfectly but not with machine=vgaonly.

The creator of the patch explains the idea behind it here: https://www.reddit.com/r/dosbox/comments/4wyj … x_with_scaling/ .

jmarsh wrote on 2021-01-16, 08:32:

The only other option is to use a custom vertex shader to force the aspect ratio you want. Anything else is a waste of time.

There must be a shader like that out there already, no? I'm not a programmer, so I can't make it myself, but since so much effort was done in the past to create these patches, I bet somebody has put the same effort in a shader that does exactly that, no?

Maybe it's best to continue this in the original thread I started frot his here: Pixel Perfect 1280 x 1000 resolution? . Someone suggested there I should also ask the question here in the DosBox ECE thread.

Attachments

  • DosBoxAndPatch.gif
    Filename
    DosBoxAndPatch.gif
    File size
    101.38 KiB
    Views
    349 views
    File comment
    Dosbox EXE with Pixel Perfect Patch
    File license
    Public domain

Reply 1213 of 1347, by 7F20

User metadata
Rank Member
Rank
Member
TomVDJ wrote on 2021-01-16, 08:59:

Someone suggested there I should also ask the question here in the DosBox ECE thread.

This isn't an ECE specific question.

The sharp shader works perfectly for me. Basically, you are telling it to scale 320x200 to 1280x1000. Sharp does this by integer scaling 320x4 and 200x5.

In my config for ECE r4391, I have it set to opengl, fullresolution=1600x1200, aspect=true, scaler=none, shader=sharp, machine=vgaonly.

My monitor is 1920x1200, and this results in a perfect 4:3 1600x1200 image when playing Eye Of The Beholder in both VGA and EGA modes. I don't have Lemmings, so I can't try that for you.

You should try a different game. Try EOTB if you have it. I would also try a different version of DOSBox, one of the SVN builds.

And if you want to know how I can tell that EOTB is correct, it's got a lot of small text, so it's very obvious when the height is unevenly scaled. I've been using EOTB to test scaling in DOSBox for years and I know every pixel.

Reply 1214 of 1347, by TomVDJ

User metadata
Rank Newbie
Rank
Newbie

OK, I downloaded ECE r4391 and used the exact same settings you specified here (except the full resolution, since I don't have a 1200 monitor), but don't get sharp pixels. It also scales to 1280 x 960, not 1280 x 1000. I took a screenshot. (Also enlarged it 4 times to show the result, but you can just zoom in on the complete screenshot to see). I also tried with Space Quest 5 and got the exact same result: no sharp pixels and no rescaling to 1280 x 1000.

I guess the sharp shader also tries to keep the EXACT 4:3 aspect ratio, and does not scale to a resolution that's not 4:3? So 1600 x 1200 is OK, but 1280 x 1000 not?

Attachments

  • Pixels.gif
    Filename
    Pixels.gif
    File size
    29.25 KiB
    Views
    304 views
    File comment
    Enlarged 4 times
    File license
    Public domain
  • Result.gif
    Filename
    Result.gif
    File size
    143.72 KiB
    Views
    304 views
    File comment
    Screenshot
    File license
    Public domain

Reply 1215 of 1347, by 7F20

User metadata
Rank Member
Rank
Member
TomVDJ wrote on 2021-01-16, 18:06:

I guess the sharp shader also tries to keep the EXACT 4:3 aspect ratio, and does not scale to a resolution that's not 4:3? So 1600 x 1200 is OK, but 1280 x 1000 not?

The sharp shader works fine, and a lot of people use it so I think it's something with you setup.

First of all, exactly what are you doing? I read back and I don't see your complete setup.
I've actually never even heard of a 1280x1000 monitor, I don't think it exists. You must be trying to letter box 1280x1024 native res LCD?

If this is correct, I can see three ways that it's possibly screwed up. 1) There is scaling on your monitor which you can fix by turning it off. Locate all settings for both scaling and aspect correction on your monitor and turn them off for all inputs. This can be tricky because many monitors store profiles based on resolution and will have different defaults for each. To make sure this is set correctly, make sure you double check all of those settings after starting the game to make sure it's not resetting things after a resolution change.
2) There are scaling settings on your computer. This can be fixed by locating all settings relating to the program settings. If you have a mac I don't know, but if it's a PC, then check both Nvidia and Intel settings and ensure they are not scaling or performing any aspect correction. You may have to find program-specific settings and turn things off specifically for the dosbox executable.

3) You still have something wrong in the config. It's possible that if your final resolution is not a 4:3 resolution, then you have to do aspect=false. That makes sense based on your last comment.

If all those things are checked and ok, then there is something in one of those other systems that is forcing aspect correction.

Reply 1216 of 1347, by TomVDJ

User metadata
Rank Newbie
Rank
Newbie

My monitors full resolution is 1920 x 1080.

7F20 wrote on 2021-01-16, 19:27:

The sharp shader works fine

So just to be clear: the sharp shader is supposed to handle a 320x200 that has to be on a 1920 x 1080 monitor like this:

- multiply width by 4
- multiply height by 5
- resulting in sharp 4x5 pixels
- resulting in a 1280 x 1000 output
- with an aspect ratio of 1.25 (5:4) instead of 1.33 (4:3) ? (=> I guess this part is not the case?)

The above is exactly what the old pixel-perfect patch did, but I don't seem to be able to achieve this with the sharp shader.

Since you stated:

7F20 wrote on 2021-01-16, 19:27:

3) You still have something wrong in the config. It's possible that if your final resolution is not a 4:3 resolution, then you have to do aspect=false. That makes sense based on your last comment.

I guess that's the issue here: the final aspect ratio is indeed not 4:3 but as I said before: I'm perfectly fine with a 5:4 aspect ratio as long as all the pixels have the same shape (4x5) and are sharp. So is it right if I assume that the sharp shader only works perfectly if you are able to maintain the 4:3 aspect ratio (if your monitor is big enough)?

Reply 1217 of 1347, by 7F20

User metadata
Rank Member
Rank
Member
TomVDJ wrote on 2021-01-16, 20:14:
My monitors full resolution is 1920 x 1080. […]
Show full quote

My monitors full resolution is 1920 x 1080.

7F20 wrote on 2021-01-16, 19:27:

The sharp shader works fine

So just to be clear: the sharp shader is supposed to handle a 320x200 that has to be on a 1920 x 1080 monitor like this:

- multiply width by 4
- multiply height by 5
- resulting in sharp 4x5 pixels
- resulting in a 1280 x 1000 output
- with an aspect ratio of 1.25 (5:4) instead of 1.33 (4:3) ? (=> I guess this part is not the case?)

The above is exactly what the old pixel-perfect patch did, but I don't seem to be able to achieve this with the sharp shader.

In my setup, I use sharp to go from 320x200 (pre-scaled VGA) to 1600x1200. I get perfectly uniform non-square pixels out of it. I have been told elsewhere on the forum that the behavior of the sharp shader is essentially equivalent to the pixel perfect patch in the end result. The end result of the PPP is that it integer scales whole lines unevenly in order to achieve non-square pixels. In my setup, that means the horizontal is x5 and the vertical is x6. 320x5=1600, 200x6=1200.
So I assume, based on what I have been told, and my own results that the sharp shader does.

One issue I see with your reasoning here is this:

- with an aspect ratio of 1.25 (5:4) instead of 1.33 (4:3) ? (=> I guess this part is not the case?)

Since your monitor is 1920x1080, your actual visible area that is 1280x1000 is going to be 5:4, yes. Giving yourself 1000 vertical is going to letterbox your image and pillarbox your image to 5:4 in the center of your screen. It should still be possible to get uniform pixels out of that though (just at a slightly wrong total aspect ratio.

I'm perfectly fine with a 5:4 aspect ratio as long as all the pixels have the same shape (4x5) and are sharp. So is it right if I assume that the sharp shader only works perfectly if you are able to maintain the 4:3 aspect ratio (if your monitor is big enough)?

I can't answer that because I only have the one monitor which is 1920x1200. I've never tried to force either the PPP or the sharp shader to conform to a non-4:3 aspect ratio. It's totally possible that it's creating some issue with my level of knowledge of it. However, I would be tempted to say that you should be able to get a uniform 5:4 image out of it.

Reply 1218 of 1347, by jmarsh

User metadata
Rank Oldbie
Rank
Oldbie

The sharp shader (which I wrote) isn't the same as pixel perfect. It does its best to imitate integer scaling - if the output size is an exact multiple of the input you get perfect integer scaling, otherwise the edge of each input pixel will be interpolated (rather than the entire output which is what regular bilinear filtering does).
It will not scale to an arbitrary aspect ratio. None of the built-in shaders do anything to adjust the output size, that is decided by the render code based on the aspect ratio setting.

Even shader=none (with output=opengl) will use integer scaling if the output size is an exact multiple of the input size, since filtering gets disabled for that case.

Reply 1219 of 1347, by 7F20

User metadata
Rank Member
Rank
Member
jmarsh wrote on 2021-01-16, 23:15:

Even shader=none (with output=opengl) will use integer scaling if the output size is an exact multiple of the input size, since filtering gets disabled for that case.

Okay. That explains why I never ran into the issue (being that I have a 4:3 resolution).

So, from what you're saying, I'm getting something like 320x200 times 5 equals 1600x1000 and then the extra line is made-up with edge interpolation till it's stretched to 1200 vertically?
Honestly, it looks good and I can't tell it from the same thing with the PPP.

Sounds like the best solution for this guy is to either use PPP and be good with that and 5:4 or to use sharp and scale to 4:3 aspect=true at 1440x1080. At least it will basically be the right size.