Loading images with noise distortion.

This commit is contained in:
2026-01-06 21:01:53 +01:00
commit f7714b14db
13 changed files with 290 additions and 0 deletions

22
content/imagine.gdshader Normal file
View File

@@ -0,0 +1,22 @@
shader_type canvas_item;
uniform sampler2D ripples: repeat_enable;
uniform float warp;
uniform float time_scale = 0.1f;
vec3 hmap_normal(sampler2D hmap, vec2 uv) {
float eps = 0.01f;
float z = texture(hmap, uv).z;
return normalize(vec3(
(texture(hmap, uv + vec2(eps, 0)).z - z) / eps,
(texture(hmap, uv + vec2(0, eps)).z - z) / eps,
-1
));
}
void fragment() {
//vec3 normal = texture(ripples, UV + vec2(TIME * time_scale, 0)).xyz;
vec3 normal = hmap_normal(ripples, UV + vec2(TIME * time_scale, 0));
vec4 col = texture(TEXTURE, UV + normal.xy * warp).rgba;
COLOR.rgb = col.rgb;
}