I’m looking to create a means of using palettized colors to replace r/g/b/a values in textures. I’ve began tinkering around with global shader variables to define colors to call up in the shaders, but then I realized I was missing something:
Let’s say that, in theory, I had 16 colors to choose from and 4 colors used per object. If I wanted to support every possible combination of colors, I’d need 65536 different shaders, each built with each combination of colors.
To be specific, I’m currently using Shader.SetGlobalColor() from a script to be able to define the colors used in the palette, so that modifying one would actively update the shaders without going in and tweaking them by hand.
So, my question is: Is there any way to have global shader variables available for use like this, but then which ones are called by an object/material is determined through a material (or even script), or would it only be possible by using global variables (non-shader) and updating the color per object for every object every time the palette’s color changes?