# Reducing the number of colors (color depth)

**URL:** <https://blenderartists.org/t/reducing-the-number-of-colors-color-depth/571154>\
**Category:** Game Engine Support and Discussion\
**Created:** [April 8, 2013, 12:47am UTC](https://blenderartists.org/t/reducing-the-number-of-colors-color-depth/571154 "2013-04-08T00:47:12Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![formFollowsFunction](https://blenderartists.org/user_avatar/blenderartists.org/formfollowsfunction/32/19982_2.png) [@formFollowsFunction](https://blenderartists.org/u/formFollowsFunction)\
**Post date:** [April 8, 2013, 12:47am UTC](https://blenderartists.org/t/reducing-the-number-of-colors-color-depth/571154/1 "2013-04-08T00:47:12Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![formFollowsFunction](https://blenderartists.org/user_avatar/blenderartists.org/formfollowsfunction/32/19982_2.png) [@formFollowsFunction](https://blenderartists.org/u/formFollowsFunction)\
**Post date:** [April 8, 2013, 10:13am UTC](https://blenderartists.org/t/reducing-the-number-of-colors-color-depth/571154/2 "2013-04-08T10:13:49Z")

</div>

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

 ![](https://blenderartists.org/uploads/default/original/3X/d/d/ddc03fd891061886fc8ed3c75f5548c859ed5eab.jpg)  

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

---

<div class="post-metadata">

**Author:** ![Monster](https://blenderartists.org/user_avatar/blenderartists.org/monster/32/2958_2.png) [@Monster](https://blenderartists.org/u/Monster)\
**Post date:** [April 8, 2013, 10:26am UTC](https://blenderartists.org/t/reducing-the-number-of-colors-color-depth/571154/3 "2013-04-08T10:26:04Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![kastoria](https://blenderartists.org/user_avatar/blenderartists.org/kastoria/32/20196_2.png) [@kastoria](https://blenderartists.org/u/kastoria)\
**Post date:** [April 8, 2013, 10:26am UTC](https://blenderartists.org/t/reducing-the-number-of-colors-color-depth/571154/4 "2013-04-08T10:26:44Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![formFollowsFunction](https://blenderartists.org/user_avatar/blenderartists.org/formfollowsfunction/32/19982_2.png) [@formFollowsFunction](https://blenderartists.org/u/formFollowsFunction)\
**Post date:** [April 8, 2013, 11:17am UTC](https://blenderartists.org/t/reducing-the-number-of-colors-color-depth/571154/5 "2013-04-08T11:17:40Z")

</div>

> [@Monster](#):
>
> I guess a pixel shader can do the trick. But I’m not in this topic. So I can’t help.

> [@kastoria](#):
>
> 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 😉 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?

---

<div class="post-metadata">

**Author:** ![SolarLune](https://blenderartists.org/user_avatar/blenderartists.org/solarlune/32/7258_2.png) [@SolarLune](https://blenderartists.org/u/SolarLune)\
**Post date:** [April 8, 2013, 11:25am UTC](https://blenderartists.org/t/reducing-the-number-of-colors-color-depth/571154/6 "2013-04-08T11:25:53Z")

</div>

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

```auto

//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;

}

```

---

<div class="post-metadata">

**Author:** ![Josip\_Kladaric](https://blenderartists.org/user_avatar/blenderartists.org/josip_kladaric/32/948953_2.png) [@Josip\_Kladaric](https://blenderartists.org/u/Josip_Kladaric)\
**Post date:** [April 8, 2013, 1:14pm UTC](https://blenderartists.org/t/reducing-the-number-of-colors-color-depth/571154/7 "2013-04-08T13:14:52Z")

</div>

Have you tried this ?

 ![](https://blenderartists.org/uploads/default/original/3X/1/f/1fe4c0ad8e36e0dfd29697338fcf8607548e13c3.jpg)

---

<div class="post-metadata">

**Author:** ![formFollowsFunction](https://blenderartists.org/user_avatar/blenderartists.org/formfollowsfunction/32/19982_2.png) [@formFollowsFunction](https://blenderartists.org/u/formFollowsFunction)\
**Post date:** [April 8, 2013, 4:02pm UTC](https://blenderartists.org/t/reducing-the-number-of-colors-color-depth/571154/8 "2013-04-08T16:02:52Z")

</div>

> [@Josip Kladaric](#):
>
> Have you tried this ?

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

(What is this option for anyway?)

---

<div class="post-metadata">

**Author:** ![Hobomatic](https://blenderartists.org/user_avatar/blenderartists.org/hobomatic/32/25315_2.png) [@Hobomatic](https://blenderartists.org/u/Hobomatic)\
**Post date:** [April 8, 2013, 4:17pm UTC](https://blenderartists.org/t/reducing-the-number-of-colors-color-depth/571154/9 "2013-04-08T16:17:36Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![iFlowProduction](https://blenderartists.org/user_avatar/blenderartists.org/iflowproduction/32/18753_2.png) [@iFlowProduction](https://blenderartists.org/u/iFlowProduction)\
**Post date:** [April 8, 2013, 4:17pm UTC](https://blenderartists.org/t/reducing-the-number-of-colors-color-depth/571154/10 "2013-04-08T16:17:44Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Josip\_Kladaric](https://blenderartists.org/user_avatar/blenderartists.org/josip_kladaric/32/948953_2.png) [@Josip\_Kladaric](https://blenderartists.org/u/Josip_Kladaric)\
**Post date:** [April 8, 2013, 4:17pm UTC](https://blenderartists.org/t/reducing-the-number-of-colors-color-depth/571154/11 "2013-04-08T16:17:46Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Monster](https://blenderartists.org/user_avatar/blenderartists.org/monster/32/2958_2.png) [@Monster](https://blenderartists.org/u/Monster)\
**Post date:** [April 8, 2013, 10:47pm UTC](https://blenderartists.org/t/reducing-the-number-of-colors-color-depth/571154/12 "2013-04-08T22:47:12Z")

</div>

I tried the filter posted by SolarLune.

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

---

<div class="post-metadata">

**Author:** ![formFollowsFunction](https://blenderartists.org/user_avatar/blenderartists.org/formfollowsfunction/32/19982_2.png) [@formFollowsFunction](https://blenderartists.org/u/formFollowsFunction)\
**Post date:** [April 8, 2013, 11:41pm UTC](https://blenderartists.org/t/reducing-the-number-of-colors-color-depth/571154/13 "2013-04-08T23:41:24Z")

</div>

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

> [@SolarLune](#):
>
> Something like this should work, though it’s not really accurate.

> [@Monster](#):
>
> I tried the filter posted by SolarLune.
> 
> With “coloramt = 10;” you should get what you want to achieve.

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