This is an automated archive made by the Lemmit Bot.

The original was posted on /r/godot by /u/WestZookeepergame954 on 2025-01-26 12:27:41+00:00.


Hi guys!

A few months ago, we released Prickle on Steam. We thought it might be useful to share some of our knowledge and give back to the Godot community.

So here are two simple shaders we’ve used:

  1. Dark mode + contrast adjust.
  2. Water ripples shader (for the water reflection).

I’ll leave a comment with a full-length video tutorial for each shader.

(But you can also simply copy the shader code below)

If you have any questions, feel free to ask. Enjoy!

A short demonstration of both shaders

Dark mode shader code:

shader_type canvas_item;

uniform sampler2D SCREEN_TEXTURE : hint_screen_texture, filter_linear_mipmap;

uniform bool invert = false;
uniform float contrast : hint_range(0.0, 1.0, 0.1);

void fragment(){
  const vec4 grey = vec4(0.5, 0.5, 0.5, 1.0);
  float actual_contrast = (contrast * 0.8) + 0.2;
  vec4 relative = (texture(SCREEN_TEXTURE, SCREEN_UV) - grey) * actual_contrast;

  if (invert) {
    COLOR = grey - relative;
  } else {
    COLOR = grey + relative;
  }
}

Water ripples shader code:

shader_type canvas_item;

uniform sampler2D SCREEN_TEXTURE : hint_screen_texture, filter_linear_mipmap;
uniform sampler2D noise : repeat_enable;
uniform float speed : hint_range(0.0, 500.0, 0.5);
uniform float amount : hint_range(0.0, 0.5, 0.01);
uniform float x_amount : hint_range(0.0, 1.0, 0.1);
uniform float y_amount : hint_range(0.0, 1.0, 0.1);
uniform vec4 tint : source_color;
uniform vec2 scale;
uniform vec2 zoom;

void fragment() {
float white_value = texture(noise, UV*scale*0.5 + vec2(TIME*speed/200.0, 0.0)).r;
float offset = white_value*amount - amount/2.0;
vec2 offset_vector = vec2(offset*x_amount, offset*y_amount);
COLOR = texture(SCREEN_TEXTURE, SCREEN_UV + offset_vector*zoom.y);
COLOR = mix(COLOR, tint, 0.5);
}