gonetz / GLideN64

A new generation, open-source graphics plugin for N64 emulators.
Other
774 stars 180 forks source link

Feature Request: Deposterization filter for xBRZ #826

Closed DonelBueno closed 7 years ago

DonelBueno commented 8 years ago

xBRZ scaling leaves the textures with posterization issues. The same issue happened on PPSSPP, but they sorted it out with a deposterization step. The issue and the solution are both described here:

http://blog.metaclassofnil.com/?p=306

Example of the issue in GLideN64:

project64 2015-12-27 08-06-57-84

project64 2015-12-27 08-08-23-79

Pay attention to the sky texture. The first one is xBRZ filtered, the second one is HQ4x.

It's way more evident in some games, like in Ocarina of Time. The ground texture in that game gets really distracting.

ADormant commented 8 years ago

@gonetz Deposterize https://github.com/Tinob/Ishiiruka/commit/d2fb92518f50c6154f33f05be39128e48d6b83be

ADormant commented 8 years ago

@gonetz Deposterize shader https://github.com/libretro/common-shaders/commit/cc81b1fd425869c05091ae8bf1138ba3d42fa3a4

gonetz commented 8 years ago

I've added the deposterization step from Ishiiruka's code: https://github.com/gonetz/GLideN64/commit/78d7c99b029deb5a17869a8254f4c44fd76edf0c I don't see much difference though.

I can't share the binary via googledrive because it says that the file is infected. I tested the file via virustotal - ClamAV reports about Win.Adware.Browsefox-12346, others 54 antiviruses reports that the file is clean. If you need the binary, you may write me an email, I'll send the file to you.

theboy181 commented 8 years ago

Zip with password protection and share the password in the info file.

gonetz commented 8 years ago

Good idea. The binary: https://drive.google.com/file/d/0B0YqMPjGo3B2VU0tVkdST0ViUWc/view?usp=sharing

pass: deposterization

ADormant commented 8 years ago

@gonetz Changes are supposed to be subtle http://libretro.com/forums/showthread.php?t=4908

gonetz commented 8 years ago

If you see the positive difference in quality, I'll add that code to master.

DonelBueno commented 8 years ago

I'll check it out soon and then post the results here. Thanks for the attention.

DonelBueno commented 8 years ago

Test Results:

No Texture Scaling: 1- no scaling

HQ 4x Texture Scaling: 2- hq 4x

6xBRZ Texture Scaling: 3- 6x xbrz

6xBRZ + Deposterization texture Scaling: 4- 6x xbrz deposterization

As you can see, there is basically no change to the posterization on the ground textures.

ADormant commented 8 years ago

Colors are better with deposterize enabled, Buttons around Navi button become lighter yellow instead of brownish and green circle seems to have better transparency.

DonelBueno commented 8 years ago

@ADormant You must be comparing the wrong images. Compare 6xBRZ Texture Scaling to 6xBRZ + Deposterization texture Scaling (the last two images).

They are basically the same, aside from some very minor differences on the ground textures, but these differences aren't for the better, they are just different.

ADormant commented 8 years ago

Still wouldn't hurt to add it looks somewhat different after all.

gonetz commented 8 years ago

It hurts performance, since the deposterization step is not free. I can make it optional though.

Regarding the result: it is probably a bad idea to use maximal BRZ level. Try 3x or 4x BRZ, may be difference will be more noticeable.

gonetz commented 8 years ago

I suggest to close this issue since deposterization step does not help to solve problems with xBRZ and N64 textures.

ADormant commented 8 years ago

@gonetz Deposterize is good for games with dithering https://github.com/tapcio/PeteOpenGL2Tweak/releases

gonetz commented 8 years ago

Most of N64 textures use 16bit color, however deposterization has no visible effect. N64 texture size may negate the effect, because N64 texture memory is just 4kb.

ADormant commented 8 years ago

Hmm PS1 texture cache is only 2kb.

gonetz commented 8 years ago

I have fixed an issue in GLideNHQ code and now deposterization effect is clearly visible

Test binary: super_mario_64-001 super_mario_64-004

https://drive.google.com/file/d/0B0YqMPjGo3B2LTVtcHAzX3ZDUjg/view?usp=sharing

oddMLan commented 8 years ago

Earthworm Jim 64 - Normal ewj_no_post Earthworm Jim 64 - X2 + Deposterization ewj_x2_with_post Earthworm Jim 64 - xBR 3x Normal ewj_xbrx3_no_post Earthworm Jim 64 - xBR 3x + Deposterization ewj_xbrx3_with_post Zelda OOT - Normal oot_no_post Zelda OOT - X2 + Deposterization oot_x2_with_post Zelda OOT - xBR x4 Normal oot_xbrx4_no_post Zelda OOT - xBR x4 + Deposterization oot_xbrx4_with_post

I wonder how deposterization helps KI Gold. I'll test later.

gonetz commented 8 years ago

So, deposterization is useful after all. I'll add it to master. I think, it should be optional though.

oddMLan commented 8 years ago

I agree; it should be optional. Just like in PPSSPP.

DonelBueno commented 8 years ago

I helps Earthworm Jim a lot, but it doesn't seem to help OOT.

I also think it's a good idea to include it into master.

gonetz commented 8 years ago

Done

gonetz commented 7 years ago

Has anybody my dev branch with Deposterization feature in your local git repository? Deposterization is completely broken in master. It seems that I broke on when merged code to master.

fzurita commented 7 years ago

What's breaking it? I'm not seeing any issues right now with it enabled in Android. Amy specific examples?

gonetz commented 7 years ago

I have issues in every game, e.g.: https://github.com/gonetz/GLideN64/issues/1301

gonetz commented 7 years ago

I see the problem. It happens only on devices with multicore CPU, if GLideNHQ can detect number of cores.

gonetz commented 7 years ago

Fixed.