I've been trying to find an answer for this for a week.Ĭhroma key effect used for removing colors but you can change colors Instead of removing them.Ĭhroma key compositing, or chroma keying, is a visual effects / post-production technique for compositing (layering) two images or video streams together based on color hues (chroma range). I could just write a script that does this and generates a new spritesheet with the swapped colors, but managing one spritesheet per character variation (we aim to have 10 variations per character) is really problematic for our workflow. The goal here is to do this on a shader in real time. swap every single reddish color within a tolerance range with a newly defined color). Since color indexing is not really an option (unless I want to create a really big color index texture with a gazillion colors) I was wondering if there was a way to create a shader that, given a set of "base colors" and an equivalent color palette, swaps every "similar color" of the character with the color from the new palette (i.e. We use around 10-15 base colors for our characters but each character has tons of different shades and saturation variants to their base color on every frame (again, the art is brush-painted like). The big problem is that since every single sprite is hand-drawn and hand-painted with different brushes there are no "traditional" color palettes defined for our base sprites. So far i worked around that issue by shifting the hue programmatically, that simulates palette swapping very well but its not the real thing.I´m trying to build a tool inside Unity that allows our artists to create different color palettes for our characters. I looked to color correction ramp Unity effect and that's close to what i'd need.īut it uses the entire camera, while i'd need to apply that to sprites only.Īlso, if someone can point me a good way to extract colors from a texture (lets say with photoshop) and save them as a source for the indexed colors (like color correction ramp works) i'd be grateful. I think the best solution is to extract an indexed source of the all colors used by the texture, and use a shader (or whatever) which can reference the colors by indexes replacing them from another indexed source.Īnd it must work with bilinear filtering too, because point filter gives bad results with hi res textures. Again, this is because we are not really dealing with flat colors, but with a lot of brush shades instead. I already tried some shader which actually let you choose the source/destination color and they do what they claim, but this is not enough accurate to achieve a good result:īecause of bilinear filtering you easily get artifacts, and, most of all, the color swap is very inaccurate, even using different shade tolerance values. Now, for the palette swap, what i'd need is a way to get a list of colors and change them in my default texure. Basically even if you're using a few colors to fill the image, the brush mark is made by a lot of different pixels, each of which with his own shade/alpha variation, which makes really hard to swap it in a very accurate way.Ĭould result in a very high range of colors if you look closely: The difficulty is when you try to translate the concept on hi res textures. With old style low res pixel art textures this is obviously simple and you can take a lot of different paths since usually there are few colors and you can have a good control of each pixel. I was playing with textures and i was wondering about the best method to achieve a palette swap using hi res images.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |