PaletteSwap.zip (548.6 KB)
This zip has some examples and helper scripts.
It’s based on this article
If you want to palette swap more efficiently you should do it in the render script. This is useful for swapping all colors on the screen for example.
Your sprite materials need a nearest texture_sampler set like in the example.
If you want to swap a specific sprite you can see how to do it in the zip. It also shows how to support multiple palettes. But this will add drawcalls for each sprite potentially?
This method should work on 3d models that use nearest texture_sampler too.
There are two helper scripts one is meant to generate the greyscale image as well as the palette image. You edit the palette image to add more rows. Then use the other helper script to generate uniforms from the modified palette image. Then you can use those uniforms to set the active palette for a sprite/model/render predicate.