Accelerated 2D upscaling for old 2D games.

General information and assistance with dgVoodoo.

Accelerated 2D upscaling for old 2D games.

Postby eierfrucht » 2019-2-08 @ 00:01

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...
eierfrucht
Newbie
 
Posts: 4
Joined: 2019-2-07 @ 23:37

Re: Accelerated 2D upscaling for old 2D games.

Postby ZellSF » 2019-2-08 @ 08:14

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.
ZellSF
Oldbie
 
Posts: 1528
Joined: 2006-1-01 @ 18:19

Re: Accelerated 2D upscaling for old 2D games.

Postby eierfrucht » 2019-2-08 @ 12:40

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.
eierfrucht
Newbie
 
Posts: 4
Joined: 2019-2-07 @ 23:37

Re: Accelerated 2D upscaling for old 2D games.

Postby ZellSF » 2019-2-09 @ 13:05

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

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.
ZellSF
Oldbie
 
Posts: 1528
Joined: 2006-1-01 @ 18:19

Re: Accelerated 2D upscaling for old 2D games.

Postby Dege » 2019-2-10 @ 13:24

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?
Dege
Oldbie
 
Posts: 1585
Joined: 2003-9-04 @ 11:06

Re: Accelerated 2D upscaling for old 2D games.

Postby ZellSF » 2019-2-10 @ 14:43

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.
ZellSF
Oldbie
 
Posts: 1528
Joined: 2006-1-01 @ 18:19

Re: Accelerated 2D upscaling for old 2D games.

Postby eierfrucht » 2019-4-16 @ 01:18

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:

Image

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

Image

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:

Image

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...
eierfrucht
Newbie
 
Posts: 4
Joined: 2019-2-07 @ 23:37

Re: Accelerated 2D upscaling for old 2D games.

Postby eierfrucht » 2019-4-16 @ 02:05

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:

Image

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

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

Image
eierfrucht
Newbie
 
Posts: 4
Joined: 2019-2-07 @ 23:37

Re: Accelerated 2D upscaling for old 2D games.

Postby Drifter82 » 2019-12-02 @ 14:10

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.
Drifter82
Newbie
 
Posts: 4
Joined: 2019-12-02 @ 14:03

Re: Accelerated 2D upscaling for old 2D games.

Postby Dege » 2019-12-02 @ 17:38

Ok, I'll see. Could anyone plz post a comparison for a bilinear, bicubic and Lánczos filtered image to see the difference (if it's worth to implement)?
Dege
Oldbie
 
Posts: 1585
Joined: 2003-9-04 @ 11:06

Re: Accelerated 2D upscaling for old 2D games.

Postby ZellSF » 2019-12-03 @ 17:03

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.
ZellSF
Oldbie
 
Posts: 1528
Joined: 2006-1-01 @ 18:19

Re: Accelerated 2D upscaling for old 2D games.

Postby Drifter82 » 2019-12-04 @ 15:30

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

Image

Camull-Rom spline

Image
Drifter82
Newbie
 
Posts: 4
Joined: 2019-12-02 @ 14:03

Re: Accelerated 2D upscaling for old 2D games.

Postby Dege » 2019-12-08 @ 21:09

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
Image
Bicubic
Image
Lanczos-2
Image
Lanczos-3
Image

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
Image
Bicubic
Image
Lanczos-2
Image
Lanczos-3
Image

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.
Dege
Oldbie
 
Posts: 1585
Joined: 2003-9-04 @ 11:06

Re: Accelerated 2D upscaling for old 2D games.

Postby Drifter82 » 2019-12-08 @ 23:50

lol, 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.
Drifter82
Newbie
 
Posts: 4
Joined: 2019-12-02 @ 14:03

Re: Accelerated 2D upscaling for old 2D games.

Postby ZellSF » 2019-12-09 @ 17:52

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.
ZellSF
Oldbie
 
Posts: 1528
Joined: 2006-1-01 @ 18:19

Re: Accelerated 2D upscaling for old 2D games.

Postby Drifter82 » 2019-12-11 @ 03:36

Of course they will use it, it looks better. If it's exposed in the UI they'll click on it and like it.
Drifter82
Newbie
 
Posts: 4
Joined: 2019-12-02 @ 14:03

Re: Accelerated 2D upscaling for old 2D games.

Postby ZellSF » 2019-12-12 @ 12:22

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.
ZellSF
Oldbie
 
Posts: 1528
Joined: 2006-1-01 @ 18:19


Return to dgVoodoo General

Who is online

Users browsing this forum: No registered users and 1 guest