Loading images with noise distortion.
This commit is contained in:
22
content/imagine.gdshader
Normal file
22
content/imagine.gdshader
Normal 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;
|
||||
}
|
||||
Reference in New Issue
Block a user