Homebrew TWPatcher - DS(i) mode screen filters and patches

  • Thread starter Sono
  • Start date
  • Views 745,790
  • Replies 2,428
  • Likes 101

Are you interested in a complete replacement of TwlBg which includes all patches?

  • Yes, I don't care how broken it will be!

    Votes: 188 79.3%
  • No, I don't want to use even more broken stuff

    Votes: 20 8.4%
  • Yes, but only in GBA mode, because I play DSi exclusives

    Votes: 12 5.1%
  • No, because I only use DS and DSi mode

    Votes: 17 7.2%

  • Total voters
    237
  • Poll closed .

espen

Well-Known Member
Newcomer
Joined
Aug 30, 2009
Messages
59
Trophies
0
Age
27
Location
Bergen
XP
258
Country
Norway
So, I'm no expert on the technical side of stuff, but I am a VFX artist. Lanczos resampling is usually one of the best of the standard approaches to rescaling an image, would that algorithm be useable here?
 
  • Like
Reactions: ElderC

Sono

cripple piss
OP
Developer
Joined
Oct 16, 2015
Messages
2,820
Trophies
2
Location
home
XP
9,310
Country
Hungary
So, I'm no expert on the technical side of stuff, but I am a VFX artist. Lanczos resampling is usually one of the best of the standard approaches to rescaling an image, would that algorithm be useable here?

Can you do it in a + shaped matrix?

Edit: I can't read. I'll research it later.
 
Last edited by Sono,

DSoryu

GBA/NDS Maniac
Member
Joined
May 5, 2010
Messages
2,356
Trophies
2
Location
In my house
XP
4,757
Country
Mexico
Can you do it in a + shaped matrix?

Edit: I can't read. I'll research it later.

I'm not an expert regarding this, but I found this information that might be useful:

https://clouard.users.greyc.fr/Pantheon/experiments/rescaling/index-en.html

And for the Lanczos algorithm, you should click on the image, it redirects here: https://clouard.users.greyc.fr/Pantheon/experiments/rescaling/index-en.html#lanczos

One of the advantages of Lanczos resampling filter is that it has no artifacts and a low contrast loss rate, which may come in handy for this project.
 

espen

Well-Known Member
Newcomer
Joined
Aug 30, 2009
Messages
59
Trophies
0
Age
27
Location
Bergen
XP
258
Country
Norway
Can you do it in a + shaped matrix?

Edit: I can't read. I'll research it later.

I found this if it is of any help.
It lists a few algorithms and gives some explanation of them and the kernel formulas behind them.
Sadly'm not a technical director and don't know enough about how to implement them to be of much more help than that, but either Lanczos or catmull-rom should probably give the best results I'd wager.

http://bertolami.com/index.php?engine=blog&content=posts&detail=inside-imagine-kernels
 
Last edited by espen,

Sono

cripple piss
OP
Developer
Joined
Oct 16, 2015
Messages
2,820
Trophies
2
Location
home
XP
9,310
Country
Hungary
I'm not an expert regarding this, but I found this information that might be useful:

https://clouard.users.greyc.fr/Pantheon/experiments/rescaling/index-en.html

And for the Lanczos algorithm, you should click on the image, it redirects here: https://clouard.users.greyc.fr/Pantheon/experiments/rescaling/index-en.html#lanczos

One of the advantages of Lanczos resampling filter is that it has no artifacts and a low contrast loss rate, which may come in handy for this project.

Yes, this is indeed useful! While reading around I also found this, which almost exactly describes how the Matrix unit works: https://clouard.users.greyc.fr/Pantheon/experiments/rescaling/index-en.html#convolution

I found this if it is of any help.
It lists a few algorithms and gives some explanation of them and the kernel formulas behind them.
Sadly'm not a technical director and don't know enough about how to implement them to be of much more help than that.

http://bertolami.com/index.php?engine=blog&content=posts&detail=inside-imagine-kernels

HOLY SHIT, this is so fucking useful! I was trying to look at the source code, but this post explains really well how some of the algos work.
The reason most scale matrixes are so awfully low quality in TWPatch is because I don't understand subpixel interpolation, and thus I end up messing up the pixel offset, and thus "delaminate" the whole image.

Damn, I'll dig into this more, as this could help me solve the delamination problem by eliminating the human from the matrix generation, and just let some code generate the scale matrixes for me.
 

DSoryu

GBA/NDS Maniac
Member
Joined
May 5, 2010
Messages
2,356
Trophies
2
Location
In my house
XP
4,757
Country
Mexico
Yes, this is indeed useful! While reading around I also found this, which almost exactly describes how the Matrix unit works: https://clouard.users.greyc.fr/Pantheon/experiments/rescaling/index-en.html#convolution



HOLY SHIT, this is so fucking useful! I was trying to look at the source code, but this post explains really well how some of the algos work.
The reason most scale matrixes are so awfully low quality in TWPatch is because I don't understand subpixel interpolation, and thus I end up messing up the pixel offset, and thus "delaminate" the whole image.

Damn, I'll dig into this more, as this could help me solve the delamination problem by eliminating the human from the matrix generation, and just let some code generate the scale matrixes for me.

I'm glad this will help with improvements, I'm looking forward the new scaling filters that may be added in future releases of your patcher :yay3ds:
 

espen

Well-Known Member
Newcomer
Joined
Aug 30, 2009
Messages
59
Trophies
0
Age
27
Location
Bergen
XP
258
Country
Norway
Yea, upscaling is an art. I have mad respect for the people who make these algorithms. Your filters honestly aren't that bad, not perfect, but far from awful in most cases (not sure what you did to make Linear 2 though, that one is far inferior)

The DS to 3DS resampling is a bit of an edgecase as we really, really wish we could have integer scaling, but can't; and the resolution difference isn't high enough to just ignore some pixel lines and have it be a bit too small or big without any issues.

So we want something that creates a very sharp almost aliased image, but isn't so aliased that we run into the same issues as using a nearest neighbor type filter would do.

Usually you want a very smooth image with anti aliasing and good edge sharpening, not this time.

I don't know about you but I prefer my Pokemon sprites crisp rather than smooth.
 

Sono

cripple piss
OP
Developer
Joined
Oct 16, 2015
Messages
2,820
Trophies
2
Location
home
XP
9,310
Country
Hungary
not sure what you did to make Linear 2 though, that one is far inferior

As I said, it's because of the "sliding" scale filter to compensate for the lack of subpixel interpolation in the hardware, and I messed up the sliding, and accidently just made the image "delaminated".

The DS to 3DS resampling is a bit of an edgecase as we really, really wish we could have integer scaling, but can't; and the resolution difference isn't high enough to just ignore some pixel lines and have it be a bit too small or big without any issues.

So we want something that creates a very sharp almost aliased image, but isn't so aliased that we run into the same issues as using a nearest neighbor type filter would do.

Yeah. Although it's not integer scaling, we have fractional scaling where both the divider and the dividee are between 1 and 8.

For example, my GBA scale filter uses 6/4 for height, and 5/3 (:wacko:) for width. You can calculate the resulting resolutions from the source resolution of 240x160:
- 240 * 5 / 3 is 400
- 160 * 6 / 4 is 240
which just happens to be the top screen resolution of the 3DS.

Sure, it's not perfect integer upscaling, but at least they aren't some disgusting fraction, or a non-fraction non-integer number, so it's easier to create a "sliding" matrix for use in hardware accelerators.
 

Sono

cripple piss
OP
Developer
Joined
Oct 16, 2015
Messages
2,820
Trophies
2
Location
home
XP
9,310
Country
Hungary
@Sono I can’t find the message with the patcher link including widescreen patch.
Can you link it on OP?

It's intentionally not linked YET. The currently public version of the patcher is just a """"quick"""" techdemo to show that this is possible. The 2nd public version will have much more features I intended to include with the first version, but didn't have enough time and energy.
 

Keylogger

Well-Known Member
Member
Joined
May 3, 2006
Messages
2,637
Trophies
1
Age
34
Website
Visit site
XP
6,631
Country
France
It's intentionally not linked YET. The currently public version of the patcher is just a """"quick"""" techdemo to show that this is possible. The 2nd public version will have much more features I intended to include with the first version, but didn't have enough time and energy.
Ok thanks
Take your time :)
Oh and for energy... i guess you need some sleep?
 

Site & Scene News

Popular threads in this forum

General chit-chat
Help Users
    Xdqwerty @ Xdqwerty: @Psionic Roshambo, atleast there was some neat filler there