Skip to main content

Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
TagsGame Engines
(+1)

For the 4-color limitation, I coded a dumb post processing shader that converts everything to a 4-color palette :)
Its useful to make sure to stick to the rules, here's the core section:

uniform sampler2D u_image; // final image as tex
uniform vec3 u_palette[4]; // color palette
in vec2 v_texcoord; // text coords
out vec4 fragColor; // final color
void main() {
    // Since its a PostProcessing shader, I have access to the final image as texture
    vec4 tex = texture(u_image, v_texcoord);
    // Than I compute the lumimance (color => grey-scale conversion)
    // This is optional, you can even do normal weighted average
    // by adding each channel and dividing by 3.
    float avg = 0.2126 * tex.r + 0.7152 * tex.g + 0.0722 * tex.b;
    // Than I divide the color spectrum in 4 sections (0.25, 0.50, 0.75, 1.0)
    // and assign an index for each of them, going from black-ish to white-ish
    //         x <  0.25   => #0
    // 0.25 <= x <  0.50   => #1
    // 0.50 <= x <  0.75   => #2
    // 0.75 <= x           => #3
    int index = (avg < 0.25) ? 0 : (avg < 0.5) ? 1 : (avg < 0.75) ? 2 : 3;
    // Than the index access a palette (uniform of 4 vec3)
    fragColor = vec4(u_palette[index], 1.0);
}

For palettes, you can access sites like this:
https://lospec.com/palette-list

For Godot, PostProcessing shaders can be integrated easily, try following this guide:
https://docs.godotengine.org/en/stable/tutorials/shaders/custom_postprocessing.h...