[MOD] Pure Vanilla Extract - Help Wanted!

A curated forum for approved mods. Users are unable to create new topics in this forum but can reply to existing topics. Please message a moderator to have your mod moved into this forum area.
Post Reply
User avatar
MasonFace
Posts: 355
Joined: Tue Nov 27, 2018 7:28 pm
Contact:

Re: [MOD] Pure Vanilla Extract - Help Wanted!

Post by MasonFace » Mon Oct 14, 2019 1:56 pm

King of Worms wrote:
Wed Oct 09, 2019 9:30 pm
MasonFace wrote:
Wed Oct 09, 2019 6:19 pm
Thanks my dude! I'll probably incorporate them into PVE!
Sure, Im still completely burdened with the bugs and issues around paperdoll and funny stuff like that.
I remember you wanted some other parts of DREAM, which were they?
Life has been really busy for me lately, so I haven't had much time to devote to DFU mod stuff. From what I recall, I think it was UI and videos. There may have been other things, but it can wait since I don't have time to really implement any of this into PVE for a while.

MrFlibble
Posts: 141
Joined: Sat Jan 27, 2018 10:43 am

Re: [MOD] Pure Vanilla Extract - Help Wanted!

Post by MrFlibble » Mon Oct 14, 2019 2:25 pm

MasonFace wrote:
Mon Oct 14, 2019 1:47 pm
And since the character flats are mostly single frames, it would be reasonably simple to process them as batched sprite sheets like you generally do.
I'll try to get something done but for now not sure about the timing yet.

In the meantime I realised that my previous method of extracting the sprites from background is somewhat faulty, especially noticeable with the Fatality/Rebout/Lady interpolation because it blurs more than the other models, resulting in the sprite edges getting contaminated with the background colour. The flats are very colourful so it's tough to find a background that would be completely neutral to the colours used in the actual images except black or white.

So I came up with what seems like a better method, however it's also much more time consuming.

1. The idea is to make one upscale against black background and another against pink background with the grayscale version of the sprites, to be used as a mask:
Image Image Image
The third image is the original sprites against pink background, we'll also need it later (duh).

For ease of reference, let's call these source images S1, S2 and S3. Use mtPaint to convert each to indexed palette (exact match).

2. Then I apply xBRZ softening (scale up 4x w/xBRZ Scaler Test, then back down to original res w/ Bicubic in GIMP) to S1 and S2 and process them with ESRGAN with Fatality/Rebout/Lady model.

3. With the S2 upscale, apply Kuwahara Nagao blur at 2 pixel radius, convert to the palette of the source image:
Image
4. In GIMP, select the pink background from the result you got in step 2, paste over the S1 upscale, export this image, open in mtPaint and again apply KN blur at 2 pixel radius. Then convert to the indexed palette of S3:
Image
5. Open the result in GIMP, select the pink background and grow selection by 1 pixel. Copy the selected area, then paste over the S1 upscale. You can then re-select the pink background (without growing though so that the copied sprite edges remain) on the S1 upscale and delete it:
Image

On a separate note, I knew before that the background colour or at least brightness affects the results (even in areas not close to the sprite edges), but here it's noticable that with a white background the results are sharper and darker:
Image
Image
Last edited by MrFlibble on Mon Oct 14, 2019 5:37 pm, edited 1 time in total.

MrFlibble
Posts: 141
Joined: Sat Jan 27, 2018 10:43 am

Re: [MOD] Pure Vanilla Extract - Help Wanted!

Post by MrFlibble » Mon Oct 14, 2019 4:22 pm

Here's another test (sorry for double-posting but my previous post is already large!):
Image
This time I used a dark blue background because pink gives off too much ringing:
Image
I also used Kuwahara Nagao blur at 1 pixel radius with protect details on, and it didn't make a huge difference compared to the 2 pixel radius version.

If you have better ideas on how to extract the upscaled sprites from the background feel free to share, because with scaling up against black produces some real smooth results:
Image
UPD: Nah, I think the KN 2 pixel radius is still better:
Image

MrFlibble
Posts: 141
Joined: Sat Jan 27, 2018 10:43 am

Re: [MOD] Pure Vanilla Extract - Help Wanted!

Post by MrFlibble » Tue Oct 15, 2019 12:35 pm

I wasn't entirely happy with the blurriness that xBRZ softening produces, and as it turns out, not without reason!

I tried upscaling sprites without softening and realised that a different alpha would produce better handling of edges for non-softened source images. In fact, an interpolation of rebout_interp and 4x_Lady0101_v3_blender at alpha 0.3 gives better results with raw images:
Image
Image
Image
A few more results here:
https://imgur.com/a/PGCMHPg
I'm using the same procedure as described above to get masks, save for the different model and without step 2 (xBRZ softening).

MrFlibble
Posts: 141
Joined: Sat Jan 27, 2018 10:43 am

Re: [MOD] Pure Vanilla Extract - Help Wanted!

Post by MrFlibble » Wed Oct 16, 2019 2:12 pm

Meanwhile I spent some time to do a more systematic research of what the currently available models can do.

The models that produce good results without pre-processing of the source images are:
  • 4x_Fatality_01_265000_G
  • 4x_rebout_325k
  • rebout_interp
  • 4x_Lady0101_v3_340000
  • 4x_Lady0101_v3_blender
  • 4x_SpongeBob_235000_G
None of these produce acceptable sprite results if used on their own, but can get quite good if interpolated with one another.

Previously I relied mostly on guesswork when interpolating models (using alpha = 0.5 most of the time) but more extensive testing showed that at certain levels (in particular close to the said middle value of 0.5) the models may actually disrupt one another, negating the efficiency with which images are processed. For a quick example, here's the same sprite upscaled with Fatality (left), Rebout Interp (right) and an alpha 0.5 interpolation of the two (centre):
Image Image Image
You can clearly see that the priest's staff is a clean diagonal line in all but the centre image where it has become jittery.

With this in mind I conducted further tests using alpha values in the range of 0.1 to 0.3, or, conversely, from 0.7 to 0.9. Note that the alpha values are completely reversible, meaning that an X/Y interpolation at 0.3 is the exact same thing as Y/X interpolation at 0.7. (For clarity in notation, when I say X/Y I mean that in net_interp.py, X is the model in the net_ESRGAN_path and Y in net_PSNR_path).

Here's the same priest sprite with Fatality/Rebout interpolated at 0.3:
Image
Another catch is that each model has its own peculiarities:
  • Fatality results are overly sharp and with noticeable ringing
  • rebout_interp fuzzies edges and produces colour banding
  • Lady is rather blurry
For NPC flats, I mentioned above that the Lady models seem to work good. I picked two sprites that have issues with different models to illustrate the results using alpha = 0.7.

Series I.
4x_Lady0101_v3_340000 interpolated with: 4x_Fatality_01_265000_G, rebout_interp, 4x_SpongeBob_235000_G:
ImageImageImage Image
4x_Lady0101_v3_blender interpolated with: 4x_Fatality_01_265000_G, rebout_interp, 4x_SpongeBob_235000_G:
ImageImageImage Image
Series II.
4x_Lady0101_v3_340000 interpolated with: 4x_Fatality_01_265000_G, rebout_interp, 4x_SpongeBob_235000_G:
ImageImageImage Image
4x_Lady0101_v3_blender interpolated with: 4x_Fatality_01_265000_G, rebout_interp, 4x_SpongeBob_235000_G:
ImageImageImage Image

I'd probably say that the 4x_Lady0101_v3_blender interpolations with rebout_interp and 4x_SpongeBob_235000_G are the closest to the original image.

MrFlibble
Posts: 141
Joined: Sat Jan 27, 2018 10:43 am

Re: [MOD] Pure Vanilla Extract - Help Wanted!

Post by MrFlibble » Wed Oct 16, 2019 6:49 pm

Please forgive multiple posting!

I think I kinda-sorta figured out how to counter the blurriness of Lady interpolated models' output. There's a filter in Image Analyzer (kudos to Jimmy for suggesting this programme!) called Warp sharpen which produces some rather neat results. Here are some side-to-side comparisons:
https://imgsli.com/NzQ2Ng

User avatar
King of Worms
Posts: 2472
Joined: Mon Oct 17, 2016 11:18 pm
Location: Scourg Barrow (CZ)
Contact:

Re: [MOD] Pure Vanilla Extract - Help Wanted!

Post by King of Worms » Thu Oct 17, 2019 12:19 am

Very interresting read and images. I think the place where this might have good impact on the visuals are Commoners (townfolk roaming the cities) and Id say nature flats, besides those redrawn by Jman0war.

I did the town ppl, but it can be better. Only thing Im 100% content with are the higher res front facing images from each commoners set. They were done with Lady algo and faces were redrawn by Adrinus.

I think the static NPCs are already beyond the level AI can get us honestly. Unless some breakthru is made that is..

Post Reply