IAmBatby / Tremor

Tremor mod, for tModLoader Terraria
38 stars 23 forks source link

Wrong transparency color used in sprites #46

Open WARUMBERG opened 6 years ago

WARUMBERG commented 6 years ago

tModLoader v0.10.1.1 Tremor v1.3.2.7

Here's easy one, Due to differences in .NET 4.x and XNA implementations across various systems some players see big blocks of white color instead of fully transparent color. The solution to this is to use single, properly supported transparency color, just like stock Terraria does do, The HTML/HEX code of correct transparency is 00000000. (just 0 for short) The HTML/HEX code of inproper transparency color which causes issues is FFFFFFFF.

To solve this just use any image editing tool with support for Large Batch/Multipicture edit, like Adobe Photoshop or Imagemagick or Nconvert, to change Color FFFFFFFF to Color 00000000 on all sprite files within given folder location. Here's example tutorial how to do it in Photoshop, for the other tools it should be simpler, https://marckean.com/2011/12/18/use-photoshop-batch-to-process-all-photos-in-a-folder/

Jofairden commented 6 years ago

Actually, I can make code to support transparency. Thanks though

WARUMBERG commented 6 years ago

Like some global function for it that would affect even other mods as long as one runs Tremor? It would be excellent since mods like Thorium or Calamity are affected by it too, some of the sprite authors put correct transparency in them and others don't. My multiplayer pal that plays on Linux via Wine got this issue and I can reproduce it as well when I reboot to Win XP SP3 32bit, while it doesn't happen on Win 7 64bit on the same machine.

Jofairden commented 6 years ago

Yes. The big difficulty is getting all the textures. Basically some art programs save the file with every pixel having an RGBA where RGB is bigger than 0 but A may be 0 , where A would usually be transparency there, in XNA's texture loading the alpha channel is independent , and with terraria's draw mode it actually can do awesome things. In terraria, A channel signals additive<---> opaque A pixel with 255 alpha draws fully opaque, a pixel with 0 alpha draws fully additive So if you do say, 255,0,0,0 color, it would draw a fully additive red Which can be awesome...except when your file saves the alpha channel of supposedly transparent pixels wrong. I already have a utility function that multiplies by alpha which solves the issue.

WARUMBERG commented 6 years ago

I already have a utility function that multiplies by alpha which solves the issue.

Sound awesome, if you make it to fix the transparency issues globally and provide a build of .tmod for it then I can get it tested right away on my second os XP and on my pals Linux.