Venomalia / HDcube

This is an ESRGAN model trained specifically for upscaling GameCube and Wii textures, but it can of course be used for other textures from that period.
Other
57 stars 1 forks source link

Chainner Chain Templates for PS2 Incorrectly Scale Alpha Channel #2

Open shuttle128 opened 3 months ago

shuttle128 commented 3 months ago

The 4xHDcube Plus Image File Iterator (PS2).chn file supplied with Ko-Fi subscription does not properly scale the alpha channel for PS2 textures after splitting and before merging. According to the PCSX2 texture_dump_alpha_scaler page PS2 graphics use a 128 bit alpha channel and needs to be scaled up to create a 256 bit channel prior to upscaling rather than stretching contrast. This introduces error into the texture passed to the upscaler. Then when the upscaled output is merged without rescaling back to 128 bit and the original file is used to scale the opacity the resulting final merged texture can be significantly off. This is especially a problem for textures with transparency as it can cause textures to become transparent that were not previously.

I've gotten much better results by scaling the color level white input 50% prior to upscaling, then after upscaling scaling the color level white output 50% (this is equivalent to the alpha scaling python script). The output from that can be piped to the alpha recombiner node without touching opacity modifiers or threshold nodes.

Attached is the chain I use that provides much better results.

4xHDcube Plus Image File Iterator (PS2) with alpha scaling.zip

Venomalia commented 3 months ago

PCSX2 has changed its behavior in the past, since then the hold template no longer works as intended. Not all textures are 128 bit alpha channel you don't seem to take that into account here, but i will consider this approach. But I am working on a solution.