Skip to content

Shaders

Charles Doucet edited this page Sep 13, 2024 · 4 revisions
In this section

Overview

Shaders used in the project are listed here, with a small documentation on how to deploy them. When you create shaders, please add them to this list so you can share your black magic with the rest of the team.

GBJAM-12 mentions in their rules that shaders are allowed, if the final product looks like it can run on an original Gameboy device. To what extent are we risking it by offering advanced visuals, inspired by the Gameboy hardware?

Palette Switch

This shader has been designed with the main goal of limiting the number of art assets to be exported. Since we know the maximum color on screen must be apart a 4-color palette, we can change those properties inside Godot itself instead of importing the same pixel art with different palette.

This allows us to create materials quickly based on a palette and applying them to 2D textures. Switching palette in engine only require a shift of material, instead of new asset files.

How It Works

The shader is fairly simple, but requires some specification for the imported assets. Indeed, to work, the pixel arts must be created using 4 shades of greys:

  • White for the palette’s lighter color (#FFFFFF)
  • Mid light grey for the palette’s mid light color (#A8A8A8)
  • Mid dark grey for the palette’s mid dark color (#545454)
  • Black for the palette’s darkest color (#000000)

splash_screen_godot

Pixel Art Example

The shader evaluates automatically shades of grey and replaces them by its colorful correspondent (pixel by pixel). The shader takes 4 parameters from the user, one for each color of the palette (ordered from the lightest to darkest color). Materials can then be produced for every palette created. When changing the palette’s values of a material, all linked objects will be therefore updated with the variations.

Note that if there are more than 4 colors in the imported assets, they will still be classed within the range to ensure that only 4 colors are on screen in any cases. That said, supervision over the pixel arts created must be adequate to assure the quality of the asset’s rendering.

Screenshot 2024-09-08 203647

Clone this wiki locally