You could generate equidistant hue values in the HSV space:
for (int i = 0; i < 10; i++)
colors[i] = HSV(0.1 * i, 0.5, 1.0);
However, it’s possible that you will not always have 10 players. In that case, the palette would not be very efficient unless you re-generated a different palette for another number of players. Instead, some authors recommend ...
The 8 StarCraft colors are:
Red, Blue, Teal, Purple, Orange, Brown (green in desert maps), White (green on ice maps), Yellow
Obv. Blizzard are UI geniuses and have studied the problem.
They left Green out as a swap-in for Brown on desert maps, so technically there are 9 listed there.
The 12 Warcraft 3 colors are:
Red, Blue, Teal, Purple, Yellow, ...
A few people here recommend dividing up HSV color space at 10 equidistant positions on hue. In my opinion, this is actually not a good solution. The human eye does not perceive differences in color equally across the HSV spectrum. For example, what we'd call orange occupies a tiny slice of the band, whereas a good 25% chunk might qualify as green. So it ...
Generally when there's a common convention that your audience may already be familiar with, the question isn't whether it's mandatory, but whether there's any reason to deviate from it.
If you use a colour scheme compatible with the ones used in WoW, GW2, Destiny, etc. then players who have played one of those games will have one less thing to learn to ...
A quick and easy way - though not 100% precise one - is to consider just the five extreme points white, black, red, green and blue.
First, let's transform RGB into linear space. Officially this is usually done by this formula (assuming the source data is in sRGB, which is the default for most graphic card operations on 8-bit data and nearly every image you ...
To me it makes no sense at all. This theory is probably just an artist sense of white balance compensation that the eye does, and wrongly gives us the feeling of shifted hues in the shadows. A shadow is just the absence of light from the considered light source. There are other light sources often in a realistic world, this is their color that comes in place....
Digital colors can be made up of three components: red, green, and blue. Combine these together, and you get final color, eg. yellow is 100% red, 100% green and 0% blue.
The fourth component is, as you mentioned, transparency. Together, these form the tuple RGBA (red, green, blue, alpha) which represent an image.
Now, instead of pixels, think about it ...
You can use the fact that colors make up a (three dimensional) color space and calculate a distance in this color space. You then need to define a metric in this color space to find the distance between two colors.
E.g. the distance in a euclidean space between two points x = (x1, x2, x3) and y = (y1, y2, y3) is given by d(x,y) = sqrt( (y1-x1) * (y1-x1) + (...
I thought I needed to break this "symbols" approach out into a separate answer.
Back in the day, I assume people needed flags and stuff to easily identify an army way off in the distance, so you know whether to attack or defend (in case of foes), or be relieved (in the case of allies).
So, incidently that's exactly what you're trying to do. Easily ...
Why reinvent the wheel? There even is a standard for a set of sixteen colors, of which you could pick ten. This is the ANSI set http://en.wikipedia.org/wiki/ANSI_escape_code#Colors
The ANSI colors are equally distributed on the RGB cube, which is, I think, better suited for this problem than the HSV space.
When taking the extremes of the RGB cube, you get ...
The advantages to sticking with convention are: it works, and users are already familiar with it. The disadvantage is that you may be ignoring ways to improve and be unique.
But on this subject, there's not much convention. This topic is covered at Giant Bomb and TVTropes, and from their analysis, generally grey/white items are the lowest tiers, but after ...
Making 10 colors that can be distinguished is going to be really difficult. This is a pretty common issue in creating graphs or charts for many values, which is why they often use color and shape or color and hash pattern combinations.
If you need to display markers, you can use 4 basic colors (red, blue, orange, black for example) and four basic shape (...
There does exist a flavour of Wavefront's *.obj that facilitates Vertex Coloring..
I know of two applications that can export these namely "MeshLab" (free) and "MeshMixer"
(also free from Autodesk)..
The vertex colours is actually found just after each vertex definition as shown below..
(Piece of *.obj)
# OBJ File Generated by Meshlab
Hue-shifting is one possibility that would let you get a range of colors without losing the color details. The basic idea is to convert each pixel from RGB to HSV space, then offset the hue by a user-defined amount, then convert back to RGB. Actually, this can be done more efficiently by applying a rotation matrix to the RGB values: create a matrix that ...
There are a huge number of ways of doing this. These will require the use of a shader and I am presuming that you are already doing per-pixel lighting. The following are some suggestions, however finding the technique that's right for you might take a lot more research.
Quick and Dirty
You can specify bounding boxes which define interior areas. If the ...
I don't know if there exists a set of colors that all people will be able to differentiate, whether or not they have any color-blindness.
It might be a better idea to use an additional indicator alongside color. I know that the Ticket To Ride boardgame uses a symbol on each of the different color cards, so that if someone can't tell the difference between ...
For drop-shadows it doesn't work very well for the reasons you already stated. You never know how many drop-shadows you will have in the scene and differently colored shadows from different objects can look strange. However, it can work nice for self-shadows, especially in a 2d game. This screenshot is from Seiken Densetsu 3 (Squaresoft 1995):
Notice how ...
Let _colors be an array of colors
let LENGHT be the number of colors in the array
let t be the 0..1 float value
float scaledTime = t * (float) (LENGHT - 1);
Color oldColor = _colors[(int) scaledTime];
Color newColor = _colors[(int) (scaledTime + 1f)];
float newT = scaledTime - Mathf.Round(scaledTime);
finally you can use Lerp
Humans have trichromatic color vision, so the space of colors we can see is fundamentally three-dimensional.
(Well, for most of us, it is. Colorblind people may only have dichromatic or monochromatic vision, and there may be a small number of people who can (barely) distinguish an extra dimension. Also, technically, even normal humans do have a fourth ...
White is the best base color for true representation. Also keeping your sprite grayscale can make for some easy color adjustments for teams, etc.
Unity applies a Multiply blend mode to the sprite texture and color.
Unity's Color type is ranged from 0 to 1 inclusive.
Color.White is equal to (1, 1, 1, 1).
Knowing that 1 times anything is itself.
If the ...
One approach that can be taken with multiple color transitions is to leverage a Gradient.
By exposing a public variable of this type a developer an use the Inspector to launch the Gradient Editor to design a gradient containing any number of colors. This editor allows you to use a the unity color pickers, fine tune placement of the color/alpha keys and ...
Just to distill Martin Sojka's excellent answer into something simple to apply, here's how to decide whether black or white text would have higher contrast on a given background color (R, G, B) in the sRGB color space:
const float gamma = 2.2;
float L = 0.2126 * pow( R, gamma )
+ 0.7152 * pow( G, gamma )
+ 0.0722 * pow( B, gamma );
The most contrasting color would be the color that is as far as possible from color X. It's easy to get it this way (assuming 0,0,0=black and 1,1,1=white -- floating point colors):
y = rgb_color(
x.r > 0.5 ? 0 : 1,
x.g > 0.5 ? 0 : 1,
x.b > 0.5 ? 0 : 1
The result is quite ugly though, so you might want to consider a few more things:
It's much more complex than that.
It's not the colors themselves that look attractive, it's the combination of colors, the contrast between them.
In a picture only out of bright colors, there is a lack of contrast, same for a picture only consisting out of dull colors.
In a picture out of dull colors bright spots will immediatly jump into the eye, this can ...
The problem you are facing is that you can't simply "tint" the whole image, the appearance you see is more than just a base color. For one you have fine gradients from one one material to the other, but more importantly you also have reflections,highlights and shadows, which are not influenced by the base color. (Those are basically added on top of it.)
If you use alpha blending you can lay down a complimentary shadow that will work against any background.
It may or may not be any better or faster though. This is something that is likely to change depending on your specific game.
I don't have enough rep to comment on @v.oddou's answer, but I want to say that while purposefully making shadows complimentary ...
The United Nations web accessibility standards page (http://www.un.org/webaccessibility/1_visual/13_colourcontrast.shtml) does indicate a standard for ensuring proper text contrast on websites, keeping in mind that some users are colorblind. This might be particularly important for you since some of your users may be colorblind as well (would be hard to tell ...
Even if you can get 10 unique colors that are distinguishable easily by one person, another person may still find this set harder to distinguish.
Consider limiting yourself to a smaller set of colors, and adding a distinguishable feature, like a black stripe. For the set of colors, it's probably best not to stray too far from what most people can ...
Wavefront OBJ supports materials, which color groups of meshes the same color.
Material statements look like this:
Kd 1.00 0.00 0.00
Ks 0.50 0.50 0.50
So, Kd is the diffuse component, Ks specular.
These would be specified inside a .mtl file that accompanies the .obj file. Inside the .obj file are statements like
You can do just like the Firefly Studios have done in their Stronghold series. In the bottom right corner of the picture you can see six colors, that can be easily distinquished.
As a player, I do not mind remembering who is my enemy and you can always give the player(s) a chance to assign colors to the teams.
One thing I have to note, is that in the first ...