Transparency on new animations?

NOTICE: This forum is archived as read only.
Please use the Github Discussions at https://github.com/exult/exult/discussions
Forum rules
NOTICE: This forum is archived as read only.
Please use the Github Discussions at https://github.com/exult/exult/discussions
Locked
Knight Captain
Posts: 1219
Joined: Thu May 14, 2020 1:34 pm

Transparency on new animations?

Post by Knight Captain »

I'm trying to convert the red fire field into a green flame for AgentOrangeMan.

As with prior recolors, I used ImageMagick to swap specific colors for others:
magick convert 895_fire_field_%02d.png[0-15] -fill #14a400 -opaque #dc1428 -fill #1cc000 -opaque #e06c00 -fill #28dc00 -opaque #fc7c00 -fill #38fc00 -opaque #ecc828 -fill #50fc28 -opaque #ecd050 -fill #6cfc54 -opaque #fcac5c -fill #8cfc80 -opaque #f0dc78 -fill #b0fcac -opaque #f4e4a4 -fill #d8fcd8 -opaque #f8f0cc -fill #28dc00 -opaque #5c5cfc -fill #1cc000 -opaque #fc9c3c -fill #14a400 -opaque #fc8c1c -define png:preserve-colormap=true green_flame_%02d.png[0-15
This works rather nicely, except that the new PNGs need to be put back into Indexed Color via GIMP.

But somewhere along the way, the multiple "white" colors of #fcfcfc seem to cause a problem. There are four of these used in the palette, so the imported frames seem to be stuck on the first one. There are two for "magic blue" and "magic red" as well as a yellow-tinted transparency that I want to use.

I've tried tinkering with the palette prior to exporting the images from GIMP, but I can't seem to find the right way to do this. How do I keep the proper transparency?
Knight Captain
Posts: 1219
Joined: Thu May 14, 2020 1:34 pm

Re: Transparency on new animations?

Post by Knight Captain »

Grafx2 also shows I'm using the right color in the palette list.
Dominus
Site Admin
Posts: 5656
Joined: Thu May 14, 2020 1:34 pm

Re: Transparency on new animations?

Post by Dominus »

It's been a while and I remember it not being easy. And I'm not entirely sure, but in the palette the last 15 colors are transparent with the transparent colors being:
1 yellow
2 blue
3 bright green
4 bright red
5 purple
6 dark brown
7 very bright green
8 grass green
9 dark yellow/bright orange
10 blue (white color underneathi it turns black)
11 dark green
12 red
13 white
14 dark gray
15 bright gray

BUT the colors you see in the palette do not match those :)
Take a look at the transparent shortcutbar icons. All the sb_???.shp files in https://github.com/exult/exult/tree/master/data
--
Read the documentation and the FAQ! There is no excuse for not reading them! RTFM
Read the Rules!
We do not support Piracy/Abandonware/Warez!
Knight Captain
Posts: 1219
Joined: Thu May 14, 2020 1:34 pm

Re: Transparency on new animations?

Post by Knight Captain »

Interesting that the palette that comes with a SHP file is different than the one included in an export of frames to PNG. From a quick look, not only are the whites just slightly different colors, but every single color has a different HTML notation number. The last 8 colors are totally different as well.

So I'll take another crack at it.

It looks like the Palettes.FLX file is used as the color map for the PNG exports, but it may be better off using the same one that SHP files use.
Dominus
Site Admin
Posts: 5656
Joined: Thu May 14, 2020 1:34 pm

Re: Transparency on new animations?

Post by Dominus »

Yes, sorry for not mentioning this, but you have to make sure you use the shp palette. And then the problem was that the automatic color assigning likes to use the transparent colors or the color cycling colors ...It was driving me nuts ;)
--
Read the documentation and the FAQ! There is no excuse for not reading them! RTFM
Read the Rules!
We do not support Piracy/Abandonware/Warez!
Knight Captain
Posts: 1219
Joined: Thu May 14, 2020 1:34 pm

Re: Transparency on new animations?

Post by Knight Captain »

It seems the main thing that tripped me up here was Exult Studio exporting PNGs with approximately Palette 0, rather than the one that should be used.

Would it be possible to get the Exult Studio Export feature to use the correct palette for PNGs? It would make a difference in speeding up the recoloring process.

It looks like the correct export to PNG steps currently are to:
Use ES to export the given shape as a SHP.
Open that SHP in GIMP with the plugin.
Use GIMP to save each frame, using gimp-plugin-export-layers.

From there, the usual ImageMagick steps should work.

I created a local HTML page with all the correct-for-editing colors, as well as a table with the approximate light-dark equivalents for swapping.
Knight Captain
Posts: 1219
Joined: Thu May 14, 2020 1:34 pm

Re: Transparency on new animations?

Post by Knight Captain »

I'm still not getting the expected results. Even if the colors are the same between the original and new shapes, and the settings are the same, I get different results.

Now I'm getting a transparent blue when I am expecting a transparent orange.

The Translucent flag has to be set on the shape, but without it that cycles orange, rather than blue.
Knight Captain
Posts: 1219
Joined: Thu May 14, 2020 1:34 pm

Re: Transparency on new animations?

Post by Knight Captain »

Is it possible the engine is selecting the transparent color based on nearby pixels in the same shape?
Knight Captain
Posts: 1219
Joined: Thu May 14, 2020 1:34 pm

Re: Transparency on new animations?

Post by Knight Captain »

Here's a video of the Translucent vs. Transparent results, with the Quality Flags set on both test shapes:
Image

Direct link: https://i.imgur.com/ZqRuwD6.mp4

Both of the flame shapes are set to Translucent only.

Is this stuff documented?
Knight Captain
Posts: 1219
Joined: Thu May 14, 2020 1:34 pm

Re: Transparency on new animations?

Post by Knight Captain »

I'm even more confused now. I went back to the palette that Exult Studio gives to Exported Frames (PNGs) and setup test shapes with the same settings, Translucent vs. Transparent. I now have even more colors than I expected. Isn't Ultima 7 limited to 256 colors at once?

https://i.imgur.com/i1C5VQ0.mp4

Image
Dominus
Site Admin
Posts: 5656
Joined: Thu May 14, 2020 1:34 pm

Re: Transparency on new animations?

Post by Dominus »

can you upload the shapes, so I can have a go at it?
--
Read the documentation and the FAQ! There is no excuse for not reading them! RTFM
Read the Rules!
We do not support Piracy/Abandonware/Warez!
Knight Captain
Posts: 1219
Joined: Thu May 14, 2020 1:34 pm

Re: Transparency on new animations?

Post by Knight Captain »

So it turns out that ImageMagick has documented switches that were never implemented, if I'm reading this thread correctly:
https://www.imagemagick.org/discourse-s ... e+colormap

That would explain why even with the "correct" command line options, it truncates the palette per PNG to only the colors used in the image.

So when those PNGs are put back into the correct U7 palette, since there are multiple uses of #fcfcfc the first one is always picked, and that is not transparent.
Knight Captain
Posts: 1219
Joined: Thu May 14, 2020 1:34 pm

Re: Transparency on new animations?

Post by Knight Captain »

Looking at the Kylista shape (SI#560) on Frame 9 there is at least one square with color #867a43. But that isn't part of the usual palette.

There's other "unfinished" bits of her shape as well.
Red hands on several frames.
The sitting frame, 10, has a pixel in the lower right corner.
The sleep frame, 13, has extra pixels under the foot.
Frame 14 has color #8c6743, also not in the palette.
And a few more oddities.
Knight Captain
Posts: 1219
Joined: Thu May 14, 2020 1:34 pm

Re: Transparency on new animations?

Post by Knight Captain »

[url=https://www.imagemagick.org/discourse-s ... 49#p163749]I bumped this topic on the ImageMagick.org forum today[url].

The alternative way we could handle this would be to export using the SHP format palette, which has no duplicates. The whites used a just a shade or two different.
Locked