Better filtering?

NOTICE: This forum is archived as read only.
Please use the Github Discussions at https://github.com/exult/exult/discussions
Forum rules
NOTICE: This forum is archived as read only.
Please use the Github Discussions at https://github.com/exult/exult/discussions
Locked
Thirith Dragon

Better filtering?

Post by Thirith Dragon »

How likely is it that better filtering options are going to be put in Exult? I just saw some of the examples of the HQ3X and HQ4X filters (http://www.hiend3d.com/hq3x.html), and they look very good to me.
drcode
Site Admin
Posts: 2267
Joined: Thu May 14, 2020 1:34 pm

Re: Better filtering?

Post by drcode »

This has come up before: http://exult.info/forum/viewtopic.php?p=16271#p16271

Seems like there's an issue with speed, which might not matter with modern CPU's; plus Exult's scaling system will need to be modified.
Thirith Dragon

Re: Better filtering?

Post by Thirith Dragon »

Thanks for that link. However, since the last sign of life was in 2003, I'm not holding my breath. Does anyone here know whether the Exult team (or what's left of it) is still planning to implement this or other options?

P.S.: Please don't think that I'm ungrateful for what's already there. Exult is a gift to us Ultima fans. Having it improved even more would still be nice. :-)
drcode
Site Admin
Posts: 2267
Joined: Thu May 14, 2020 1:34 pm

Re: Better filtering?

Post by drcode »

I've started looking at the filtering code. I'd like to implement the 3x filter in Exult, but don't want to promise anything, since it might be too slow.

Also, seems like I have a lot more fun real-life activities to distract me, along with some not-so-fun activities (like filing taxes:-( ).
drcode
Site Admin
Posts: 2267
Joined: Thu May 14, 2020 1:34 pm

Re: Better filtering?

Post by drcode »

Thought I'd start with Hq2x. You can try it out in the latest snapshot (might have to wait for tomorrow's). Performance seems fine. I think it looks good, but probably just a little better than the other filters.

Hq3x will be next.

(Developer's note: The trick they did of interpolating colors by adding the 32-bit values is really clever; but I wish they'd mentioned that the reason it works is each color's value (0-255) always has it's 2 low bits cleared.)
Gruck

Re: Better filtering?

Post by Gruck »

By the way, Hq2x looks really good! I can't wait to see more.
Skutarth
Posts: 71
Joined: Thu May 14, 2020 1:34 pm

Re: Better filtering?

Post by Skutarth »

I didn't know that Hq2x/Hq2x would look good on anything other than NES games. Very nice.
Colourless
Site Admin
Posts: 731
Joined: Thu May 14, 2020 1:34 pm

Re: Better filtering?

Post by Colourless »

I tried Hq2x in Pentagram and the results were very disappointing. For the most part it was good, but it really really broke badly when doing the fine cross faded palette adjustments when you were under the effects of shrooms. There was really bad temporal artefacting. Even when standing still the lines around the screen would change and pixels would change colour depending on how far the palette transition had progressed. Hq2x and friends work using YUV and shroom mode in Ultima8 really screws around with what happens to Y and U the comonents.
Skutarth
Posts: 71
Joined: Thu May 14, 2020 1:34 pm

Re: Better filtering?

Post by Skutarth »

Er, Hq2x/Hq3x. You know what I meant.
The filter works wonders for reading signs in Exult. Beautiful!
TdI

Re: Better filtering?

Post by TdI »

I don't see a big difference with the signs, but the usual text fonts and numbers look alot sharper now and are easier to read.
SB-X
Posts: 980
Joined: Thu May 14, 2020 1:34 pm

Re: Better filtering?

Post by SB-X »

Any screenshots for lazy people?
Skutarth
Posts: 71
Joined: Thu May 14, 2020 1:34 pm

Re: Better filtering?

Post by Skutarth »

Here's a comparison:
Image
Dominus
Site Admin
Posts: 5656
Joined: Thu May 14, 2020 1:34 pm

Re: Better filtering?

Post by Dominus »

hmm, looks both nice and not :)
On the one hand I like a lot how it looks, but when I look closer white pixels are too white in comparison... Oh well, got to try to actual play it with that filter :)
--
Read the documentation and the FAQ! There is no excuse for not reading them! RTFM
Read the Rules!
We do not support Piracy/Abandonware/Warez!
Colourless
Site Admin
Posts: 731
Joined: Thu May 14, 2020 1:34 pm

Re: Better filtering?

Post by Colourless »

Hmm.. the reason why the white pixels are too visable is because the rest of the roof is too dark. Gamma correct filtering would probably fix that problem.
SB-X
Posts: 980
Joined: Thu May 14, 2020 1:34 pm

Re: Better filtering?

Post by SB-X »

Thanks.
drcode
Site Admin
Posts: 2267
Joined: Thu May 14, 2020 1:34 pm

Re: Better filtering?

Post by drcode »

Hq3x is in there now. Looks nice, but it's definitely stressing my CPU. I may fiddle a bit with optimizing it.
Skutarth
Posts: 71
Joined: Thu May 14, 2020 1:34 pm

Re: Better filtering?

Post by Skutarth »

Looks great!
It also runs fine for me, but my specs are reasonably high, so I can't give any input on performance.
TdI

Re: Better filtering?

Post by TdI »

Looks as if someone had ran U7 though a Photoshop filter. I think "oil paint" is the one I'm thinking of.

But that can be misunderstood. I think U7 now looks better than ever.

My system runs on a humble AMD Sempron 2600+ 1.86GHz processor.
Hq2x makes Exult take about 30-50% CPU cycles while just standing around Trinsic right after the intro. Switching to Hq3x hardly makes any noticable difference. Maybe +5%.

Running around Trinsic takes 60-70% CPU. All in all, looks good, runs fine for me.

Nice work DrCode
SB-X
Posts: 980
Joined: Thu May 14, 2020 1:34 pm

Re: Better filtering?

Post by SB-X »

SuperEagle looks a little more like an oil painting. Hq2x works fine on my Athlon 3000+ (2.1GHz), but Hq3x slows the game down considerably. (in SI) There is a bug where the mouse stops working when resolution is set to 320x200 scaled with Hq3x in fullscreen mode.
marzo
Site Admin
Posts: 1925
Joined: Thu May 14, 2020 1:34 pm

Re: Better filtering?

Post by marzo »

Here are the results in my laptop (Pentium IV 2.2GHz, 1GB Ram, crappy on-board video card):
- Super2xSAI: averages around 7% CPU time when idle, can go up to ~37% when walking quickly in a place with lots of buildings (e.g., Fawn, Britannia).
- Hq2x: in the same situations, the numbers are 14% and 77% (up to 84% with NPCs walking around).
- Hq3x: 20% idle, 90% when walking quickly across Fawn (up to 96% with lots of NPCs).

Given the choice, I think I'll prefer Hq2x any time over Super2zSAI, and I will likely use Hq3x. I will only have to change the Exult menu to not use Hq3x, as it will end up being larger than the screen...
------
Marzo Sette Torres Junior
aka Geometrodynamic Dragon
[url=http://www.catb.org/~esr/faqs/smart-questions.html]How To Ask Questions The Smart Way[/url]
drcode
Site Admin
Posts: 2267
Joined: Thu May 14, 2020 1:34 pm

Re: Better filtering?

Post by drcode »

I'm getting similar results with a 2.8Ghz Athlon from a few years ago. This is compiled for debugging, so it's possible that turning on higher compiler optimization could improve this a bit.

I can also see one or two ways the algorithm could be improved, but haven't had time to play with it yet.
drcode
Site Admin
Posts: 2267
Joined: Thu May 14, 2020 1:34 pm

Re: Better filtering?

Post by drcode »

Last night, I recompiled the scalers with -O3 enabled. I took around 5 minutes! But I think it helped, because walking around with hq3x seemed a lot smoother, and CPU usage stayed around 65%.

I'm guessing that the Windows version of Exult is already compiled with decent optimization turned on.
Andrea B Previtera

Re: Better filtering?

Post by Andrea B Previtera »

Marzo:

> - Hq3x: 20% idle, 90% when walking quickly across Fawn (up to 96%
> wiith lots of NPCs).

Since you specify this... I suppose the filter is applied to each graphic element prior their offscreen drawing? I always thought such filtering algorithms were meant to be applied to the whole screen..
Skutarth
Posts: 71
Joined: Thu May 14, 2020 1:34 pm

Re: Better filtering?

Post by Skutarth »

In this case, it would be a bad idea to use it as a post-processing filter. Since the palette of Ultima 7 is so limited, and since there are a lot of black outlines, you would get unwanted assumed shapes from the filter when shapes overlap.
It's implemented properly as-is. Sure, it would run faster if applied afterward, but it wouldn't look right.
SB-X
Posts: 980
Joined: Thu May 14, 2020 1:34 pm

Re: Better filtering?

Post by SB-X »

I don't think he was suggesting the way the filter is implemented should be changed. :-)
I thought it was applied to the whole screen too, and had some kind of optimization which caused it to run faster when not much is happening on-screen, but that's because I have no idea how it works. I thought applying a scaler to individual shapes would cause image artifacts when drawn to the screen.
marzo
Site Admin
Posts: 1925
Joined: Thu May 14, 2020 1:34 pm

Re: Better filtering?

Post by marzo »

SB-X is correct, it *is* applied for the whole screen. I also forgot to mention that this was in windowed mode; the processor usage would probably be a lot lower if I used full screen. My intent in showing the effects of moving in a place with lots of things is that, while Hq2x and Hq3x had an effect on average CPU use, other aspects of Exult tend to use a lot more CPU cycles. I shouls have been more clear about that.
------
Marzo Sette Torres Junior
aka Geometrodynamic Dragon
[url=http://www.catb.org/~esr/faqs/smart-questions.html]How To Ask Questions The Smart Way[/url]
Andrea B Previtera

Re: Better filtering?

Post by Andrea B Previtera »

Aah, I get it now :) Right right right. I haven't fiddled with the sources since version 0.9X or so, so I wonder [just a slight OT diversion] - what parts of the engine are currently running in separate threads? Or is it everything still single-threaded?
drcode
Site Admin
Posts: 2267
Joined: Thu May 14, 2020 1:34 pm

Re: Better filtering?

Post by drcode »

As far as I know, it's all in one thread except for the audio, which SDL handles in a separate thread.
paulo

Re: Better filtering?

Post by paulo »

Dosbox uses an architecture thats aplies filters only when the screen updates (and various other tricks i belive), and that makes HQ2 tolerable. Just saying.
drcode
Site Admin
Posts: 2267
Joined: Thu May 14, 2020 1:34 pm

Re: Better filtering?

Post by drcode »

I believe that's how Exult works too. But U7's palette rotation means that updates are happening all the time.
Locked