01-09-2021, 06:04 PM
It's time for another update! How are you guys doing?
I finally understand why PS2 image/texture is arranged in such a weird way - texture swizzling.
https://ps2linux.no-ip.info/playstation2...ezswizzle/
https://ps2linux.no-ip.info/playstation2...l?docid=75
In short, swizzling is about optimizing for GPU. Pixel data can be sent over multiple bus at the same time, thus achieve performance gain.
But swizzling is not compression. The pixel data are just switch around. They do not overwrite each other. THIS IS IMPORTANT!
For 4-bit images, the pixels are swizzled twice - first as pixels, then as blocks of 64 bytes. No wonder I couldn't understand them by simply closely examine them. It is way above my skill level.
Unfortunately, the code above isn't perfect either. For 8-bit images, it works nicely. But for 4-bit images, any image 128x128 or larger is having problem. 1/4 of the pixels end up overwriting each other.
And I think the code works only on square images. Portrait and landscape images have everything unswizzled at the wrong place. That requires debugging.
Since I can unswizzle 8-bit images correctly, I can start reassemble them.
On this update, I give you Gwendlyn (WIP) from Odin Sphere.
Like Muramasa, the sprites also has mask/alpha blending problem.
Let's see if I can solve all the problems by next week. Until then, take care!
- Rufas
I finally understand why PS2 image/texture is arranged in such a weird way - texture swizzling.
https://ps2linux.no-ip.info/playstation2...ezswizzle/
https://ps2linux.no-ip.info/playstation2...l?docid=75
In short, swizzling is about optimizing for GPU. Pixel data can be sent over multiple bus at the same time, thus achieve performance gain.
But swizzling is not compression. The pixel data are just switch around. They do not overwrite each other. THIS IS IMPORTANT!
For 4-bit images, the pixels are swizzled twice - first as pixels, then as blocks of 64 bytes. No wonder I couldn't understand them by simply closely examine them. It is way above my skill level.
Unfortunately, the code above isn't perfect either. For 8-bit images, it works nicely. But for 4-bit images, any image 128x128 or larger is having problem. 1/4 of the pixels end up overwriting each other.
And I think the code works only on square images. Portrait and landscape images have everything unswizzled at the wrong place. That requires debugging.
Since I can unswizzle 8-bit images correctly, I can start reassemble them.
On this update, I give you Gwendlyn (WIP) from Odin Sphere.
Like Muramasa, the sprites also has mask/alpha blending problem.
Let's see if I can solve all the problems by next week. Until then, take care!
- Rufas