Jump to content


palette swaps via weidu?


  • Please log in to reply
30 replies to this topic

#21 bzm

bzm
  • Member
  • 13 posts

Posted 30 January 2024 - 08:05 AM

The job has been done.

 

Here is the "original" creature :

 

Ok, then how "exactly" can you repalette animations ;)? I have mine (or from bg2) and would like to import it into PSTEE.

 

These palettes seem to be a nightmare!



#22 Sam.

Sam.
  • Administrator
  • 1294 posts

Posted 30 January 2024 - 09:39 AM

Exactly which animation is it you're trying to bring to PSTEE?  How have you manipulated the original, if at all?  If the BAMs look fine in whatever BAM editor you're using, then the problem isn't the palette or the BAM files.  For that matter, which BAM editor?  The problem is in how the engine is interpreting them.  Look to the INI file that tells the engine how to interpret the animation.  Some setting there probably needs to be changed.  It sounds like the engine is expecting your animation to be of the special "paletted" variety (false color: for PST it's red air, yellow skin, etc.) but it's not, or vice versa.  Going from the special palette to truecolor has been done before.  The other way around, probably not.


"Ok, I've just about had my FILL of riddle asking, quest assigning, insult throwing, pun hurling, hostage taking, iron mongering, smart-arsed fools, freaks, and felons that continually test my will, mettle, strength, intelligence, and most of all, patience! If you've got a straight answer ANYWHERE in that bent little head of yours, I want to hear it pretty damn quick or I'm going to take a large blunt object roughly the size of Elminster AND his hat, and stuff it lengthwise into a crevice of your being so seldom seen that even the denizens of the nine hells themselves wouldn't touch it with a twenty-foot rusty halberd! Have I MADE myself perfectly CLEAR?!"

--<CHARNAME> to Portalbendarwinden

--------------------

post-10485-0-15080600-1348188745.jpg
___________Old pen and paper modules of the 70s and 80s.___________

CA Forums CA Homepage


#23 bzm

bzm
  • Member
  • 13 posts

Posted 30 January 2024 - 10:20 AM

Let's say import a frost salamander from iwd (and bg2). Or change the color from black abishai to white (I did that, but for the horns I have to change each palette for each bam, in bamworkshop2 otherwise the pixels are miss placed ?)
 
Hmm, ok so it is the fault of the interpretation of the engine and the base colors of the animation?
 
I thought you can cast a palette on several animations of the same creature and it will adjust :D.
 
akrY9rs.jpg
 
4tdDFcT.jpg
 
 
E: i found this:

Spoiler

...


Edited by bzm, 30 January 2024 - 10:39 AM.


#24 Sam.

Sam.
  • Administrator
  • 1294 posts

Posted 30 January 2024 - 12:31 PM

I'm still not sure I follow what it is you're doing, with which tools, and where things are going wrong.  Let me back up a bit and make sure we're clear on what it means to swap a palette.  When you're changing a file's palette for a different palette, there are two ways to go about it.

 

Option 1 is to directly overwrite the first palette with the second one.  The pixels themselves with stay the same, they'll just be pointing to a different color.  Changing the palette colors individually with NI or BAMWorkshop (II) is essentially doing this.  Say you edit the palette colors of the first BAM in a creature animation so that the animation now looks the way you want, and you want to apply those changes to the other BAMs for that creature.  It is okay to overwrite the palettes of the other BAMs with your edited one if and only if those other BAMs used  the exact same palette as the original one before you edited it.  If not, the colors will look garbled.

 

Option 2 is to remap the pixel values from the first palette to the second so that each pixel is pointing to the new palette color that is as close as possible to the old palette color.  If you edited the first BAM's palette as before and then tried remapping the other BAMs to use the new palette, the results will be terrible because each new pixel value is trying to match the original color.  The intent of you editing the palette to change the creature's color will be lost.

 

So, if a creature animation has multiple BAMs that don't all use the same palette, how do you apply manual palette edits in one palette to all the BAM?  The answer is that you must remap all the BAMs to use the same palette, make your edits, and then overwrite all the palettes with the new one.  To minimize error, color information from all the BAMs should be quantized together at once to generate an optimal palette to start with.  This makes the whole process many stepped.


"Ok, I've just about had my FILL of riddle asking, quest assigning, insult throwing, pun hurling, hostage taking, iron mongering, smart-arsed fools, freaks, and felons that continually test my will, mettle, strength, intelligence, and most of all, patience! If you've got a straight answer ANYWHERE in that bent little head of yours, I want to hear it pretty damn quick or I'm going to take a large blunt object roughly the size of Elminster AND his hat, and stuff it lengthwise into a crevice of your being so seldom seen that even the denizens of the nine hells themselves wouldn't touch it with a twenty-foot rusty halberd! Have I MADE myself perfectly CLEAR?!"

--<CHARNAME> to Portalbendarwinden

--------------------

post-10485-0-15080600-1348188745.jpg
___________Old pen and paper modules of the 70s and 80s.___________

CA Forums CA Homepage


#25 bzm

bzm
  • Member
  • 13 posts

Posted 30 January 2024 - 01:13 PM

The answer is that you must remap all the BAMs to use the same palette, make your edits, and then overwrite all the palettes with the new one.  To minimize error, color information from all the BAMs should be quantized together at once to generate an optimal palette to start with.  This makes the whole process many stepped.

 

Hm, I think I understand, although not completely. How would I remap the BAMs? What do you mean?



#26 Sam.

Sam.
  • Administrator
  • 1294 posts

Posted 30 January 2024 - 03:39 PM

The answer is that you must remap all the BAMs to use the same palette, make your edits, and then overwrite all the palettes with the new one.  To minimize error, color information from all the BAMs should be quantized together at once to generate an optimal palette to start with.  This makes the whole process many stepped.

 

Hm, I think I understand, although not completely. How would I remap the BAMs? What do you mean?

Looking, BAMWorkshop doesn't appear to be able to replace palettes.  BAMWorkshop II can, and it overwrites the palette not remap it.  I just checked Near Infinity, and I think it remaps the palette so that's one option.  I'm biased as I wrote the tool, but if it was me I would use PS BAM (here's the forum) as it can batch multiple files at once and can both overwrite and remap palettes.  However, it is command line only.

 

I'll provide a practical example of how to use PS BAM.  Download PS BAM from GitHub and extract the entire contents into whichever folder you like.  Go get mdr11100.bam from here.  Also extract MDR1_AQ1.bmp from BG2 or BG2EE and put it in the same folder.  Create a windows batch file (*.bat) in the same folder and put the following in it:

"C:\Path\To\PS BAM_x64.exe" ^
--CompressionProfile Recommended ^
--DropDuplicatePaletteEntries 0 ^
--DropUnusedPaletteEntries 0 ^
--DebugLevelL 1 ^
--DebugLevelP 2 ^
--DebugLevelS 1 ^
--ReplacePalette "%~dp0MDR1_AQ1.bmp" ^
--ReplacePaletteMethod Force ^
--ExportPalette PAL ^
--LogFile "%~dp0Log.txt" ^
--OutPath "%~dp0repaletted" ^
--Save "BAM" ^
"%~dp0MDR11100.bam"

pause
exit

Change the path to PS BAM to wherever you extracted it.  Save and run the batch file.  This will load the BAM, replace/overwrite the palette with the aqua dragon color variant, and compress and save the new BAM.  If instead you want to remap the palette (not what you want to do in this particular case), instead of

--ReplacePaletteMethod Force ^

use

--ReplacePaletteMethod Remap ^

 

You can use wildcards in the filename of the BAMs to process multiple in one go.


"Ok, I've just about had my FILL of riddle asking, quest assigning, insult throwing, pun hurling, hostage taking, iron mongering, smart-arsed fools, freaks, and felons that continually test my will, mettle, strength, intelligence, and most of all, patience! If you've got a straight answer ANYWHERE in that bent little head of yours, I want to hear it pretty damn quick or I'm going to take a large blunt object roughly the size of Elminster AND his hat, and stuff it lengthwise into a crevice of your being so seldom seen that even the denizens of the nine hells themselves wouldn't touch it with a twenty-foot rusty halberd! Have I MADE myself perfectly CLEAR?!"

--<CHARNAME> to Portalbendarwinden

--------------------

post-10485-0-15080600-1348188745.jpg
___________Old pen and paper modules of the 70s and 80s.___________

CA Forums CA Homepage


#27 bzm

bzm
  • Member
  • 13 posts

Posted 30 January 2024 - 10:19 PM

Nice I will try. But one thing bothers me. How to extract .bmp. I tried DLTCEP and when I save the palette as a bmp, there is no file anywhere...

 

E: The above bam is empty and that bmp in NI contains nothing :P.

 

E2: Right, so i'am using palette generator and ps bam, something is starting to come out...

 

E3: It seems that after importing the new BAM animations, with their own color (and the palettes a little mixed up) it looks fine in the game anyway xD.

 

So. I don't know anything. 


Edited by bzm, 31 January 2024 - 02:18 AM.


#28 Sam.

Sam.
  • Administrator
  • 1294 posts

Posted 31 January 2024 - 08:02 AM

Nice I will try. But one thing bothers me. How to extract .bmp. I tried DLTCEP and when I save the palette as a bmp, there is no file anywhere...

 

E: The above bam is empty and that bmp in NI contains nothing :P.

 

E2: Right, so i'am using palette generator and ps bam, something is starting to come out...

 

E3: It seems that after importing the new BAM animations, with their own color (and the palettes a little mixed up) it looks fine in the game anyway xD.

 

So. I don't know anything. 


I recommend exporting MDR1_AQ1.bmp from the game using Near Infinity since you're apparently already using it.  This BMP may outwardly appear to only have a single green pixel, but we don't care about that.  It is an indexed 8-bit per pixel paletted windows bitmap.  It's the internal palette we'll be using, not the single pixel.  The BAM I pointed you to is certainly not empty.  Download the raw file.  Follow my simple example until you get it right before adding more complexity.  I have no idea what you're on about with E3.


"Ok, I've just about had my FILL of riddle asking, quest assigning, insult throwing, pun hurling, hostage taking, iron mongering, smart-arsed fools, freaks, and felons that continually test my will, mettle, strength, intelligence, and most of all, patience! If you've got a straight answer ANYWHERE in that bent little head of yours, I want to hear it pretty damn quick or I'm going to take a large blunt object roughly the size of Elminster AND his hat, and stuff it lengthwise into a crevice of your being so seldom seen that even the denizens of the nine hells themselves wouldn't touch it with a twenty-foot rusty halberd! Have I MADE myself perfectly CLEAR?!"

--<CHARNAME> to Portalbendarwinden

--------------------

post-10485-0-15080600-1348188745.jpg
___________Old pen and paper modules of the 70s and 80s.___________

CA Forums CA Homepage


#29 bzm

bzm
  • Member
  • 13 posts

Posted 31 January 2024 - 08:35 AM

Yea, PS BAM repaletted the dragon, from red to teal/green.
 
And how do I create my own palette? Isn't PST different to BG etc. - If I want to import BAM from BG to PST? (Yes i know that animations seq in both games are different,.. that's not the problem here ;)
 
(E3, if you import totally new animation, as BAM - colors in game are the same as in the png or something before import to game. I ask myself: is it need for palette in that case?)

Edited by bzm, 31 January 2024 - 08:46 AM.


#30 Sam.

Sam.
  • Administrator
  • 1294 posts

Posted 31 January 2024 - 11:02 AM

Are you asking about taking a false color (aka "paletted" - yes I know the language is ambiguous) character animation that implements the colors specified on the creature and equipped items like

post-10485-0-94146600-1542071897.png

and converting it to the PST equivalent?  If so, the formats are different "under the hood" and there is no 1:1 mapping.  I'm not aware of anyone attempting this conversion before, and even if you managed a rough approximation the results would almost surely be sub-optimal.


"Ok, I've just about had my FILL of riddle asking, quest assigning, insult throwing, pun hurling, hostage taking, iron mongering, smart-arsed fools, freaks, and felons that continually test my will, mettle, strength, intelligence, and most of all, patience! If you've got a straight answer ANYWHERE in that bent little head of yours, I want to hear it pretty damn quick or I'm going to take a large blunt object roughly the size of Elminster AND his hat, and stuff it lengthwise into a crevice of your being so seldom seen that even the denizens of the nine hells themselves wouldn't touch it with a twenty-foot rusty halberd! Have I MADE myself perfectly CLEAR?!"

--<CHARNAME> to Portalbendarwinden

--------------------

post-10485-0-15080600-1348188745.jpg
___________Old pen and paper modules of the 70s and 80s.___________

CA Forums CA Homepage


#31 bzm

bzm
  • Member
  • 13 posts

Posted 31 January 2024 - 11:50 AM

I don't think I know what I'm saying anymore xD. 

 

Something has been clarified, some things are still a mystery. But that's ok.

 

Thanks!