Users browsing this thread: 3 Guest(s)
Vanillaware Ripping Project
#58
Hi all! It has been 7 months since my last update, how are you guys doing?

The project is getting more technical now, as all the easy stuff are identified and ripped. Now it is about referring console development documentations for actual formula, reverse-engineering the executable for interpolation algorithm, and debugging those unknown bit-flags.

So today, I'm going to talk about alpha blending for consoles.

Recalling on my Legend of Mana thread when I'm researching how GIMP do alpha blending and found this: https://docs.gimp.org/en/gimp-concepts-layer-modes.html

Console is different in that it uses one standard formula for alpha blending, but disable/zero any register not needed at run time.

For Playstation 2, the formula for alpha blending is:
https://psi-rockin.github.io/ps2tek/#gsalphablending

Code:
Output = ((A - B) * C) + D

Using the above formula and look around the main executable ASM code, I manage to discover the 6 blending formula used in PS2 Odin Sphere:

Code:
Blend 0: Pixel = ((FG.rgb - BG.rgb) * FG.a) + BG.rgb
Blend 1: Pixel = ((FG.rgb - 0) * FG.a) + BG.rgb
Blend 2: Pixel = ((0 - FG.rgb) * FG.a) + BG.rgb
Blend 3: Pixel = ((FG.rgb - BG.rgb) * BG.a) + BG.rgb
Blend 4: Pixel = ((FG.rgb - 0) * BG.a) + BG.rgb
Blend 5: Pixel = ((0 - FG.rgb) * BG.a) + BG.rgb

Interestingly, PS2 Odin Sphere sprites uses Blend 0, 1 and 2. Blend 3, 4 and 5 are unused.

The annoying part about the whole formula is it reads BG.rgb twice, it isn't possible to do with WebGL builtin blendFunc(). I'll have to roll my own and ping-pong around.

Since I'll be doing custom blending from now on, WebGL builtin blendFunc() will be disabled.

Similar formula is also discovered on Wii. It is called TEV (Texture Environment Unit) Computation Expression.

Code:
D + ( ((1-C) * A) + (C*B)

The 6 different blending modes on Wii are:

https://rufaswan.github.io/Web2D_Games/i...%20p45.png
https://rufaswan.github.io/Web2D_Games/i...%20p47.png
https://rufaswan.github.io/Web2D_Games/i...%20p49.png
https://rufaswan.github.io/Web2D_Games/i...%20p51.png
https://rufaswan.github.io/Web2D_Games/i...%20p53.png
https://rufaswan.github.io/Web2D_Games/i...%20p57.png

Code:
D + ( ((1-0) * A) + (0*0) = D + A or Addition
D - ( ((1-0) * A) + (0*0) = D - A or Subtraction
0 + ( ((1-C) * 0) + (C*B) = C * B or Multiplication
D + ( ((1-C) * 0) + (C*B) = D + (C * B) or Addition + Multiplication
0 + ( ((1-C) * A) + (C*B) = (1-C) * A + (C * B) or Decal
D + ( ((1-C) * A) + (C*0) = D + ((1-C) * A) or Proportional

I haven't debug Wii code yet, but I would presume Blend 0 is Decal, Blend 1 is Addition, and Blend 2 is Subtraction.

For completion sake, the alpha blending formula for Playstation One:

Code:
FG.rgb * A + BG.rgb * B

The 4 different blending modes on PS1 are:

https://rufaswan.github.io/Web2D_Games/i...6-p345.png
https://rufaswan.github.io/Web2D_Games/i...6-p109.png

Code:
FG.rgb *  0.5 + BG.rgb * 0.5 or Average
FG.rgb *  1.0 + BG.rgb * 1.0 or Addition
FG.rgb * -1.0 + BG.rgb * 1.0 or Subtraction
FG.rgb * 0.25 + BG.rgb * 1.0 or Quarter Addition

Will need help to find the alpha blending formula for these consoles:
- Playstation Portable
- Playstation Vita
- Playstation 3
- Playstation 4
- Nintendo DS (although Kumatanchi never used any)
- Nintendo Switch
- Sega Saturn

Still learning, and keep getting closer and closer to finish line.

Wish you an early Merry Christmas + Happy New Year 2023!
- Rufas
Reply
Thanked by:


Messages In This Thread
Vanillaware Ripping Project - by rufaswan - 12-31-2020, 05:28 PM
RE: Vanillaware Ripping Project - by SmithyGCN - 12-31-2020, 06:03 PM
RE: Vanillaware Ripping Project - by rufaswan - 01-09-2021, 06:04 PM
RE: Vanillaware Ripping Project - by Magma MK-II - 01-09-2021, 09:41 PM
RE: Vanillaware Ripping Project - by rufaswan - 01-10-2021, 03:15 PM
RE: Vanillaware Ripping Project - by rufaswan - 01-16-2021, 03:42 PM
RE: Vanillaware Ripping Project - by leafthelast - 07-13-2021, 08:54 AM
RE: Vanillaware Ripping Project - by rufaswan - 07-30-2021, 03:07 PM
RE: Vanillaware Ripping Project - by tombmonkey - 01-20-2021, 12:01 PM
RE: Vanillaware Ripping Project - by rufaswan - 01-20-2021, 08:11 PM
RE: Vanillaware Ripping Project - by tombmonkey - 01-21-2021, 12:46 AM
RE: Vanillaware Ripping Project - by rufaswan - 01-21-2021, 06:33 PM
RE: Vanillaware Ripping Project - by tombmonkey - 01-21-2021, 09:54 PM
RE: Vanillaware Ripping Project - by rufaswan - 01-25-2021, 05:22 PM
RE: Vanillaware Ripping Project - by SmithyGCN - 01-26-2021, 01:34 AM
RE: Vanillaware Ripping Project - by rufaswan - 02-02-2021, 05:52 PM
RE: Vanillaware Ripping Project - by FormerUser12 - 02-09-2021, 05:40 PM
RE: Vanillaware Ripping Project - by rufaswan - 02-09-2021, 08:16 PM
RE: Vanillaware Ripping Project - by SmithyGCN - 02-10-2021, 12:02 AM
RE: Vanillaware Ripping Project - by rufaswan - 02-16-2021, 05:15 PM
RE: Vanillaware Ripping Project - by rufaswan - 02-24-2021, 04:29 PM
RE: Vanillaware Ripping Project - by rufaswan - 03-01-2021, 05:15 PM
RE: Vanillaware Ripping Project - by tombmonkey - 03-01-2021, 05:46 PM
RE: Vanillaware Ripping Project - by rufaswan - 03-16-2021, 07:29 PM
RE: Vanillaware Ripping Project - by FormerUser12 - 03-22-2021, 10:26 AM
RE: Vanillaware Ripping Project - by rufaswan - 03-24-2021, 05:32 PM
RE: Vanillaware Ripping Project - by rufaswan - 04-12-2021, 07:29 PM
RE: Vanillaware Ripping Project - by Raccoon Sam - 04-13-2021, 03:23 PM
RE: Vanillaware Ripping Project - by rufaswan - 04-13-2021, 06:11 PM
RE: Vanillaware Ripping Project - by rufaswan - 04-20-2021, 08:05 PM
RE: Vanillaware Ripping Project - by rufaswan - 04-26-2021, 08:22 PM
RE: Vanillaware Ripping Project - by rufaswan - 05-13-2021, 03:20 PM
RE: Vanillaware Ripping Project - by rufaswan - 05-27-2021, 03:20 PM
RE: Vanillaware Ripping Project - by Erborot - 06-01-2021, 11:58 PM
RE: Vanillaware Ripping Project - by rufaswan - 06-09-2021, 05:32 PM
RE: Vanillaware Ripping Project - by 3zizuz - 09-06-2021, 08:33 AM
RE: Vanillaware Ripping Project - by 3zizuz - 09-06-2021, 02:55 PM
RE: Vanillaware Ripping Project - by rufaswan - 09-07-2021, 03:50 PM
RE: Vanillaware Ripping Project - by 3zizuz - 09-09-2021, 11:36 AM
RE: Vanillaware Ripping Project - by rufaswan - 09-09-2021, 01:55 PM
RE: Vanillaware Ripping Project - by 3zizuz - 09-09-2021, 04:52 PM
RE: Vanillaware Ripping Project - by rufaswan - 09-10-2021, 03:07 PM
RE: Vanillaware Ripping Project - by 3zizuz - 09-10-2021, 04:10 PM
RE: Vanillaware Ripping Project - by rufaswan - 09-11-2021, 12:43 PM
RE: Vanillaware Ripping Project - by 3zizuz - 09-11-2021, 01:48 PM
RE: Vanillaware Ripping Project - by 3zizuz - 09-15-2021, 08:42 AM
RE: Vanillaware Ripping Project - by rufaswan - 09-15-2021, 02:46 PM
RE: Vanillaware Ripping Project - by miru - 10-29-2021, 03:45 PM
RE: Vanillaware Ripping Project - by rufaswan - 10-30-2021, 05:20 PM
RE: Vanillaware Ripping Project - by rufaswan - 11-25-2021, 05:39 PM
RE: Vanillaware Ripping Project - by messusatsu - 12-17-2021, 01:34 PM
RE: Vanillaware Ripping Project - by rufaswan - 12-19-2021, 10:37 PM
RE: Vanillaware Ripping Project - by messusatsu - 12-21-2021, 04:44 PM
RE: Vanillaware Ripping Project - by messusatsu - 12-21-2021, 06:37 PM
RE: Vanillaware Ripping Project - by rufaswan - 12-22-2021, 01:23 AM
RE: Vanillaware Ripping Project - by lilinachan - 03-30-2022, 07:45 PM
RE: Vanillaware Ripping Project - by rufaswan - 05-19-2022, 07:58 PM
RE: Vanillaware Ripping Project - by rufaswan - 12-18-2022, 12:38 AM
RE: Vanillaware Ripping Project - by rufaswan - 05-18-2023, 12:02 PM
RE: Vanillaware Ripping Project - by Sophignon - 06-05-2023, 08:18 PM
RE: Vanillaware Ripping Project - by rufaswan - 06-06-2023, 10:06 AM
RE: Vanillaware Ripping Project - by Sophignon - 06-08-2023, 05:02 AM
RE: Vanillaware Ripping Project - by rufaswan - 06-09-2023, 09:24 AM
RE: Vanillaware Ripping Project - by Xantis - 06-30-2023, 04:49 PM
RE: Vanillaware Ripping Project - by rufaswan - 07-02-2023, 09:03 AM
RE: Vanillaware Ripping Project - by Xantis - 07-02-2023, 12:38 PM
RE: Vanillaware Ripping Project - by HLI5KY - 09-12-2023, 10:20 AM
RE: Vanillaware Ripping Project - by HLI5KY - 09-13-2023, 08:08 AM
RE: Vanillaware Ripping Project - by Rudeus - 09-18-2023, 06:41 AM
RE: Vanillaware Ripping Project - by rufaswan - 09-18-2023, 09:32 AM
RE: Vanillaware Ripping Project - by Rudeus - 09-19-2023, 08:03 AM
RE: Vanillaware Ripping Project - by rufaswan - 09-19-2023, 10:56 AM
RE: Vanillaware Ripping Project - by rufaswan - 10-02-2023, 09:18 AM
RE: Vanillaware Ripping Project - by rufaswan - 11-07-2023, 07:52 AM
RE: Vanillaware Ripping Project - by switchkult - 11-27-2023, 01:52 AM
RE: Vanillaware Ripping Project - by rufaswan - 11-29-2023, 06:07 AM
RE: Vanillaware Ripping Project - by Muramasa - 12-26-2023, 03:33 PM
RE: Vanillaware Ripping Project - by rufaswan - 12-30-2023, 06:43 AM
RE: Vanillaware Ripping Project - by Muramasa - 12-30-2023, 06:22 PM
RE: Vanillaware Ripping Project - by rufaswan - 12-31-2023, 08:02 AM
RE: Vanillaware Ripping Project - by Muramasa - 01-02-2024, 03:15 PM
RE: Vanillaware Ripping Project - by rufaswan - 01-13-2024, 08:58 AM
RE: Vanillaware Ripping Project - by coolPoi - 02-12-2024, 07:41 AM
RE: Vanillaware Ripping Project - by rufaswan - 02-14-2024, 06:03 AM
RE: Vanillaware Ripping Project - by coolPoi - 02-15-2024, 01:20 AM
RE: Vanillaware Ripping Project - by rufaswan - 02-15-2024, 05:37 AM
RE: Vanillaware Ripping Project - by coolPoi - 02-15-2024, 08:38 AM
RE: Vanillaware Ripping Project - by rufaswan - 03-09-2024, 07:57 AM
RE: Vanillaware Ripping Project - by Valarant - 03-20-2024, 10:23 PM
RE: Vanillaware Ripping Project - by rufaswan - 03-21-2024, 06:01 AM
RE: Vanillaware Ripping Project - by rufaswan - 04-04-2024, 07:43 AM
RE: Vanillaware Ripping Project - by havoc - 04-15-2024, 04:52 PM
RE: Vanillaware Ripping Project - by rufaswan - 04-17-2024, 08:15 AM
RE: Vanillaware Ripping Project - by havoc - 04-19-2024, 09:00 AM
RE: Vanillaware Ripping Project - by rufaswan - 04-20-2024, 07:03 AM
RE: Vanillaware Ripping Project - by redemon - 04-29-2024, 02:43 AM
RE: Vanillaware Ripping Project - by redemon - 04-29-2024, 11:12 AM

Forum Jump: