Duke4.net Forums: Scaling sprites by combining waifu2x and xBRZ output - Duke4.net Forums

Jump to content

Hide message Show message
Welcome to the Duke4.net Forums!

Register an account now to get access to all board features. After you've registered and logged in, you'll be able to create topics, post replies, send and receive private messages, disable the viewing of ads and more!

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Scaling sprites by combining waifu2x and xBRZ output

User is offline   MrFlibble 

  • 519

#1

So I was toying around with various ways to scale up video game sprites and managed to produce these results for Duke3D enemies:
Posted Image
(this is converted to the Duke3D palette, original image scaled twice using nearest neighbour for comparison).

Basically, I noticed that waifu2x does a decent job scaling up pre-rendered images, which would make it good for Duke3D sprites if only sprite edges weren't handled so badly. On the other hand, xBRZ can produce very smooth edges but does nothing to enhance image detail.

The obvious solution was to combine both approaches, keeping xBRZ's smooth edges and the detail that waifu2x can produce.

So the steps I took to produce the above image:

1. Assembled the sprites into a single image (obviously). I also created from it a set of solid colour shapes with the colour replacement tool found in GrafX2.

2. Scaled the sprite sheet to 4x its original size using both waifu2x and the xBRZ Scaler Test. Also scaled up the shape sheet with xBRZ and neutralised all transition colours in the resulting image (again, using GrafX to only keep one colour for shapes and another for the background).

3. Used the scaled up shape sheet to produce shapes that are 3 pixels thinner (note: if you see a blue outline it's an optical illusion). I did this by treating the shape colour as the background colour (using KolourPaint) and placing four copies of the background around the original image -- this thins the shapes by one line of pixels, and repeating this thrice gives a three-pixel thinning result.

4. Pasted the thinned shapes over the xBRZ-scaled sprites, getting a thin outline. I also completely removed the outer one pixel thin outline.

5. Pasted the resulting outline over the waifu2x-scaled sprites, covering the rough edges (resulting image).

6. I did not like how the 4x sprites came out so I loaded them in GIMP and first converted them to the Duke3D palette and then scaled down to 2x the original size using nearest neighbour method. The result is shown above.

I'd say the results are pretty interesting, perhaps such sprites could serve as the base for some true high-resolution sprites after touch-up by an artist?
5

User is offline   Phredreeke 

  • 120

#2

this is similar to how I did my sprite upscales for Blood, except I just used a nearest neighbour upscale of the original as mask followed by a median filter (which in hindsight wasn't the best idea, as the filter treats red,green,blue channels separately, causing pink fringing around the edges)

for the background upscales, I instead opted to add transparency before upscaling with waifu2x. this causes waifu2x to utterly fail at processing those parts, so I made a new sprite mask by blurring and posterizing the existing opacity.

I followed up both with a noise layer on top of the upscaled tile. for the background I used a slightly more complicated approach...

Edit: Here are your sprites, with a slight noise pass applied. https://i.imgur.com/p7Wnq8E.png

Edit 2: Oh, and PLUs are a pain in the ass. fortunately Duke 3D doesn't use them as extensively as Blood


This post has been edited by Phredreeke: 14 June 2018 - 01:46 AM

1

User is offline   MrFlibble 

  • 519

#3

View PostPhredreeke, on 14 June 2018 - 01:37 AM, said:

Edit: Here are your sprites, with a slight noise pass applied. https://i.imgur.com/p7Wnq8E.png

That looks cool, what exactly did you do to achieve this?
0

User is offline   Phredreeke 

  • 120

#4

This describes using PSP8 (yeah, I use a 15 year old image editing software) you will have to find equivalent functions in whatever software you use.

1. Create a mask by duplicating the image, filling it with the background color using the difference blend mode, then using a threshold effect set to 1 to make every non-black pixel white.

2. Now, going back to the original picture, use the levels functions and set gamma to 2

3. Now apply a noise filter with a 7% setting gaussian and monochrome.

4. Apply the levels effect again except this time set gamma to 0.5

5. Finally apply the mask you created in the first step.
1

User is offline   MrFlibble 

  • 519

#5

Thanks! I'll try to figure it out (I'm using GIMP), for now I found an option in GIMP called HSV noise which produces kinda-sorta similar results:
Posted Image

This is at default settings except Holdness set at 1 (default is 2).

Adding noise is a good idea, thanks -- I wouldn't have come up with it :)
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic


All copyrights and trademarks are property of their respective owners. Instead of reading this text, you could be playing Ion Maiden! ;) © 2018 Voidpoint, LLC

Enter your sign in name and password


Sign in options