CONTROLS:

Pause Scene : Space

Switch Palette : Shift


----------------------------------------------------------------


A demo of a Godot dithering shader I adapted and modified from http://alex-charlton.com/posts/Dithering_on_the_GPU/.

It runs as a post-processing effect and it can remap a scene to any arbitrary palette, and only the colors in that palette. 

Dithered Scene:

SLSO8Dithering

The scene drawn using the dithering shader with the SLSO8 palette applied. Each pixel is only 1 of 8 colors.


Default Scene:

DefaultScene
The scene drawn normally, with no post processing.


Palettes used (in order of appearance):

As the demo illustrates, it works well enough with just about any palette.


HOW TO USE:

  1.  Import the two downloadable files into your project ("palette_dither_post_processing.shader" and "dither_shader_palette_precomputer.gd").
  2. Create a "Viewport Container" node at the root of a tree.
  3. Set the container layout to "Full Rect" (not required, but helpful).
  4. Enable stretching on the container if you want it to adjust to the window size.
  5.  Add a viewport as a child of the container. Adjust it's size to your needs (if you want it to fill the window, set it to your project setting's window size).
  6.  Add whatever scene you want to render as a child of the viewport. In the demo it's a spatial node, but it can be anything. Your scene tree should look like this:
  7.  Create a new Shader Material on the Viewport Container, and assign "palette_dither_post_processing.shader" to the shader slot.
  8.  Attach "dither_shader_palette_precomputer.gd" as a script to the viewport container. This automatically adjusts parameters on the shader for the palette and converts it to HSL color space.
  9.  Assign any texture to the "Palette Texture" slot. Smaller images can be processed more quickly.
  10. Viola! You should now see the viewport getting recolored and dithered to the palette of your texture!


The models were made by me while following this excellent course by Miziziziz: 

Download

Download
dither_shader_palette_precomputer.gd 1.8 kB
Download
palette_dither_post_processing.shader 4.9 kB

Leave a comment

Log in with itch.io to leave a comment.