egg-palettize: how do I get a single image on multiple?

I’m trying to do some scene graph optimization on the game that I’m working on. There are multiple different environments, but the environments share a number of the same assets that are placed in them. I’d like to be able to take most of my static objects, which are pretty low poly, and flattenStrong them together. Of course, each object has it’s own independent texture, so i’d like to palettize them all together, but with the caveat that I’d like to place them in the same group as each of the environment models. So, for example, I have:

:group sceneA1 dir models/sceneA
:group sceneA2 dir models/sceneA

sceneA1.egg : sceneA1
sceneA2.egg : sceneA2

hill.egg : sceneA1 sceneA2
chair.egg : sceneA1 sceneA2

which produces 2 palette files:

that contain the individual textures for the scenes, but I’d like them to also both contain the textures for hill and chair. Currently, with this set up, the textures for chair and hill get placed on one of the two textures, seemingly randomly (albeit deterministically - I don’t know how it chooses one or the other, but it is consistent).

I’ve tried a couple different methods of setting up groups using the ‘on’ and ‘includes’ commands, but I thought this setup would be the most direct about what I was trying to do and hoped it would give the result that I wanted to achieve.

Given all that, how would I get egg-palettize to do what I want?

Consider what you’re asking: textures from hill.egg need to be on both sceneA1_palette and sceneA2_palette. OK. But which image file will the newly palettized hill.egg actually reference? The egg file has to name one texture or the other, it can’t say “use this texture or this one, whichever you happen to have loaded.”

So, you’ll need to have two egg files, hillA1.egg and hillA2.egg. Similarly for chairA1.egg and chairA2.egg, and so on. These can be identical before you run them through egg-palettize, but egg-palettize will modify them differently. Obviously, assign one of them to sceneA1 and the other one to sceneA2.