Light Age - black and white shader


Hi, welcome to my first devlog post!

I want to show you how I decided to implement the main features of Light Age, a game made for the #BWJam in 2021. The key aspect of this jam was that you can only use #ffffff (white) and #000000 (black) in the game. Note that I have used Godot as a Game Engine.

To achieve the color constraints of the jam, I have implemented a ColorRect always visible on top of all nodes (it is an AutoLoad Singleton), with a Shader attached to it:

shader_type canvas_item;
uniform float threshold : hint_range(0, 1);
void fragment() {
    COLOR = texture(SCREEN_TEXTURE,SCREEN_UV,10);
    float avg = (COLOR.r + COLOR.g + COLOR.b) / 3.0;
    if(avg<threshold) {
        avg = 0.0;
    } else {
        avg = 1.0;
    }
    COLOR.rgb = vec3(avg);
}

It's a simple shader, and it does a mean of the RGB components of each pixel on the screen and then, if this value is above a certain threshold, that pixel is set to #ffffff, otherwise, it's set to #000000.

In this way, everything renderer on the screen is then processed by this shader, and there will not be any other color rather than #000000 and #ffffff.

Shader disabled:

Shader enabled:


Hope that this can be interesting for you!

Get Light Age

Download NowName your own price

Leave a comment

Log in with itch.io to leave a comment.