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;
}

View File

@@ -0,0 +1 @@
uid://cutdjeuxu188p

27
content/mat_imagine.tres Normal file
View File

@@ -0,0 +1,27 @@
[gd_resource type="ShaderMaterial" load_steps=4 format=3 uid="uid://wr6g6bhw2fyj"]
[ext_resource type="Shader" uid="uid://cutdjeuxu188p" path="res://content/imagine.gdshader" id="1_74fhu"]
[sub_resource type="FastNoiseLite" id="FastNoiseLite_74fhu"]
noise_type = 0
frequency = 0.0018
cellular_distance_function = 1
domain_warp_type = 2
domain_warp_amplitude = 3.36
domain_warp_fractal_type = 2
[sub_resource type="NoiseTexture2D" id="NoiseTexture2D_74fhu"]
width = 1280
height = 720
noise = SubResource("FastNoiseLite_74fhu")
seamless = true
invert = true
in_3d_space = true
normalize = false
bump_strength = 32.0
[resource]
shader = ExtResource("1_74fhu")
shader_parameter/ripples = SubResource("NoiseTexture2D_74fhu")
shader_parameter/warp = 0.005
shader_parameter/time_scale = 0.035