01-21-2021, 06:33 PM
It's nice to have more discussion on modern 2D sprites. It's can be pretty hard to find topics related to alpha-blending, gradient map, anti-aliasing kind of stuff. It's always good to have the knowledge of these thing available here.
Let's start with the first one. The texture/parts images for Odin Sphere/Muramasa are all palette image. PS2 Odin Sphere are 256 RGBA color 8-bpp texture with texture swizzling, and Wii Muramasa are 256 RGB5A3 color 8-bpp texture.
It is not until their remake on VITA that they change them to DXT 3/5 video codec, a lossy compression algorithm.
https://en.wikipedia.org/wiki/S3_Texture_Compression
Also, anti-alias is a filter. In GIMP, it uses "Scale3X edge-extrapolation algorithm". I suppose you can use any other algorithm to anti-alias as well, like 2xEagle, 2xSal, HQ2X, Bilinear, etc. Anti-alias also has level and threshold settings to consider.
https://docs.gimp.org/2.6/en/plug-in-antialias.html
If I can, I would prefer to assemble the sprites in raw pixel, and then let the users to use whatever anti-alias filter they want. They can also use the HD filter you shown me on your Legend of Mana project.
About additive blending, the math formula is just FG.rgb + BG.rgb . It doesn't use alpha channel, and therefore addictive blending affects the whole image (or the whole part).
The math formula for normal blending however, is (FG.rgb * FG.A) + (BG.rgb * (1.0-FG.a)) . The blending is in pixel level. If FG.a is 1.0 , then BG.rgb will become zero, and you'll get FG.rgb as the result.
Let's have an example: if FG is rgb(80,40,8) and BG is rgb(120,64,72)
Additive blending is
r = 80 + 120 = 200
g = 40 + 64 = 104
b = 8 + 72 = 80
the result is rgb(200,104,80)
But for normal blending, it will become
FG.a = 80 / 255 = 0.31
r = (255 * 0.31) + (120 * (1.0-0.31)) = 79 + 82 = 161
g = (127 * 0.31) + (64 * (1.0-0.31)) = 39 + 44 = 83
b = (25 * 0.31) + (72 * (1.0-0.31)) = 7 + 49 = 56
the result is rgb(161,83,56)
The result for normal blending is darker than the result of additive blending, because the (1.0-FG.a) part.
Did you noticed? If the BG is all zero, then you'll getting the mask back. The formula is revertible.
The formula I used to convert rgb(80,40,8) into rgba(255,127,25,80) is like this:
highest = 80
r = 80 / 80 * 255 = 255
g = 40 / 80 * 255 = 127
b = 8 / 80 * 255 = 25
You'll need to use a custom blending mode if you want to use my Legend of Mana rips. Just blend the half-transparent pixel with black pixel to get the mask back, then add it to the background pixel, and clamp it to max value 255.
On blending the mask with color via code, it is no surprise since they also do it with the fonts texture. What annoys me the most is the data didn't marked the part requires a color too. And also I can't find that blue color anywhere.
I do agree effects sprites are normally like this, and ofter just unrippable.
I already found the byte on blending. It has 3 values:
0 = normal blend
1 = additive blend
2 = ???
The weird part is on different value. It is int_16 , and has
Odin Sphere = 25 types (0 1 2 3 4 5 6 7 9 b d f 10 11 13 15 19 21 28 29 2d 2f 31 35 39)
Muramasa = 13 types (0 1 2 3 4 5 7 9 11 13 15 29 2d)
There are tons of testing need to be done.
Interestingly, when I was just starting out, I assembled my sprites in HTML, using CSS spritesheet. It would be very interesting to see it in WebGL + Three.js . Heck, even my Castlavania NDS maps are in HTML.
https://www.vg-resource.com/thread-31643.html
https://www.vg-resource.com/thread-37086...#pid660862
Take care,
- Rufas
Let's start with the first one. The texture/parts images for Odin Sphere/Muramasa are all palette image. PS2 Odin Sphere are 256 RGBA color 8-bpp texture with texture swizzling, and Wii Muramasa are 256 RGB5A3 color 8-bpp texture.
It is not until their remake on VITA that they change them to DXT 3/5 video codec, a lossy compression algorithm.
https://en.wikipedia.org/wiki/S3_Texture_Compression
Also, anti-alias is a filter. In GIMP, it uses "Scale3X edge-extrapolation algorithm". I suppose you can use any other algorithm to anti-alias as well, like 2xEagle, 2xSal, HQ2X, Bilinear, etc. Anti-alias also has level and threshold settings to consider.
https://docs.gimp.org/2.6/en/plug-in-antialias.html
If I can, I would prefer to assemble the sprites in raw pixel, and then let the users to use whatever anti-alias filter they want. They can also use the HD filter you shown me on your Legend of Mana project.
About additive blending, the math formula is just FG.rgb + BG.rgb . It doesn't use alpha channel, and therefore addictive blending affects the whole image (or the whole part).
The math formula for normal blending however, is (FG.rgb * FG.A) + (BG.rgb * (1.0-FG.a)) . The blending is in pixel level. If FG.a is 1.0 , then BG.rgb will become zero, and you'll get FG.rgb as the result.
Let's have an example: if FG is rgb(80,40,8) and BG is rgb(120,64,72)
Additive blending is
r = 80 + 120 = 200
g = 40 + 64 = 104
b = 8 + 72 = 80
the result is rgb(200,104,80)
But for normal blending, it will become
FG.a = 80 / 255 = 0.31
r = (255 * 0.31) + (120 * (1.0-0.31)) = 79 + 82 = 161
g = (127 * 0.31) + (64 * (1.0-0.31)) = 39 + 44 = 83
b = (25 * 0.31) + (72 * (1.0-0.31)) = 7 + 49 = 56
the result is rgb(161,83,56)
The result for normal blending is darker than the result of additive blending, because the (1.0-FG.a) part.
Did you noticed? If the BG is all zero, then you'll getting the mask back. The formula is revertible.
The formula I used to convert rgb(80,40,8) into rgba(255,127,25,80) is like this:
highest = 80
r = 80 / 80 * 255 = 255
g = 40 / 80 * 255 = 127
b = 8 / 80 * 255 = 25
You'll need to use a custom blending mode if you want to use my Legend of Mana rips. Just blend the half-transparent pixel with black pixel to get the mask back, then add it to the background pixel, and clamp it to max value 255.
On blending the mask with color via code, it is no surprise since they also do it with the fonts texture. What annoys me the most is the data didn't marked the part requires a color too. And also I can't find that blue color anywhere.
I do agree effects sprites are normally like this, and ofter just unrippable.
I already found the byte on blending. It has 3 values:
0 = normal blend
1 = additive blend
2 = ???
The weird part is on different value. It is int_16 , and has
Odin Sphere = 25 types (0 1 2 3 4 5 6 7 9 b d f 10 11 13 15 19 21 28 29 2d 2f 31 35 39)
Muramasa = 13 types (0 1 2 3 4 5 7 9 11 13 15 29 2d)
There are tons of testing need to be done.
Interestingly, when I was just starting out, I assembled my sprites in HTML, using CSS spritesheet. It would be very interesting to see it in WebGL + Three.js . Heck, even my Castlavania NDS maps are in HTML.
https://www.vg-resource.com/thread-31643.html
https://www.vg-resource.com/thread-37086...#pid660862
Take care,
- Rufas