Staredit Network > Forums > Modding Discussion > Topic: AlphaEdit
AlphaEdit
Sep 6 2009, 4:03 pm
By: Clokr_  

Sep 6 2009, 4:03 pm Clokr_ Post #1



I don't think there's any utility to compile/decompile alpha blending tables, so I made my own :)
Although only console mode for now :P

AlphaEdit: [attach=4468]
Tileset palette pack (including alpha palettes): [attach=4469]

Code
AlphaEdit          by Clokr_


Usage:

  AlphaEdit c/d tileset.wpe alpha.wpe alpha.pcx [params]
     c   Compile alpha.pcx from tileset.wpe and alpha.wpe
     d   Try to decompile alpha.wpe from tileset.wpe and alpha.pcx
  AlphaEdit m result.wpe pal1.wpe pal2.wpe ...
     m   Calculate the mean of the .wpe palettes


  Compile options:

     height:n         Height of the resulting pcx palette (def 255)

  Decompile options:

     alpharange:n,m   Range of colors used to calculate the alpha value
                      (def 0,255)
     alphatol:n       Only colors whose components differ more than n will
                      be used to calculate alpha (def 50)
     clrtol:n         If alpha is greater than 1-1/n then the black color (0)
                      will be copied to the resulting alpha palette (def 255)


The utility has two main modes: Compile and Decompile.

Compile mode:
Generates a alpha blending table in .pcx format from the tileset .wpe palette and a secondary alpha palette in .wpe format which also contains alpha information. I'm not sure whether there is any utility which allows the edition of the alpha information of a .wpe palette, but if there is not you can bug farty until he decides to update PalEdit :P.
The mode is pretty straightforward. Also note that the color 0 of a alpha palette is not used (transparent) and will be ignored while translating the palette to the .pcx table.

Decompile mode:
In this mode AlphaEdit will *try* to extract the secondary alpha palette from the data in the tileset palette (.wpe) and the alpha blending table (.pcx). This is not always possible because some information is lost while creating the blending table, so some resulting colors might look glitchy (specially the ones with very high alpha values, although those will become almost transparent so the result will still be good if a new alpha blending table is compiled from these palettes).
The options are internal parameters for the decompression algorithm, which won't usually have to be changed. You can play with them to try to archieve better results.

Extra modes:

Mean mode:
AlphaEdit will calculate the average palette from a list of .wpe palettes. This mode might be usefull to merge the decompiled alpha palettes.

If anyone wants to decompile all the tileset palettes at once, uncompress all the .wpe and .pcx tileset files into a dir (make sure they still have the original path .\tileset\ashworld\bexpl.pcx, etc), copy AlphaEdit into the dir and copy this code into a .bat file:
Collapsable Box


Here's an example of the grp tbangx.grp, which uses the bexpl.pcx alpha blending table. It has been decompressed using SFGrpConv and the bexpl.wpe palette obtained with this utility. Notice that the border color is glitchy, because it's almost transparent, but for the very same reason it won't be noticeable if the palette is compiled back into a alpha blending table. (Merging the resulting palettes fixed the border color :) ) Also notice that this picture has no alpha information, i.e., it displays how would the explosion look if it was completely opaque.


Attachments:
AlphaEdit.zip
Hits: 8 Size: 11.88kb
palettes.zip
Hits: 11 Size: 12.81kb

Post has been edited 5 time(s), last time on Sep 7 2009, 2:48 pm by Clokr_.



?????

Sep 6 2009, 4:25 pm Excalibur Post #2

The sword and the faith

Looks very nice and very useful, even if very few are going to use it. It reminds me of one of Farty's tools really.

GJ Clokr_ :)




SEN Global Moderator and Resident Zealot
-------------------------
The sword and the faith.

:ex:
Sector 12
My stream, live PC building and tech discussion.

Sep 6 2009, 4:29 pm Clokr_ Post #3



Thanks.

I'd be good to make a compilation of all the .wpe palettes (including the ones resulting from the reindex tables and from the alpha tables) for grp edition/viewing purposes.

Also if anyone wants the source code I can post it. It's written in C++.

Post has been edited 1 time(s), last time on Sep 7 2009, 11:26 am by Clokr_.



?????

Sep 7 2009, 2:28 am KooKsTeR Post #4



wait so this makes it so i can get all the different palettes? TIME SAVER!!!!



None.

Sep 7 2009, 12:40 pm Symmetry Post #5

Dungeon Master

Quote from Clokr_
Thanks.

I'd be good to make a compilation of all the .wpe palettes (including the ones resulting from the reindex tables and from the alpha tables) for grp edition/viewing purposes.

Also if anyone wants the source code I can post it. It's written in C++.

I thought Farty's PalPack included all of those?



:voy: :jaff: :voy: :jaff:

Sep 7 2009, 1:12 pm Clokr_ Post #6



Quote from Symmetry
Quote from Clokr_
Thanks.

I'd be good to make a compilation of all the .wpe palettes (including the ones resulting from the reindex tables and from the alpha tables) for grp edition/viewing purposes.

Also if anyone wants the source code I can post it. It's written in C++.

I thought Farty's PalPack included all of those?

I have no idea. Any link to the PalPack? Still I was not only talking about the tileset .wpes but also about the alpha .wpes.



?????

Sep 7 2009, 1:34 pm Symmetry Post #7

Dungeon Master

Oh, maybe I remembered incorrectly. PalPack doesn't seem to include .wpe files at all.

http://www.staredit.net/maplantis/index.php?sid=684f05dbbe;mod=452 (If you still want it)



:voy: :jaff: :voy: :jaff:

Sep 7 2009, 2:43 pm Clokr_ Post #8



I've updated AlphaEdit and included the resulting .wpe palettes in a .zip file in the first post. Note that the resulting palettes are tileset-independent (except for trans50, which is not included). That means that if you paint using those palettes the resulting grp should work well in all the tilesets, using the default SC .pcx alpha tables.

EDIT: Also updated the example picture with the resulting bexpl.wpe palette.

Post has been edited 1 time(s), last time on Sep 7 2009, 2:48 pm by Clokr_.



?????

Feb 17 2010, 2:34 pm O)FaRTy1billion[MM] Post #9

👻 👾 👽 💪

Quote from Clokr_
Also if anyone wants the source code I can post it. It's written in C++.
Do want. ;o



TinyMap2 - Latest in map compression! ( 7/09/14 - New build! )
EUD Action Enabler - Lightweight EUD/EPD support! (ChaosLauncher/MPQDraft support!)
EUDDB - topic - Help out by adding your EUDs! Or Submit reference files in the References tab!
MapSketch - New image->map generator!
EUDTrig - topic - Quickly and easily convert offsets to EUDs! (extended players supported)
SC2 Map Texture Mask Importer/Exporter - Edit texture placement in an image editor!
\:farty\: This page has been viewed [img]http://farty1billion.dyndns.org/Clicky.php?img.gif[/img] times!

Options
  Back to forum
Please log in to reply to this topic or to report it.
Members in this topic: None.
[11:50 pm]
O)FaRTy1billion[MM] -- nice, now i have more than enough
[11:49 pm]
O)FaRTy1billion[MM] -- if i don't gamble them away first
[11:49 pm]
O)FaRTy1billion[MM] -- o, due to a donation i now have enough minerals to send you minerals
[2024-4-17. : 3:26 am]
O)FaRTy1billion[MM] -- i have to ask for minerals first tho cuz i don't have enough to send
[2024-4-17. : 1:53 am]
Vrael -- bet u'll ask for my minerals first and then just send me some lousy vespene gas instead
[2024-4-17. : 1:52 am]
Vrael -- hah do you think I was born yesterday?
[2024-4-17. : 1:08 am]
O)FaRTy1billion[MM] -- i'll trade you mineral counts
[2024-4-16. : 5:05 pm]
Vrael -- Its simple, just send all minerals to Vrael until you have 0 minerals then your account is gone
[2024-4-16. : 4:31 pm]
Zoan -- where's the option to delete my account
[2024-4-16. : 4:30 pm]
Zoan -- goodbye forever
Please log in to shout.


Members Online: Roy, l)ark_ssj9kevin, Oh_Man