Author Topic: Background transparency  (Read 7282 times)

myst6re

  • *
  • Posts: 639
  • Light King of the Savegame - Field Master - FF8.fr
    • View Profile
    • FF8.fr
Background transparency
« on: 2010-04-16 22:57:22 »
Hello ! I found a difference between the PC version and the PS version, it's about four screens (kuro7, cosmo2, jtempl and trnad_1). In each sprites, one word coding for transparency can take four values: 0, 1, 2 or 3. This word is at offset 32 in PC sprites, and in "SpriteTP_Blend" (or Section 3) for the PS version:

On PC version

Code: [Select]
struct spriteInfos {
uint16 zz0; //Always 0
int16 destX;
int16 destY;
uint16 zz1; //Inused
uint16 zz2; //Inused
uint16 srcX_1;
uint16 srcY_1;
uint16 srcX_2;
uint16 srcY_2;
uint16 width; //Inused: 16,32 or invalid value
uint16 height; //Inused: 16,32 or invalid value
uint16 paletteID;
uint16 ID; //Maybe used for Z value
uint8 parameter;
uint8 state; //flag
uint8 blending; //Boolean
uint8 zz3; //Boolean
uint16 blendingType; <----- HERE
uint16 pageID1;
uint16 pageID2; //If pageID2 > 0, use srcX_2 and srcY_2
uint16 deph;
uint32 Z;
uint32 X; //Proportionnal to srcXs
uint32 Y; //Proportionnal to srcYs
uint16 zz4; //Always 0
};

On PS version (based on Cyb page)

Code: [Select]
struct spritePageInfos{
unsigned page_x:4; // LSB
unsigned page_y:1;
unsigned blendingType:2; <----- HERE
unsigned deph:2;
unsigned ZZ:7; // MSB
};

In the four screens, value of blendingType word is sometimes 2. In this case, there is no transparency by addition...

  • 0: average ((colorImg+colorNew)/2)
  • 1: additive blending (colorImg+colorNew)
  • 2: subtractive blending (colorNew-colorImg)
  • 3: 25% additive blending (colorImg+0.25*colorNew) [colne_3 -tv-|fship_5 -water-|min71 -tv-|nmkin_1 -buttons-|prisila -lamp-|ujunon4 & 5 -shine ocean-]

On PC, "blendingType=2" is always transparency by addition, but not on PS (left) :


Someone knows how to use blendingType?
« Last Edit: 2010-05-11 17:25:01 by myst6re »

Aali

  • *
  • Posts: 1196
    • View Profile
Re: Background transparency
« Reply #1 on: 2010-04-17 20:52:08 »
That is an excellent find!

Blend mode 2 is subtractive blending (color = destination color - source color) on the PS, on the PC version it is just plain broken and never used. I will try to add this feature to the custom driver :-)

myst6re

  • *
  • Posts: 639
  • Light King of the Savegame - Field Master - FF8.fr
    • View Profile
    • FF8.fr
Re: Background transparency
« Reply #2 on: 2010-04-17 21:53:48 »
Great! This is exactly what I wanted to ask you ;D.

titeguy3

  • *
  • Posts: 1283
  • A jack of all trades
    • View Profile
Re: Background transparency
« Reply #3 on: 2010-04-17 23:31:59 »
That is an excellent find!

Blend mode 2 is subtractive blending (color = destination color - source color) on the PS, on the PC version it is just plain broken and never used. I will try to add this feature to the custom driver :-)
This might fix certain graphical errors in the PC version, like the scene where cloud is floating before the bizarro sephiroth fight, where the background appears prematurely.

myst6re

  • *
  • Posts: 639
  • Light King of the Savegame - Field Master - FF8.fr
    • View Profile
    • FF8.fr
Re: Background transparency
« Reply #4 on: 2010-04-18 15:45:56 »
What happens when the value of blending2 is 3? I have not seen any difference with blending2=1, but I think there is one.

Theclad

  • *
  • Posts: 34
  • Idir - FFDream.com
    • View Profile
    • FINAL FANTASY DREAM - Webmaster
Re: Background transparency
« Reply #5 on: 2010-04-19 09:48:33 »
Great find, seriously I think if we found the real use of that, it can be the open door to the better idea we already channeled in brain ! :)

Aali

  • *
  • Posts: 1196
    • View Profile
Re: Background transparency
« Reply #6 on: 2010-04-19 14:30:49 »
What happens when the value of blending2 is 3? I have not seen any difference with blending2=1, but I think there is one.

Blend mode 3 is a weird one, in some PS emulators it's described as 25% incoming color, on the PC version of FF7 it's source alpha * source color + destination color, where source alpha is 25%.

I've never seen it used anywhere though, but if a field background uses it I could add support for that too.

myst6re

  • *
  • Posts: 639
  • Light King of the Savegame - Field Master - FF8.fr
    • View Profile
    • FF8.fr
Re: Background transparency
« Reply #7 on: 2010-04-20 08:25:30 »
I've never seen it used anywhere though, but if a field background uses it I could add support for that too.

Yes it is used. I made a complete list:
  • colne_3 & min71: tv
  • fship_5: drinking trough for chocobos
  • nmkin_1: buttons for opening doors
  • prisila: lamp
  • ujunon4 & 5: shine ocean

Aali

  • *
  • Posts: 1196
    • View Profile
Re: Background transparency
« Reply #8 on: 2010-04-25 21:02:37 »
I implemented it in palmer just to see how it would turn out and it does look a lot better in those few field scenes that use these different blend modes. The drinking trough no longer looks like a portal to another dimension, yay!

Implementing it in FF7 is going to be a tiny bit more difficult, but I should be able to get it done for the next release.

myst6re

  • *
  • Posts: 639
  • Light King of the Savegame - Field Master - FF8.fr
    • View Profile
    • FF8.fr
Re: Background transparency
« Reply #9 on: 2010-05-09 22:43:55 »
And for blend mode 0 ???? I think it is used, because it's the mode of the window of this store:

Aali

  • *
  • Posts: 1196
    • View Profile
Re: Background transparency
« Reply #10 on: 2010-05-11 15:29:49 »
Blend mode 0 is 50% incoming color, or in other words source and destination color averaged.
The PC version already supports this in the same way it supports additive blending, texture page 24 and up are assumed to use blend mode 0.

myst6re

  • *
  • Posts: 639
  • Light King of the Savegame - Field Master - FF8.fr
    • View Profile
    • FF8.fr
Re: Background transparency
« Reply #11 on: 2010-05-11 17:23:16 »
Thank you so much for all the help that thou hast given, the next version of makou reactor will opens Backgrounds better. (layer 3/4, default parameters, default z values and... blending ;) )