Pixel Water

Pixelised water effect

Shader code
shader_type spatial;

uniform vec4 color1 : source_color;
uniform vec4 color2 : source_color;
uniform vec4 color3 : source_color;
uniform float x_amount = 32.0;
uniform float y_amount = 32.0;

float random (vec2 uv) { return fract(sin(dot(uv.xy, vec2(12.9898,78.233))) * 43758.5453123) ; }

void fragment() {
	vec2 tiled_uvs = vec2(trunc(UV.x/(1.0/x_amount)), trunc(UV.y/(1.0/y_amount)));
	ALBEDO = mix(mix(color1.rgb, color2.rgb, sin(TIME + tiled_uvs.x - tiled_uvs.y * random(tiled_uvs))/2.5), color3.rgb, sin(TIME + tiled_uvs.x - tiled_uvs.y * random(tiled_uvs.yx))/2.0);

}
Live Preview
Tags
pixel, Spatial, water
The shader code and all code snippets in this post are under CC0 license and can be used freely without the author's permission. Images and videos, and assets depicted in those, do not fall under this license. For more info, see our License terms.

Related shaders

Comments 2

  1. KingGD

    Cam you tell us the default colors you used for it?

    0
    1. Quokt Author

      Sure!
      color1 is #0000ff
      color2 is #006782
      color3 is #00008e
      You may want to adjust them to match your lighting

      0