*sad update* ESRGAN AI Upscaling (ScummVM fork and tools pulled from github by author)

All the inane chatter goes in here. If you're curious about whether we will support a game, post HERE not in General Discussion :)

Moderator: ScummVM Team

Post Reply
User avatar
MusicallyInspired
Posts: 1138
Joined: Fri Mar 02, 2007 8:03 am
Location: Manitoba, Canada
Contact:

*sad update* ESRGAN AI Upscaling (ScummVM fork and tools pulled from github by author)

Post by MusicallyInspired »

2024 Update: Myles Johnston has pulled his ScummVM-X/ScummVM-Ext/ScummVM-MiL0/ScummVM-Next fork and his tools from public availability. When he heard Microsoft was buying ActiVision he decided to take everything down and send Microsoft an email asking them permission to continue what he was doing. I tried to talk him out of it but he was adamant. Therefore, sadly, they are no longer available.

*************************

EDIT: Updates as of February 2021: An individual named Myles Johnston has created a fork of ScummVM he calls ScummVMx which (currently for SCI games only) allows replacing art assets at 4x the resolution (usually the resolution of ESRGAN upscaling models) for Pictures (visual and priority), Views, and Fonts with full alpha channel transparency (except priority screens which must be 1-bit alpha). It can also as of just recently allow replacement WAV files for MIDI sounds/songs. This works for SCI0 games (EGA) all the way up to SCI1.1 (most of them anyway). It does not yet support SCI32. However, support is planned for SCI32 and for AGI. And who knows? Maybe more. Aspect Ratio Correction is not possible, however, you can hack it by setting ScummVM's global graphics settings to OpenGL and setting the Stretch Mode to "Fit to window (4:3)". This squishes the image horizontally however instead of stretching vertically so the width becomes less than the width of the assets which is a bit of resolution reduction instead of expansion. This also means that replacement art assets must also not be aspect ratio-corrected. Hopefully this can be fixed. Cursors are not yet replaceable (black and white cursors from SCI0-SCI10, that is. SCI11 cursors are just Views so they will upscale fine).

Here are links to his fork, his tool Arcada Accordion (which aids in upscaling priority layers and then flattening them), his fork of SCI Companion (named SCI Companion-X) which allows mass-exporting game assets one cel at a time (for Views) and one priority layer at a time (for Pictures) for upscaling. It also exports Fonts on character at a time. Anyway, here are the links:

ScummVMx (instructions for replacement assets included in a readme txt file)
SCI Companion X
Arcada Accordion

Video Tutorial:
Part 1
Part 2
Part 3

Myles Johnston's YT channel (with a few video examples of ScummVMx in action with replacement assets)

Enjoy! Great things are on the horizon!

ORIGINAL POST:

Some might be familiar with this already (Laserschwert?), but I'm just discovering it and boooooy is it fantastic. These are the results of upscaling and nothing more with ESRGAN using a Manga109 dataset-trained model. There are all kinds of models you can use, but this one was the most impressive. It renders 320x200 images beautifully as 4x 1280x800(/960) and almost looks like it could be the original art. In my opinion it, for the most part, puts the Special Editions and Remasters (especially Full Throttle) to shame. It's not perfect but some screens look phenomenal and almost flawless. Check these out:

https://i.imgur.com/kOBMKSqm.png
https://i.imgur.com/g5M7gBvl.jpg
LucasArts' Special Edition version:
https://i.imgur.com/UwXoCtSl.jpg
https://i.imgur.com/NWJx5GMm.png
https://i.imgur.com/y4BM3x4l.jpg
LucasArts' Special Edition version:
https://i.imgur.com/rwtEva5l.jpg
Peter Chan's original artwork:
https://i.imgur.com/hiEFWXPl.jpg

https://2.bp.blogspot.com/-4dJJ57zJht0/ ... 600/19.jpg
https://i.imgur.com/L99lR1Pl.png
Double Fine's Remastered version:
https://i.imgur.com/Iq7avMql.png

Grim Fandango:
https://abload.de/img/animatedkopie23y1c1t.gif
https://abload.de/img/animatedkopie13qyd4e.gif

Here's some Sierra backgrounds (click for larger images):

https://i.imgur.com/NVgEB3Fm.png
https://i.imgur.com/OHILdhUm.png

https://i.imgur.com/oSnv1gNm.png
https://i.imgur.com/pvtRWefm.png

https://i.imgur.com/emwYEbPm.png
https://i.imgur.com/VyZ9omjm.png

These three were hi-res scans of the original artwork taken from the KQ6 CD-ROM bonus files and were originally 512x356, rendered up to 2048x1460!:
https://i.imgur.com/nLptIwqm.png
https://i.imgur.com/I2i59jrm.jpg
https://i.imgur.com/0OLSqnYm.png

Here's tons more Sierra images
Even more from Sierra, LucasArts, and other games
Thread I discovered this from - Has many examples people have made from Grim Fandango to Final Fantasy VII to Metroid Prime to Hexen....

It runs in Python. Here are some links to set it up yourself. It takes several seconds to generate an image with a high-end GPU, so real-time filtering in ScummVM or DOSBox is many years away I'm sure ;). But hey, perhaps ScummVM can in the future create some infrastructure for the patching in of hi-res HD packs for game art resources? *shrug*

Helpful links:
Getting Started
Further instructions + Manga109 Dataset Model
ESRGAN Github
Last edited by MusicallyInspired on Mon May 27, 2024 10:31 pm, edited 7 times in total.
User avatar
Laserschwert
Posts: 280
Joined: Mon Mar 06, 2006 11:48 pm

Re: ESRGAN: AI Neural Net Upscaling

Post by Laserschwert »

Well, I know about AI-supported upscaling (though it wasn't a thing yet when I was still working on my posters), but this is a whole new level. Just found out about this and saw your tweet. Boy, this looks great! The first thing that came to my mind was CMI. I mean, we already have the uncompressed music, now we could in theory upscale all the backgrounds? Could CMI:SE finally be achieved, maybe even by the fan community?

I have no idea in how far ScummVM might be capable of swapping out assets of the supported games, no less with assets at higher resolutions.

And putting your Grim Fandango upscales into the remaster? Even EFMI's backgrounds scale up surprisingly well.
User avatar
MusicallyInspired
Posts: 1138
Joined: Fri Mar 02, 2007 8:03 am
Location: Manitoba, Canada
Contact:

Re: ESRGAN: AI Neural Net Upscaling

Post by MusicallyInspired »

Here's some examples for CMI that I found in that thread.
The only problem with this someone noticed is that the Manga109 dataset was made from JPEG scans of manga so the AI is effectively trained to create JPEG artifacts. But even so, the possibilities....

Image
Image
Image
Image
Image
Image

This one was made with an anime-trained model:
Image
User avatar
Laserschwert
Posts: 280
Joined: Mon Mar 06, 2006 11:48 pm

Re: ESRGAN: AI Neural Net Upscaling

Post by Laserschwert »

Yeah, I saw those as well... incredible stuff.

So, how exactly can you train the algorithm? Could we feed it with all the original MI2 paintings and the resulting VGA backgrounds and off you go?
User avatar
MusicallyInspired
Posts: 1138
Joined: Fri Mar 02, 2007 8:03 am
Location: Manitoba, Canada
Contact:

Re: ESRGAN: AI Neural Net Upscaling

Post by MusicallyInspired »

I haven't tried testing out training yet, but something like that from what I understand. Though, there are differences in lighting and contrast between the art sources and the game backgrounds. It would probably brighten up everything it touched.

I'm going to try to experiment later today. Do we have a repository of all the MI2 art sources by Peter Chan?
User avatar
Laserschwert
Posts: 280
Joined: Mon Mar 06, 2006 11:48 pm

Re: ESRGAN: AI Neural Net Upscaling

Post by Laserschwert »

I think Mojo has them all in their gallery, unfortuantely they are down right now.

Until then: https://imgur.com/gallery/GG7oE
Last edited by Laserschwert on Thu Jan 10, 2019 5:18 pm, edited 2 times in total.
User avatar
MusicallyInspired
Posts: 1138
Joined: Fri Mar 02, 2007 8:03 am
Location: Manitoba, Canada
Contact:

Re: ESRGAN: AI Neural Net Upscaling

Post by MusicallyInspired »

Thanks!

I took most of yesterday and wrote a script that extracts background resources from a Sierra game, converts to PNG, and upscales with ESRGAN. I'm doing all the Sierra games and uploading them to a Google Drive folder. I'll upload more as time goes on: https://drive.google.com/drive/folders/ ... sp=sharing

For PQ4 (and some screens in PQ3) I'm going to try a different model that's more accustomed and trained to restore low resolution live photos. It's coming out more like a painting, and while that's cool, I think it can do these better.

For QFG4, all the backgrounds are in pieces with foreground objects as different picture resources entirely so I'm going to take more time with that one and stitch them all together before upscaling.
User avatar
Laserschwert
Posts: 280
Joined: Mon Mar 06, 2006 11:48 pm

Re: ESRGAN: AI Neural Net Upscaling

Post by Laserschwert »

Is there any usable tool for removing color dithering? I know ReShade has filters for that, but I'm having quite some trouble using ReShade with ScummVM, plus I'd rather use it on the raw extracted backgrounds. I think dithering is one of the things that still trips the algorithms up, so getting rid of it beforehand would certainly help.
User avatar
MusicallyInspired
Posts: 1138
Joined: Fri Mar 02, 2007 8:03 am
Location: Manitoba, Canada
Contact:

Re: ESRGAN: AI Neural Net Upscaling

Post by MusicallyInspired »

Indeed. Perhaps we could train a model to transform dithering into smooth shading somehow. there's got to be some kind of algorithm out there that transforms dithering into fine gradients...
User avatar
MusicallyInspired
Posts: 1138
Joined: Fri Mar 02, 2007 8:03 am
Location: Manitoba, Canada
Contact:

Re: ESRGAN: AI Neural Net Upscaling

Post by MusicallyInspired »

This guy trained his own model to upscale Riven screens. He used images of grass, dirt, rocks, trees, water, etc and added dithering similar to Riven's. The result handles the dithering quite nicely (at the slight expense of finer details, he noted), but man is the result gorgeous!

Riven Upscale Album

Image
Mim
Posts: 85
Joined: Sun Dec 11, 2005 4:59 pm

Re: ESRGAN: AI Neural Net Upscaling

Post by Mim »

MusicallyInspired wrote: Wed Jan 09, 2019 9:19 pm It takes several seconds to generate an image with a high-end GPU, so real-time filtering in ScummVM or DOSBox is many years away I'm sure ;)
User prarts writes in this thread : Really low res pictures (VGA - like DOS SCUMM games) takes less then 1 second, it`s almost instant - that`s way I was thinking of implementing this in ScummVM "on the fly".

So maybe there is a hope for faster implementation? BTW: Lots of interesting pictures in that thread.
MusicallyInspired wrote: Wed Jan 09, 2019 9:19 pm But hey, perhaps ScummVM can in the future create some infrastructure for the patching in of hi-res HD packs for game art resources?
That would be great.
User avatar
MusicallyInspired
Posts: 1138
Joined: Fri Mar 02, 2007 8:03 am
Location: Manitoba, Canada
Contact:

Re: ESRGAN: AI Neural Net Upscaling

Post by MusicallyInspired »

Mim wrote: Mon Jan 21, 2019 10:30 am
MusicallyInspired wrote: Wed Jan 09, 2019 9:19 pm It takes several seconds to generate an image with a high-end GPU, so real-time filtering in ScummVM or DOSBox is many years away I'm sure ;)
User prarts writes in this thread : Really low res pictures (VGA - like DOS SCUMM games) takes less then 1 second, it`s almost instant - that`s way I was thinking of implementing this in ScummVM "on the fly".

So maybe there is a hope for faster implementation? BTW: Lots of interesting pictures in that thread.
Less than one second is not necessarily fast enough. We need 60 in one second. 30 for barely passable framerate and it would necessitate a really high-end bleeding-edge graphics card to do it continuously for a whole game sitting. It takes me 1-3 seconds to do a 320x200 image with my 970.
Bluddy
ScummVM Developer
Posts: 145
Joined: Sun Nov 18, 2007 8:43 am

Re: ESRGAN: AI Neural Net Upscaling

Post by Bluddy »

This is a big development in the machine learning world and it's great that it can be used for such practical stuff. These results are truly phenomenal.

Let's figure out a way to integrate pre-made images into ScummVM instead of the ones in the data files, rather than trying to do this on the fly, which requires interfacing with a neural net library etc.
Ze_PilOt
Posts: 2
Joined: Mon Jan 28, 2019 7:44 am

Re: ESRGAN: AI Neural Net Upscaling

Post by Ze_PilOt »

Bluddy wrote: Wed Jan 30, 2019 5:23 pm This is a big development in the machine learning world and it's great that it can be used for such practical stuff. These results are truly phenomenal.

Let's figure out a way to integrate pre-made images into ScummVM instead of the ones in the data files, rather than trying to do this on the fly, which requires interfacing with a neural net library etc.
Indeed. One "easy" way to achieve would be for ScummVM to dump a "cache" folder with all the decoded images (sprites / backgrounds / depth / masks / ....) and load from there (while supporting a different image resolution).

No idea if if it's a difficult job (I don't know ScummVM well enough), but I think it's doable, at least for the PC port.
User avatar
Raziel
ScummVM Porter
Posts: 1532
Joined: Tue Oct 25, 2005 8:27 am
Location: a dying planet
Contact:

Re: ESRGAN: AI Neural Net Upscaling

Post by Raziel »

Ze_PilOt wrote: Wed Jan 30, 2019 6:53 pm
Bluddy wrote: Wed Jan 30, 2019 5:23 pm This is a big development in the machine learning world and it's great that it can be used for such practical stuff. These results are truly phenomenal.

Let's figure out a way to integrate pre-made images into ScummVM instead of the ones in the data files, rather than trying to do this on the fly, which requires interfacing with a neural net library etc.
Indeed. One "easy" way to achieve would be for ScummVM to dump a "cache" folder with all the decoded images (sprites / backgrounds / depth / masks / ....) and load from there (while supporting a different image resolution).

No idea if if it's a difficult job (I don't know ScummVM well enough), but I think it's doable, at least for the PC port.
Thinking one step further by dropping the local cache and instead using cloud space to "cache" the data, so that, at one point, every image of every supported game has been uploaded and/or upscaled for anyone (with internet) to use...

That is, of course, depending on the size of said images and speed of the connection and IP problems (Hell, not a good idea then:-/)
Post Reply