How to reduce the bit depth? | ¿Cómo reducir la profundidad de bits?

Hello, you can call me by my username “Mautar”.

Just register and warning me that I am Argentine, so I speak Spanish and have some errors in writing, it is because I used google.
I use version 2.7a

The problem:

I am recreating urban legend “Polybius” with the Blender Game Engine, bringing you an aspect of “SEGA” changing the color depth to 16 bits but when the change does nothing.

If possible I also want to leave the game in 320x240 resolution but rastrerizado sampling. DRY pixels.

P / D: I turn to this page because there are very few Blender tutorials in Spanish. And leave my question in Spanish to someone out there I can find with google. :slight_smile:

Hola, pueden llamarme por mi nombre de usuario “Mautar” .

Recién me registro y aviso que soy argentino, por tanto hablo español y, de haber errores de algún tipo en la escritura, es porque usé google.
Yo uso la versión 2.7a

El problema:

Estoy recreando la leyenda urbana “Polybius” con el Blender Game Engine y le quiero dar un aspecto de “SEGA” cambiando la profundidad de color a 16 bits pero cuando la cambio no sucede nada.

Si es posible también quiero dejar el juego en resolución 320x240 pero sin rastrerizado muestreo. Pixeles SECOS.

P/D: Recurro a ésta página porque hay muy pocos tutoriales de Blender en Español. Y dejo mi pregunta en español para que alguien por ahí pueda encontrarla con google. :slight_smile:

SALUDA @Mautar55

I don’t speak anything other than English and a touch of Afrikaans, but I’ll try type this simply.

There is no good way to effectively create that old-school style of game by changing the resolution and/or color depth; however it can be faked using a 2d filter.

Solarlune’s pixellate filter:

def Pixellate(pixel_w = 4.0, pixel_h = 4.0):

    Pixelation filter, adapted from a script from Geexlab /
    Author: SolarLune
    Date Updated: 6/6/11
    Why a function? Because this way, users can easily customize the filter
    to return a custom-made script. Note that this only works when calling the script (so don't call it
    every frame as that will kill your FPS. It's better to copy the script you want and pass a uniform variable 
    if you want to alter parameters while running the filter)
    pixel_w = pixel-size on the X-Axis
    pixel_h = pixel-size on the Y-Axis
    Higher numbers equals a blockier picture
    #winsize = [render.getWindowWidth(), render.getWindowHeight()]    
    return ("""
    // Name: Pixellate
    // Author: SolarLune
    // Date: 6/6/11
    // Notes: Pixellates the screen using blocks consisting of cellx size on the 
    // X-axis and celly size on the Y-axis.
    uniform sampler2D bgl_RenderedTexture;
    uniform float bgl_RenderedTextureWidth;
    uniform float bgl_RenderedTextureHeight;
    void main(void)
        vec2 uv = gl_TexCoord[0].xy;
        vec2 pixel = vec2(1.0 / bgl_RenderedTextureWidth, 1.0 / bgl_RenderedTextureHeight);
        float dx = """ + str(pixel_w) + """ * pixel.x;
        float dy = """ + str(pixel_h) + """ * pixel.y;
        vec2 coord = vec2(dx * floor(uv.x / dx), dy * floor(uv.y / dy));
        coord += pixel * 0.5; // Add half a pixel distance so that it doesn't pull from the pixel's edges,
        // allowing for a nice, crisp pixellation effect
        coord.x = min(max(0.001, coord.x), 1.0);
        coord.y = min(max(0.001, coord.y), 1.0);
        gl_FragColor = texture2D(bgl_RenderedTexture, coord);

This script needs to be run using a python controller directing to the python file containing it.

I do not really understand. Mautar, are you talking about 16 bit color depth or 16 colors?

16 bits; 16 colours are 4 bits but the old sega use 16 bits **

Gracias, ahora mismo lo implemento. La idea era reducir la resolución a 320x240 para ahorrar rendimiento pero así está excelente.

Thanks, now I implement. The idea was to reduce the resolution to 320x240 to save performance but it is excellent.

16 bit color depth. If that is = this game