VOGONS


First post, by eierfrucht

User metadata
Rank Newbie
Rank
Newbie

I wasn't able to find Dege's e-mail address on his home page so I decided to ask here.

O great Dege, do you have any plans to add support for hardware-accelerated 2D upscaling?

Popular old 2D games like Arcanum, Fallout Tactics, Knights of Honor or Celtic Kings all have fan-made HD patches; the problem is that even on large displays, everything is just too small at 1920x1080 (I"m not even mentioning UHD or 4K)

The best kind of scaling is probably achieved at 1366x768 or 1440x900. The bad thing is that most displays -- quite naturally -- do a very poor upscaling job.

All these games seem to work with dgVoodoo2 (with certain tweaks) so I thought that if would be really cool to implement a hardware-accelerated 2D upscaler.

The first thing that came to my mind is a simple Bicubic filter -- even it would yield a much better looking picture as long as the display keeps its native resolution and does no scaling of its own.

The second thing is this sophisticated open-source upscaler: https://sourceforge.net/projects/xbrz/

It does an amazing job upscaling Heroes of Might & Magic III: https://www.youtube.com/watch?v=1HjObkE2Pks

Alas, HoMM III uses a custom-made render wrapper https://sites.google.com/site/heroes3hd/eng/description that was designed on purpose for this game only.

Another thing that came to my attention is that Arcanum and Fallout Tactics, when launched with dgVodoo, get quite laggy; this seems inexplicable since some old 3D games like Sacred or Might & Magic 8 also use DX8/DX7 but actually get a noticeble performance boost with dgVoodoo.

Even if it's impossible to implement XBRZ, could you possibly just add a simple, late-stage Bicubic upscaler that treats every finished frame (rendered at 800x600, 1024x768, 1368x768, 1440x900, etc) as a 3D surface then upscales it to the display's native resolution using hardware acceleration? DirectX 11 should offer a good variety of texture scaling options...

Reply 1 of 32, by ZellSF

User metadata
Rank l33t
Rank
l33t

If you set dgVoodoo2 to use any of the scaling modes below the first three, dgVoodoo2 will handle the upscaling (probably hardware accelerated). I think it's bilinear and not bicubic. More scaling options would be nice.

eierfrucht wrote:

The best kind of scaling is probably achieved at 1366x768 or 1440x900.

Ideal scale factors are integer scale factors and those two aren't integer scale factors for any common display resolution. Not that it makes a huge difference for any sort of interpolated scaling method.

eierfrucht wrote:

The second thing is this sophisticated open-source upscaler: https://sourceforge.net/projects/xbrz/

Can I be the first person to say "eww". XBRZ and similar scalers always ruin the source art in some way.

eierfrucht wrote:

Another thing that came to my attention is that Arcanum and Fallout Tactics, when launched with dgVodoo, get quite laggy; this seems inexplicable since some old 3D games like Sacred or Might & Magic 8 also use DX8/DX7 but actually get a noticeble performance boost with dgVoodoo.

This was the part of your post I was going to reply something useful to. Disable vsync in your graphic driver. dgVoodoo2 doesn't like vsync for some games.

If you want to avoid tearing you can run the game windowed. Then it will be vsynced by the window compositor, which won't affect the game's performance in the same way.

Reply 2 of 32, by eierfrucht

User metadata
Rank Newbie
Rank
Newbie

If you set dgVoodoo2 to use any of the scaling modes below the first three,

I may sound stupid, but what do you mean by 'below the first three'?

dgVoodoo2 will handle the upscaling (probably hardware accelerated)

No matter how hard I experimented the upscaling was sort of jagged/uneven/grainy/flaky/whatever and not just the regular 'a bit blurry', it looked even worse than display-driven interpolation.

Ideal scale factors are integer scale factors and those two aren't integer scale factors for any common display resolution. Not that it makes a huge difference for any sort of interpolated scaling method.

You are absolutely right, but I was talking about a different thing.

English is not my native language, by 'best kind of scaling' I was trying to say that games originally designed to run at 800x600 or 1024x768 look best when upscaled no larger than 1366x768 or 1440x900 -- everything is big enough not to put any strain on the eyes and the HUD is small enough not to occupy like 1/3 of the screen, but isn't way too small. And I'm talking about my 27 inch display. With smaller displays I'd stick with 1280x720 for 800x600 and 1366x768 for 1024x768.

But these resolutions look really bad on a 1920x1080 display exactly because of the stuff you mentioned -- display-driven upscaling is more often poor than not due to purely mathematical reasons.

Can I be the first person to say "eww". XBRZ and similar scalers always ruin the source art in some way.

They may ruin pixel art, but the games I mentioned are notorious for using very small sprites rendered from 3D models. Such sprites lack the artistic conventions of pixel art (e.g. contrast, outlines, palette, etc, etc) and thus aren't really ruined by xBRZ -- especially if we upscale by a small factor.

This was the part of your post I was going to reply something useful to. Disable vsync in your graphic driver. dgVoodoo2 doesn't like vsync for some games.

Well, if I enable vsync, those games come down to a crawl, like one frame every few seconds (!) I'm pretty well aware of it. Without Vsync, FPS is just halved or cut by a third. This is only noticeable in games that don't use any 3D surfaces. And that's very suspicious.

Merely wrapping Fallout Tactics in dgVoodoo2 -- without really changing/upscaling anything -- results in a noticeable performance hit, in just about every dgVoodoo mode that doesn't break the game altogether. Arcanum is literally decimated.

Reply 3 of 32, by ZellSF

User metadata
Rank l33t
Rank
l33t
eierfrucht wrote:

If you set dgVoodoo2 to use any of the scaling modes below the first three,

I may sound stupid, but what do you mean by 'below the first three'?

First three in this dropdown:

Clipboard01.png
Filename
Clipboard01.png
File size
40.27 KiB
Views
3561 views
File license
Fair use/fair dealing exception
eierfruch wrote:

Well, if I enable vsync

You don't need to not enable vsync, you need to explicitly force it off in your graphic card drivers.

Reply 4 of 32, by Dege

User metadata
Rank l33t
Rank
l33t

Yes, as Zell says, dgVoodoo has its own scaling mechanism for 'Stretched, *' and 'Centered, keep Aspect Ratio' scaling modes. This is plain bilinear but you can force point sampled in the config.

'Unspecified', 'Centered' and 'Stretched' are up to the driver/display (the 3 first options from the dropdown list).

So, basically you'd like new scaling filters beyond the bilinear/point sampled ones?

Reply 5 of 32, by ZellSF

User metadata
Rank l33t
Rank
l33t

If you're taking suggestions for adding new scaling filters, I really like lanczos scaling for somewhat high resolution (1024x768 and above) sources. It looks sharper than bilinear, without actually looking different.

Reply 6 of 32, by eierfrucht

User metadata
Rank Newbie
Rank
Newbie

Okay, I must be totally stupid and ignorant. I've been tampering with the MM6-7-8 Merge Mod that basically runs on the Might & Magic 8 engine beefed up with GrayFace's MM8 2.2 Patch

I'm using the stable dgVoodoo v2.55.4 with it so the 3D part of the game looks better than ever:

4t2EQeE.jpg

But no matter which dgVoodoo.conf filtering options I choose, the 2D parts (sprites making up the user inteface) are jaggy at all times:

EecHouZ.jpg

I tried everything from App Driven to 16x Anisothropic, also tried switching Bilinear Blit Stretch on and off -- it's all the same!

All I want is a bit of Bicubic filtering for the UI bits:

fhXJibN.jpg

Can we have this with the state-of-art dgVoodoo 2.55.4? Which values should be set in dgVoodoo.conf then?

This issue plagues me in many other older games -- all the 2D elements get jaggy which I can't stand, but I wouldn't mind a bit of blurring instead. Or maybe even some xBRZ goodness if it ain't too hard on the CPU...

Reply 7 of 32, by eierfrucht

User metadata
Rank Newbie
Rank
Newbie

Arcanum behaves quite differently. It goes down to a crawl if I enable MSAA, any form of filtering, or set any option to anything other than 'Off' or 'App Driven'

But it does get a nice smoothed out picture if I enable 'Bilinear Blit Stretch'

Here's a screenshot of Arcanum patched (with HD Mod) for 1280x720 but upscaled with dgVoodoo 2 v2.55.4 to 1920x1080:

F3wJgTZ.jpg

Worse than Bicubic, I suppose, but at least it works!

Alas, when I get past the character creation screen, I start getting this mess:

QGF5t3I.jpg

Reply 8 of 32, by Drifter82

User metadata
Rank Newbie
Rank
Newbie
Dege wrote:

So, basically you'd like new scaling filters beyond the bilinear/point sampled ones?

Yes, if it is reasonable.

Bicubic or Lanczos upscaling looks a lot better than bilinear for these old 2d games.

Great wrapper btw.

Reply 10 of 32, by ZellSF

User metadata
Rank l33t
Rank
l33t

GeDoSaTo's bicubic scaling looks sort of bad and since I don't know how bicubic scaling is supposed to look I didn't do a comparison for that, but here's bilinear vs lanczos (using GeDoSaTo). 1080p screenshots that you can view on a common monitor (I would say the difference is more important at 4K, but then image size limits gets to be a problem).

First, a 3D rendered game, Legend of Grimrock II at 1280x720. Lanczos and bilinear. The difference in scaling modes is obvious if you look at the text, but that's what this example's about. It's how 3D rendering looks. It's sharper, with more ringing.

Second is 2D pixel art, Command & Conquer intentionally running at the wrong aspect ratio at 1024x768. Lanczos and bilinear. Probably the largest difference.

Third is Command & Conquer already pixel doubled (640x400>1280x800) and scaled to the right aspect ratio. Lanczos and bilinear the smallest difference, since the scaler doesn't have that much room to work with.

Reply 11 of 32, by Drifter82

User metadata
Rank Newbie
Rank
Newbie

Baldurs Gate pinched from Lefreut

There's a substantial increase in clarity without loss of detail, evidenced by the rooftop, bricks etc. It's best to open in tabs to compare.

Bilinear

45a3bgnl7ecg.png

Camull-Rom spline

fhdxyfyrzy7z.png

Reply 12 of 32, by Dege

User metadata
Rank l33t
Rank
l33t

Thanks for the feedback!

I had some little spare time and couldn't stand not to try out implementing some resampling filters (I should have worked on other things).
I added bicubic, lanczos-2 and lanczos-3.

A comparison for Siege of Avalon (unforced resolution (640x480 or such), image scaled up to 1440p):

Bilinear
sa-bilinear.png
Bicubic
sa-bicubic.png
Lanczos-2
sa-lanczos2.png
Lanczos-3
sa-lanczos3.png

Yes, the best way to compare them is open each in different browser tabs and switching between them.

Edit: another for TA Kingdoms demo menu screen:

Bilinear
tak-bilinear.png
Bicubic
tak-bicubic.png
Lanczos-2
tak-lanczos2.png
Lanczos-3
tak-lanczos3.png

For this one, lanczos-2 or bicubic seems to be the best. Lanczos-3 causes visible halo around the white text, but the image sharpness is a bit better than that of the others.

Reply 13 of 32, by Drifter82

User metadata
Rank Newbie
Rank
Newbie

🤣, that looks fantastic, I can't believe you implemented it so quick.

No one else has done this for a wrapper, but it's just such a fundamental improvement in fidelity isn't it?

Such a boon for anyone going to back to play all these great old 90's era 2d games.

I hope more people take an interest in this once they realise you've implemented it. I think a lot of people just aren't aware of the improvement it brings.

Reply 14 of 32, by ZellSF

User metadata
Rank l33t
Rank
l33t
Dege wrote:

Thanks for the feedback!

I had some little spare time and couldn't stand not to try out implementing some resampling filters (I should have worked on other things).
I added bicubic, lanczos-2 and lanczos-3.

That's great news, especially for non 1440p users (who don't have the luxury of integer scaling 480p).

Drifter82 wrote:

I hope more people take an interest in this once they realise you've implemented it. I think a lot of people just aren't aware of the improvement it brings.

No, a lot of people don't care about image quality, you have to set it up and the benefit of this is very situational and up to personal preference.

It's a nice improvement to image quality sure, but I wouldn't expect a lot of people to use it.

Reply 16 of 32, by ZellSF

User metadata
Rank l33t
Rank
l33t
Drifter82 wrote:

Of course they will use it, it looks better. If it's exposed in the UI they'll click on it and like it.

Why so sure about that? I've seen plenty of Youtube videos indicating that people in fact are not clicking the "make things look good" buttons. Some do, but the majority don't.

I was writing on GOG forums how to get best image quality for Dark Reign 2, and the first two hits for that game on Youtube are of the game running at the wrong aspect ratio and with a too large interface size. Both could've been solved by going to the game's settings and selecting a larger 16:9 resolution.

The advice I gave on GOG forums for running Dark Reign 2 was a bit on the complicated side, since it relied on downsampling and post-processing anti-aliasing, which is a bit complicated since dgVoodoo can't do post-processing anti-aliasing and while it can do downsampling, it can't in this specific instance since then it can't forward a native resolution image to drivers/reshade for post-process anti-aliasing.

So, on the subject, of small image quality differences most people don't care about: Dege, have you considered implementing SMAA yet?
http://www.iryoku.com/smaa/
https://github.com/iryoku/smaa
https://github.com/iryoku/smaa/blob/master/LICENSE.txt
That way dgVoodoo can do some anti-aliasing on titles that don't support MSAA, while still supporting all image scaling features (aspect ratio correction, downsampling, integer scaling) without being reliant on drivers handling all those things correctly.

Reply 17 of 32, by ZellSF

User metadata
Rank l33t
Rank
l33t

Also more on scaling, but the other way. I thought downscaling worked properly in dgVoodoo, but I guess not? Unless I'm doing something wrong but I can't think of what that would be.

Here's dgVoodoo scaling from 3840x2160 to 1920x1080:

dgvoodoodownsampling.jpg
Filename
dgvoodoodownsampling.jpg
File size
228.12 KiB
Views
2527 views
File license
Fair use/fair dealing exception

Here's how most scalers would scale from 3840x2160 to 1920x1080 (this case it's Irfanview's downscaling, but all the other methods I tried gives similar results):

downsampling.jpg
Filename
downsampling.jpg
File size
220.2 KiB
Views
2527 views
File license
Fair use/fair dealing exception

What's going wrong here? There's obviously a lot of aliasing in dgVoodoo's downscaling, plus the font problems.

Have anyone successfully used dgVoodoo for SSAA?

Reply 18 of 32, by Dege

User metadata
Rank l33t
Rank
l33t
ZellSF wrote:

So, on the subject, of small image quality differences most people don't care about: Dege, have you considered implementing SMAA yet?

Ok, bicubic and Lanczos doesn't make wonders, it's true. However when I ran those games upscaled by them, I had the feeling I'm seeing a sharper image.

As for SMAA: not yet… The problem is I'd have to understand the math behind before implementing it (I did that with Lanczos and bicubic resampling).
Or, the other way is just blindly copy-pasting an existing implementation, but I hate that.

ZellSF wrote:

Also more on scaling, but the other way. I thought downscaling worked properly in dgVoodoo, but I guess not? Unless I'm doing something wrong but I can't think of what that would be.Here's dgVoodoo scaling from 3840x2160 to 1920x1080:

Is 3840x2160 a DSR? I tried it in the traditional way (forcing 2x resolution of my native one then let it get downscaled but it worked as expected).

Reply 19 of 32, by ZellSF

User metadata
Rank l33t
Rank
l33t
Dege wrote:
ZellSF wrote:

Also more on scaling, but the other way. I thought downscaling worked properly in dgVoodoo, but I guess not? Unless I'm doing something wrong but I can't think of what that would be.Here's dgVoodoo scaling from 3840x2160 to 1920x1080:

Is 3840x2160 a DSR? I tried it in the traditional way (forcing 2x resolution of my native one then let it get downscaled but it worked as expected).

I'm using the "Stretched, keep Aspect Ratio" option, where dgVoodoo's downscaling shouldn't be aware of, or care about what sort of resolution 3840x2160 is. Desktop resolution is set to 1920x1080.

I'm playing Dark Reign 2 with its native resolution set to 1920x1080 and dgVoodoo's resolution setting set to "2x" (which would be 3840x2160).

Edit: also if you want to test and reproduce this exactly (testing with a lower resolution should yield similar results though) you need to edit dr2.exe, search for:

80 02 00 00 0F 82 D9 00 00 00 81 7D FC E0 01 00 00 0F 82 CC 00 00 00 81 7D 08 6C 07 00 00 0F 87 BF 00 00 00 81 7D FC 6C 07

Those are the resolutions limit Dark Reign 2 has set by default, lowest resolution is 640x480 (8002 E001), highest is 1900x1900 (6C07). Dark Reign 2 will also only the 22 lowest modes it finds in that range.

Edit 2: dgVoodoo with 3x resolution force:

3x.jpg
Filename
3x.jpg
File size
492.48 KiB
Views
2468 views
File license
Fair use/fair dealing exception

dgVoodoo with 4x resolution force:

4x.jpg
Filename
4x.jpg
File size
447.92 KiB
Views
2468 views
File license
Fair use/fair dealing exception

3x resolution force looks correct while 2x and 4x are all sorts of wrong.

I've also turned off DSR and made sure that none of the 2x/3x/4x resolutions are supported by my GPU drivers; dgVoodoo is handling the downscaling.