Open LunaMoo opened 2 years ago
This is absolutely possible, although quite a bit of implementation work - currently no code in texture replacements knows much about palettes at all, as replacements are currently assumed to be full-color. You'd then be authoring higher-resolution-but-still-8-bit paletted pngs (or similar) as replacements and we'd probably want to re-apply the palette in a shader if it changes a lot.
There is also an issue of color interpolation on full color isn't? thus replacing with exact color palette might missed some gradient area, while on 8-bit color usually gradient-like texture are done using dithering thus can be replaced without causing a weird color-gradation around the replaced color if the color replacement were distinct.
The best way to replace full color with gradient possibility is by separating the replaceable color/texel on a different layer than the non-replaceable colors, and blend them together after the replacement, thus worked well even on edges that may have gradation, but going to cost more storage/space.
I don't think color limitation is much of a problem since this is about quite uncolorful textures(like skin or simple objects ie parts of armor) or even small parts of textures(like in UI textures), palettes set for such are very concentrated on whatever colors are needed, then it swaps palette for another and another as it needs to. You wouldn't be limiting it more than the game already does without any replacement which tend to be nice color wise, just very low res.
Ah yes, i missed the "higher-resolution-but-still-8-bit paletted pngs (or similar) as replacements" :D i guess swapping the palette should works as long the replacement texture is still using 8-bit.
Well, it sounds like fixing this use case would actually ignore the palette of the replacement. So a trick would also be the author being able to keep the color indices in the same order - many image editing tools might make that hard.
Maybe the best option would be a "color map" file, which indicates which RGB values are which index. This means it could be any depth of PNG - as long as the colors are all in the map. Then it could use the game's selected palette. It'd have to reject, or else snap-to-closest, any colors not in the palette file.
Knowing when to generate/export such a file might be another trouble spot, since it's likely not the common case. Seems like a lot of potential for confusion here...
-[Unknown]
I think it's not that confusing, I mean it would be if every user had to do it themselves, but it seems most people who are creating texture packs are a bit more competent.
It's usually very easy to recognize textures which use different palettes for different sprite as those are saved with many duplicates that differ by clut hash, but share texture hash. Special case are textures which color can be affected by user in-game which typically involves some kind of RGB sliders or color selection window, It technically can be replaced right now, but it involves soo many color combinations it's just unrealistic. If someone is making a texture pack, they either like the game and know it has such feature or will get report from users, that changing colors from defaults disables replacement.
What should happen
Not sure how to call it, but there are many games which use various colour palletes for a single texture, this generates duplicates, but in most cases while annoying it's not much of a problem as it's usually just for UI and can still be replaced by one texture easily by combining them all into different layers and showing only the element in the correct color then merging into one.
There are however cases where game allows user to pick RGB palette for character skin or various objects in-game and with texture replacement we have a choice between replacing only a very specific set of colors, or ignoring palette and replacing all colors with single colour hi-res texture.
So potentially would it be possible to get a feature in PPSSPP to replace textures and apply original color palette?
Who would this benefit
Mostly players of games which have character or object customization, but it could make some things like UI which also tend to have multiply color palettes for single big image easier to replace.
Games this would be useful in
NPJB40001 - Monster Hunter Portable 3rd HD Ver., NPJH50878 - Toukiden Kiwami, pretty much any with color customization, or featuring large UI textures with many objects using different palettes.
Checklist