Reducing the number of colors (color depth)

I wonder if it possible to reduce the numbers of colors in the BGE to gain a kind of retro game look. I guess that would be possible with a camera filter? Though, I did not find any information or examples.
Can anyone help?

Perhaps it is not clear what I want to achieve, so I let images speak:


Well it came to my min that this could be faked in some way when using the toon-nodes in GLSL, but that would be pretty much work, as it would be needed to tune every material

I guess a pixel shader can do the trick. But I’m not in this topic. So I can’t help.

2 ideas that come to mind would be:

  1. Just use a 2D filter that rounds the components of the colors to achieve the banding you want.
  2. Simply design the objects + textures to have the retro look from the start. If you are going for a retro look then I’m assuming this is a 2D type game.

Wrong guess :wink: It should be 3D so the lighning and shadows are display accordingly. Well yah, exactly what you pointed out, is there some reference on 2d filters?

Something like this should work, though it’s not really accurate.



//coloramt = severity of colors to output; 
//2.0 = looks like 16-bit?
//1.5 = like old-school computer level graphics (VGA?)
//1.0 = is basic colors (only red, green, blue, or a complete combination thereof)

vec4 colround(float value, vec4 color){ // Rounding function
    
vec4 c = color;
   
c *= value; // Multiply the vector by the value
    
c = vec4( ceil(c.r), ceil(c.g), ceil(c.b), ceil(c.a) ); // Round it off (math ceiling, actually)
    
c /= value; // Divide it by that value
   
return c;

}
    
uniform sampler2D bgl_RenderedTexture;
    
void main(void) {

vec4 color = texture2D(bgl_RenderedTexture, gl_TexCoord[0].st);

float coloramt = 1.0;

color = colround(coloramt, color);
        
gl_FragColor = color;

}


Have you tried this ?


Sorry,
Yes, it didnt change anything for me =)

(What is this option for anyway?)

Apparently it only works for fullscreen mode on certain operating systems. I tried it in fullscreen mode in X11 and it didn’t do anything for me either. I think it is only applied where it makes sense/is allowed for a program to change the bit depth for the whole display.

*** EDIT ***

There is no ‘fullscreen mode’ in the embedded player guys.

It should change the colour Bit Depth for the standalone player (not internal).

I think it works only in the Blenderplayer when you export your game. It does what you asked for.

I tried the filter posted by SolarLune.

With “coloramt = 10;” you should get what you want to achieve.

Oddly, the bit depth also doesnt work for me when using the external player.

Oh I didnt saw Solars post. Yeah, 10 or 15 is a good value. Thank you very much guys! :smiley: