Search Unity

  1. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice
  2. Unity is excited to announce that we will be collaborating with TheXPlace for a summer game jam from June 13 - June 19. Learn more.
    Dismiss Notice
  3. Dismiss Notice

[Solved] Minimum viable Palette.

Discussion in 'General Discussion' started by neginfinity, Mar 21, 2024.

  1. neginfinity

    neginfinity

    Joined:
    Jan 27, 2013
    Posts:
    13,643
    I wonder if this could be an interesting discussion.

    I'm contemplating idea of "minimum viable palette".

    Basically, imagine that you're making pixel art or textures, but have limited color set. Like in pixel art. The minimum viable palette would be smallest color set that allow you to reproduce most objects.

    The aesthetic I'm interested in is retro shooter, PSX1 or another world. Meaning, large texels with no filtration or vector graphics.

    upload_2024-3-21_8-51-2.png

    At the moment I'm sort of arrived at this.
    upload_2024-3-21_8-48-36.png

    But I wonder if anyone tinkered with the idea or came across something like that.
     
    Noisecrime likes this.
  2. CodeSmile

    CodeSmile

    Joined:
    Apr 10, 2014
    Posts:
    6,922
    I'm also into pixel art / retro textures at the moment, that's why I asked how Unity Muse can help. It's unfortunately not doing that in a meaningful way, particularly the 512x512 minimum size is already "too big" for retro shooter textures. The color palette issue comes on top because the retro look requires a uniform and limited palette (16-256 colors).

    The palette you have would work fine outdoors, as colors tint towards fog. For indoors you'll want them to tint towards decreased brightness instead.

    Interestingly the indoor shot from above also tints indoors towards fog. Weird artistic choice.
     
  3. neginfinity

    neginfinity

    Joined:
    Jan 27, 2013
    Posts:
    13,643
    Hmm.

    The issue with muse and bots is that they're blind, which is why I made a thread to ask humans. Particularly pixel art may require a different model.

    I also tinkered with retro shooters in the past, then I tried to emulate palette. But that palette was not a uniform. Actually I used this.
    upload_2024-3-21_11-17-26.png
    I think it might be loosely based on doom palette. Not sure, it was long time ago. I do not remember how i created it.

    The thing about doom and retro shooter palettes is that they are not uniform and are not universal. They try to cover several commonly occuring colors forming gradients. Then there are tables for full screen palette effects.

    The sample I pasted earlier is made similar to HSV hue wheel. Except I used seven colored rainbow as a base instead of HUE stripe. The variations below are created by shifting saturation and value. 3 steps for each, because there's grayscale stripe available. I also considered just uniformly sampling RGB cube, but I have a strong feeling that this will result in WRONG colors. Strangely spaced ones and so on. RGB colors are not uniformly distinct.
     
  4. kdgalla

    kdgalla

    Joined:
    Mar 15, 2013
    Posts:
    4,697
    How do we decide what's viable for a particular project? Theoretically the absolute minimum is two. That's pretty extreme but there are some games like Minit and the Ossuary that only have two colors in the entire game.
     
  5. neginfinity

    neginfinity

    Joined:
    Jan 27, 2013
    Posts:
    13,643
    I asked this question because it is not an easily defined mathematical problem.

    For example, I know two modern games that use monochrome visuals. Those are "Return of the Obra DInn" and "World of Horror".

    Obra Dinn is adamant at using only two hours and relies on dithering.


    In World of Horror monochrome mode is optional, and by default it uses, I believe 4 colors.
    It does that because by default World of Horror uses lower resolution than Obra Dinn and mimics an old PC system. As a result dithering works worse in it.

    The reason why 4 colors are necessary is because with two colors you will have hard time depicting objects in shadow as the only colors you have are light and dark. With 4 colors you can treat that as "bright object, lit", "bright object, in shadow" and "dark object, lit", "dark object, in shadow".

    In Pixel art you typically need 4 colors to depict a form, which will be "highlight", lit color, shaded color and deep shade color. However, those will form color band, based on object and can include hue shifts. See "spectrumizer" for an example.

    Now, you can make a solid world with 4 shades of gray, but there will be no color. And default 24bit color is daunting to tackle, because when you have 16 million colors, it is hard to select one. That's what palette is for. To reduce choice to workable amount.

    As I said, the first obvious idea in this scenario is to reduce RGB cube to fewer bits. Creating 6 bit color, for example, or six level RGP you can see here:
    https://en.wikipedia.org/wiki/List_of_software_palettes

    The issue is that such palette creates not very usable color set. It will looks like this:

    If you research situation further, you'll learn that artists prefer HSL and HSB color picker because of utility.

    From that it follows that it should be a good idea to pick HUE color band and split it into segments, which is what I tried to do with sample palette. Then you find an interesting problem, where in HUE color band colors are not uniformly distinct. Basically there's more gradation between red and green than there is between green and blue.

    While looking into it, I realized that artistic color wheel is different and within it colors are closer to being uniformly distinct.
    Meaning colors are changing in "even" fashion. Basically computer imaging HUE band has red at 0, green at 120 degrees and blue at 240. Artistic band has red at 0, and yellow at 120. In this scenario blend between green and yellow is compressed and it makes sense.

    I tried to generate a color band-based palette based on artistic wheel, and I realized that I'm missing colors between green and blue, after which I was sent on a rabbit chase to check if color harmony theory is culture-specific. Thankfully, turns out this is not exactly the case.

    So that's where I'm at at the moment. I've found out that palette generatd from 7-color rainbow and midtones, with several Saturation and Value adjusted variants SEEMS to be enough but I wanted to know if there's better way to do it.
     
  6. Voronoi

    Voronoi

    Joined:
    Jul 2, 2012
    Posts:
    593
    This is out of left field, but as an illustrator I was challenged when asked to do a 2 or 3 color project. At first, it seemed limiting (especially working digitally) but invariably the challenge made the art turn out really well. I'd look at old 2 or 3-color children's books and use all the tricks they used to 'make' more colors. Patterns, textures, the white of the page and overprinting the two colors to make a new color (like multiplying).

    Here's an example of what I mean:


    A newer trend to Google is 'Riso prints', which is a two-color printer that artists are using to posters and art prints.

    Obviously, the color is subtractive rather additive, but I think the look is really cool. I've not seen a game that tries to do this, but I think it would be nice!
     
    spiney199 and neginfinity like this.
  7. neginfinity

    neginfinity

    Joined:
    Jan 27, 2013
    Posts:
    13,643
    That's basically the reason why I'm looking into this. I have difficulty with color (when drawing). Limiting color choices would reduce difficulty. Hence the search for palette.
     
  8. halley

    halley

    Joined:
    Aug 26, 2013
    Posts:
    2,556
    This is the World Wide Web 1.0's "Safe 216" color palette, all over again. Six shades of red, times six shades of green, times six shades of blue. Evenly spaced easy-to-remember codes like #003366 or #FF66CC. Those who ventured beyond the 216 would add up to 40 additional shades of specialty colors like gray or skin tones or team colors that could be swapped, and everything still fit in one byte per pixel.

    However, we moved away from palettized hardware with single instruction lookups, so it became mostly a footnote years ago.
     
  9. neginfinity

    neginfinity

    Joined:
    Jan 27, 2013
    Posts:
    13,643
    I mentioned this one earlier. Not safe 216, but six level palette safe 216 uses.

    The issue here is that it solves different problem and was not designed by artist. It is somewhat similar to default VGA palette
    In VGA palette first sixteen colors are used by text mode. Then somebody added grayscale gradient, and tried to add uniformly sliced RGB cube. Because RGB color is designed for computer vision and not all colors in it are uniformly useful.

    Compare VGA or safe 216 to this:

    This is from Apple
     
  10. ippdev

    ippdev

    Joined:
    Feb 7, 2010
    Posts:
    3,853
    Burnt umber, cadmium yellow, martian red and ultramarine blue (with titanium white) as a palette will paint most any scenery, human or animal.
     
    zombiegorilla and Voronoi like this.
  11. Noisecrime

    Noisecrime

    Joined:
    Apr 7, 2010
    Posts:
    2,058
    Interesting idea, though as a 'problem' i'm not entirely sure you've 'defined the problem space' it well enough.

    I mean there are ways of defining a 'minimum viable palette' for example using any decent gif generator (Photoshop 'save for Web' is quite good, plus decades ago we had an amazing piece of software called 'DeBabelizer' that was used on every CD-Rom 'edutainment' title I worked on to reduce 32 or 16 bit graphics down to 8 bit. Later I guess apps like Macromedia/Adobe Fireworks took over. ( You can probably find these 'abandoned' applications on the 'Internet Archive')

    The issue here is that this requires original assets to perform the colour reduction to a palette, however your posts suggest perhaps working the other way and some how creating a palette that works for most cases. I think that would be very difficult, not even early games would use the same palette for every image.

    Something that would be really interesting ( too me at least) is a more mathematical (statistic) approach, where you simply batch convert 100's of images to their best fit palette ( i.e. convert to gif) then create a histogram of all the resultant colours and choose the best 256.
     
  12. MarkHoffenberg

    MarkHoffenberg

    Joined:
    Mar 23, 2024
    Posts:
    2
    Based on what you said there is many way to approach the problem.

    From an artistic point of view the first thing to define is the intent. Then break it down in domain of contrast (hue, saturation, luminosity, and their combinations) and intensity of contrast (soft, hard). The intent is define by mood, symbolism, anything you need to convey on an object basis, then on a scene basis where the scene shift the objects colors toward a unified meaning.

    From a technical point of view, it depend on what you want to represent, if you have human character, you might want some range on the skin colors to capture some expressiveness.

    Following these process naturally narrows down color to a few pick organized as main color (the subject's color), background color (color that makes the subject pop) and accent color (for the details).

    The same apply for generating a global palette, if you do a zany work, you will go toward bright and saturated character, on pastel background. Your gritty realism will be more or less midtones subject colors on dark background, with occasional bright light as accents or contour (rim light). Then you modulate further from that. Let's not kid ourselves, the global palette is generally the artist preference who find to express itself within that range, figuring out what are your taste, might help shortcut color selections.

    A note is that color is relative, association of colors change how a color is percieve, such that you can have a yellow sky looked blue because it's desaturated near saturated yellows (it's a common trick in painting). Basically grey and desaturated colors are your friends since they tend to be perceived as the complementary of the closest more saturated color.

    Cases:
    1. Arne is an influential pixel artist from the early indie wave, they made many exploration from the pixelation forum. He asked the exact same question, applied to pixel art in 16 colors, inspired by old game palettes. His palette became quite popular, you can see it at the following link, with a summary of his rational, since the pixelation forum no longer exist (need to check the wayback machine):
    https://androidarts.com/palette/16pal.htm
    He made many palettes for various uses.

    Alternatively, this led to spiritual successor like https://lospec.com/ a site dedicated to restriction in game art.

    2. Art twitter had a few analysis of how luminosity and saturation where distributed by famous anime studio (not color). Anime studio having an industrial cadences, their is a natural codification of color selection.
    https://twitter.com/phillworks/status/1265715231688278016
    4 images in this styles:



    Thinking in Luminosity and saturation contrast, before thinking about colors has always been an artistic method to balance and select colors faster.

    3. Another way to select colors is to select high level classification like below:

    It's complementary to the analysis above, but put it in words. It help narrow down a domain (or a range of domain) a lot faster. I recommend to look at Johannes Ittens book (it's the basis of photoshop colors)



    Conclusions
    By formulating a target, either emotional or technical, then translating it into colors domain words (contrast intensity, hue saturation value, hierarchy of main background accent), you can quickly narrow your need and then create a palette of what you need. But colors in only one channel to convey things, you can supplement domain with composition and texture of a scene if for example you opt for a colorful palette but need to express loneliness, colors don't have to support everything.
     
  13. Noisecrime

    Noisecrime

    Joined:
    Apr 7, 2010
    Posts:
    2,058
    Welp, there goes my weekend!
    Great resources.
     
    Lurking-Ninja likes this.
  14. neginfinity

    neginfinity

    Joined:
    Jan 27, 2013
    Posts:
    13,643
    From everything you said it appears that palette is a highly personal choice, and the only way to create it is to start experimenting. Meaning start with grayscale and add missing colors. And there's no universally applicable "Universal Palette".

    P.S. I wonder if @Martin_H would have anything to add, if he's still around.
     
  15. Martin_H

    Martin_H

    Joined:
    Jul 11, 2015
    Posts:
    4,436
    Not much.

    Also not much.

    I think that is the wrong tool for the job. And digital artists don't tend to create a palette first in a vacuum, it would be needlessly difficult.

    What you can try is extract color gradients from existing images and then recreate them in your paintings with "gradient maps" - that is what the appropriate adjustment layer is called in Photoshop. Some other tools have a different name for the same technique. They allow you to paint in black and white while evaluating the result in color at the same time, and you can tweak the colors of the gradient after the fact. This works well for things that aren't colored strongly by light, like gold or fire, and progressively worse for things that need more varied colors because of their material or the light situation. You can however add back some of that color variation on separate layers. For example I sometimes use an adjustment layer to define an area as sunlight or cast-shadow, and paint a mask to shape it. Then I can still paint across the edges of that light/shadow area in underlaying layers without adjusting my colors between the lit or shadowed part too much, allowing me to focus more on local color changes and shading with ambient occlusion.

    I really like gradient maps and would encourage you to experiment with them. Some people even color the entire painting with such a gradient. Here is an example:

    https://www.artstation.com/artwork/vQ0aD
    https://www.artstation.com/artwork/8lvExq

    Using such an adjustment layer over the whole picture, but with reduced opacity, would be somewhat similar to colorgrading in films or using color LUTs in games to give the whole scene a certain atmosphere.
    In games you can use things like depth-fog to add another color dimension, add some colored lights and you have even more.

    I would agree.

    That is useful up to a point but ultimately I think a strict grayscale to color workflow will end up being limiting as you progress. I would get used to going straight to color as soon as you can.

    Yes, art would be getting boring real quick if everything had the same color palette. The closest to "universal" in some sense are the color palettes that AI generators like Midjourney use, which is one of the reasons why those images get boring to me real quick. They are "averaged by design".


    When it comes to games, ultimately a very important aspect will just be encoding information, without compromising your artistic vision too much, and often these will be in conflict. The amount of information you need to clarify will likely set the limit of the minimal colorpalette that makes sense for your game. For solving the purely aesthetic questions, look at paintings and games with good art direction. No "technical" solution will make this part easier imho.
     
    neginfinity likes this.
  16. neginfinity

    neginfinity

    Joined:
    Jan 27, 2013
    Posts:
    13,643
    Thanks for the response, information on gradient maps was quite interesting and is something I did not consider.
    The reason for seeking a palette is to overcome my personal block when dealing with color. For example, in past year, I figured out how to write books. I found the process. In 3d modeling and 2d drawings I can't say I found the process fully to the same degrees as with books. Looking for a palette is a limiter to reduce issue with choices.

    If that makes sense.
     
    Martin_H likes this.
  17. Voronoi

    Voronoi

    Joined:
    Jul 2, 2012
    Posts:
    593
    I was at a talk with the digital artist Joshua Davis and he had a brilliant use for gradients to control a color palette. As a procedural artist myself, I often use formulas to choose a random color for an effect, either particles, objects or background. Davis implored us to abandon 'randomness' and use a gradient instead.

    Create a 1 pixel tall by however many colors wide that you want, 16, 256, whatever in a paint program. Then, use a soft brush or gradient to make a palette to choose from. In the program, you can randomly pick a color from the ramp and be assured it's using your 'palette' and not purely random.

    gradient.png

    I actually found using the ramp like a player piano roll a lot more interesting. Say I have a stream of particles, I start at the left and pick a color moving to the right on the ramp. If I want slow, gradual transitions, I use a soft blend. Here and there, I might want a more harsh, strobe change and so I just use a sharper brush.

    I'd been doing procedural art for years and never thought to do this! It really makes the artwork a lot more controlled and artistic as opposed to just pure randomness.
     
    Noisecrime and ippdev like this.
  18. Martin_H

    Martin_H

    Joined:
    Jul 11, 2015
    Posts:
    4,436
    But there is no randomness needed. You are an artist, just choose a color that looks good! :p


    That's fair. But I think the easier way to do that is not to get super abstract as you do with color swatches. Just use other paintings to assemble your color palette. Some artists pick their colors directly out of paintings by old masters. Some take some of their own old paintings as a starting point and manipulate them until you can barely recognize the original motif. You could also use photos, or screenshots from games. You can manipulate them further to make the color decisions your own. I think using a full image solves several problems that have been mentioned, before. Like color being relative to the other colors in the image, colors being affected by light, fog, etc., and colors having uneven distribution in the final image. Just a list of colors on a palette doesn't tell you which of them are going to take up the most space in the final painting, which is a drastically important decision.

    Some of my personal favorite advice for digital painting is to never ever start with a white background. I often start by putting down some soft gradients or textured brush strokes first. And then I use every tool I have to figure out the overall color-scheme and light situation through trial and error. I usually don't use any references for this, but I would if I needed to.

    Once I have the basic color range established, I can do about 70% of color selection during painting with the color picker and the colors already on my canvas.
     
    zombiegorilla and neginfinity like this.
  19. neginfinity

    neginfinity

    Joined:
    Jan 27, 2013
    Posts:
    13,643
    In case anyone is interested. I ended up trying to do this:

    upload_2024-3-27_19-42-4.png

    Basically, looks like the functional way to work with limited palette in blender is to put an empty with palette as image, then color pick it in vertex painting mode. When you need more colors, you can just alter the image.

    I also tried uv-unwrapped palette, but
    upload_2024-3-27_19-44-42.png

    but in vertex painting mode it is possible to make gradients. And when I'm using uv-unwrapped meshes, recoloring vertices is hard.
    upload_2024-3-27_19-45-45.png

    The initial synthetic palette I posted in the theme seems sufficient, although it is definitely not perfect. I suppose now it is time to practice.

    On related note whiel looking through various sources I found this:
    Which gave me some food for thoughts regarding smoke and mirrors. It is also applicable to videogames.
     
    Martin_H, Voronoi and Noisecrime like this.
  20. andyz

    andyz

    Joined:
    Jan 5, 2010
    Posts:
    2,333
    That looks like an HSV approach - you end up with a line of colors and 2 darker shades. you really want a line of colors with a lighter shade and a darker shade. Thus HSL comes to the rescue (to me).

    It does feel with a coding head on that there is an algorithm to achieve a reasonable limited palette!

    With HSL the 'L' means you can easily get dark and light versions of your 'HS' colours!
    Basically start with a number of hues at perhaps 50% saturation for a more natural feel - then add a limited range of different lightness values - perhaps one darker and one lighter. Lighter colors seem to reach white sooner than darker colors black though...!
    But then you start to question your perception of hue values - it seems you need more in the red to yellow range where brown pops up, perhaps less in others.
     
  21. neginfinity

    neginfinity

    Joined:
    Jan 27, 2013
    Posts:
    13,643
    It is based off HSV. However, HSV hue strip is based on RGB, as such there are areas where its "density" is too high (too many distinct colors) cramped into area, and there's another area where color barely changes (blue segment. Human have lower sensitivity to blue). That's why I used seven color rainbow as a base (red, orange, yellow, green, light blue, blue, magenta)

    I tried HSL to generate palette, the difference here is that lighter HSL colors quickly become washed out. It looks like this:
    upload_2024-3-28_21-10-47.png
    Note strips that are pretty much gray. It is possible that I didn't get it QUITE right, though, but HSB/HSV has no such issue with lighter strips:
    upload_2024-3-28_21-11-52.png
    Though there's a similar issue with darker strips, thinking about it...
     
    Last edited: Mar 28, 2024
    andyz likes this.
  22. PanthenEye

    PanthenEye

    Joined:
    Oct 14, 2013
    Posts:
    2,140
    Ryiah likes this.
  23. Tzan

    Tzan

    Joined:
    Apr 5, 2009
    Posts:
    736
    I made this back in 2010. To color Lego style models. But I switched to using vertex colors. ColorSwatch_100.png
    Inside the game I'm going to make a color picker that is 11x11 boxes, so that gets rid of many color options.
    I havent made it yet so no idea how I might need to adjust it.
     
  24. Murgilod

    Murgilod

    Joined:
    Nov 12, 2013
    Posts:
    10,307
    For this sort of thing, I tend to use an indexed colour shader. The base is greyscale and the 0-1 value just corresponds to an xy coord in a palette texture. If I need to adjust a colour, it's just a matter of changing the colour I want in that texture.
     
  25. Tzan

    Tzan

    Joined:
    Apr 5, 2009
    Posts:
    736
    Ah thanks. Dont think I've heard of indexed color shader before.
    My test was with a bunch of vertex colored mesh squares. I dont actually pick anything here havent done the code yet. Just wanted to see if the minimized pallet had enough options. Figured it would be easy enough to get an xy coord and get a color even if I figure it with math not an actual pick.

    ColorPicker_1.jpg
     
  26. Murgilod

    Murgilod

    Joined:
    Nov 12, 2013
    Posts:
    10,307
    It was basically a way for me to implement the palettized effect of old DOS games. It's pretty much the same as a flipbook shader but you pull from a greyscale reference (this can include vertex colours) and use that to pick the colour.
     
  27. neginfinity

    neginfinity

    Joined:
    Jan 27, 2013
    Posts:
    13,643
    This is one of the ways to implement a palette on modern hardware. Either you have a line of colors, or a grid. Though people traditionally use multiples of 2, like 16x16 grid of colors (and not 11x11). Then you use some information to lookup.

    The advantage of that is that you can recolor models by swapping texture. But then you need to decide if you want object colors determined with textures, or it makes more sense to store object colors as a block of constants.
     
  28. Tzan

    Tzan

    Joined:
    Apr 5, 2009
    Posts:
    736
    I did implement that first image as a texture to pull colors out of. It was a long time ago :)
    Then I switched to vertex colors with a bunch of named constants colors in a class.

    That last image is the 11x11.
    The left side and the bottom row are always the same and I wanted 10x10 of actual colors to pick from. 16x16 is just more options and I wanted to minimize the options 10x10 seems like you wouldnt want to go below that.

    Then you switch thru the hues.

    This is for an onscreen widget that players can use.
     
    Last edited: Apr 4, 2024