Hot answers tagged

54 votes
Accepted

Should I use "conventional" colors to represent item rarity?

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 ...
  • 118k
42 votes

Do complementary shadows make sense for games?

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 ...
  • 2,363
32 votes

Algorithm to modify a color to make it less similar than background

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 ...
  • 421
21 votes

Should I use "conventional" colors to represent item rarity?

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, ...
  • 14.6k
16 votes
Accepted

How to Color.Lerp between multiple colors?

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 ...
14 votes

Do complementary shadows make sense for games?

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 ...
  • 113k
14 votes

How to Color.Lerp between multiple colors?

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 ...
  • 3,792
9 votes

Do complementary shadows make sense for games?

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 ...
  • 363
8 votes

Algorithm to modify a color to make it less similar than background

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, ...
8 votes
Accepted

Pixel Picking vs Raycasting

Pixel picking is effective if you need to do lots of raycasts from one source. You bear the overhead of rendering and readback once, then get all your many picks at low incremental cost each. To get ...
  • 118k
6 votes
Accepted

Palette reduction to pre-defined palette

Another way to do this is to make a texture that maps each RGB to a colour on the palette, an image like this (from the NES colours): Then in a post processing shader you can the RGB colour from your ...
  • 3,203
6 votes
Accepted

How do I get the object color?

Its actually simple. Just use Color32 class to get the r, b, g, a of your desired gameobject. Here is an Example Code. Here I used a cube gameobject and got the color of its material. ...
6 votes

What colour space or mixing algorithm should I use for "watercolor-like" colour mixing in-game?

To answer your question succinctly, RYB (red, yellow, blue) would be most intuitive and closest to mixing physical colors, aka pigments, which blend subtractively. To understand the mixing behavior ...
5 votes

Do complementary shadows make sense for games?

Objects are rarely lit entirely by a single point light source. In most cases, objects will receive much of their illumination from a dominant point source, but receive additional illumination from ...
  • 465
5 votes
Accepted

Creating colour spectrum by light flux values

Here is a little help on getting you started with this rendering. This may not be the best way to accomplish this task however, it should work. First I created a structure to hold your data for ...
  • 8,279
5 votes

How to paint regions of a map with visually different colors

You could now go really deep into color theory to answer the question of what exactly makes two colors visually distinct. RGB is a color system for machines which doesn't map linearly to human ...
  • 113k
4 votes

How do I simulate color blindness for accessibility testing?

Windows 10 Settings In Settings app, there is a section of "Ease of Access".In this section, in the "Color filters" tab on the left, you can "Turn on color filters". This can simulate vision of ...
  • 41
4 votes
Accepted

How do I multiply two RGBA colours?

Convert them to the normalised space: ...
4 votes
Accepted

Math behind XNA's spriteBatch.draw() color parameter?

It's probably multiplying the colours. That's pretty typical for a parameter like this. Each colour channel is interpreted as a value from 0 to 1, then multiplied with the corresponding colour ...
  • 118k
4 votes

How do I properly combine the colors of different lights?

Define "properly." There are multiple ways of blending color. Additive blending works as you describe, 0.1 + 0.1 = 0.2 because we don't care if this value goes ...
4 votes
Accepted

Color Correction in DirectX

Color correction is commonly done through post processing shaders. Basically first you render the scene to a framebuffer, then draw a fullscreen quad that has a shader that takes that framebuffer and ...
  • 128
4 votes
Accepted

draw a box with transparent background (outline) in unity

You could use the "9-slicing sprites" technique to cut up a fairly basic sprite texture and use that to draw the borders. Start by creating a fairly simple sprite - this one is 16x16, but it could ...
4 votes
Accepted

What makes a shader function with a LineRenderer?

Color on a LineRenderer is represented as a color property on the vertices themselves. It behaves just like other vertex properties such as position and UV coordinates. However, vertex colors are ...
  • 5,189
4 votes
Accepted

Are there any practical applications for clearing the screen with a specific color?

Clearing the color buffer can be optional. For example, if you know that you're going to overwrite every pixel each frame, then you might decide to not clear at all. On the other hand, some drivers ...
3 votes

Do complementary shadows make sense for games?

The complementary colour thing is actually illusory. Set up a lemon on some white paper and photograph it. The shadow will have yellow in it, not purple, due to the yellow light being scattered off ...
  • 31
3 votes

Is white the best base color to start with when planning to shade sprites within Unity?

Sprites-Additive.shader - GitHub Gist Unity colors have 4 float values typical of many color formats RGBA, corresponding to the individual percentage color values Red, Green, Blue and the Alpha ...
  • 548
3 votes

Color key or transparent images?

It is quite the same thing. When rendering occurs, the program can compute opaque and transparent pixels to be drawn for color interpolation on the screen. The only difference on the two techniques ...
  • 4,270
3 votes
Accepted

SDL_LoadBMP into glTexImage2D results in scewed colors

You are checking how many bytes there are per pixel, but you are not checking how colours are ordered, and it could be RGBA or BGRA (or possibly something else). You need something like this instead ...
  • 23.5k
3 votes
Accepted

Is this converting from or to premultiplied alpha?

This code is converting from premultiplied alpha: Expanding one of the assignments by substituting for divAlpha: ...

Only top scored, non community-wiki answers of a minimum length are eligible