replace noise with tileable perlin; use pixel-space sampling for fixed scale
This commit is contained in:
parent
9adba9d6c2
commit
d636d0f847
4 changed files with 170 additions and 1 deletions
|
|
@ -25,6 +25,7 @@ uniform float edge_pulse : hint_range(0.0, 2.0) = 1.0;
|
|||
// --- Distortion ---
|
||||
uniform sampler2D noise_tex : repeat_enable;
|
||||
uniform float noise_scale : hint_range(0.0, 5.0) = 1.0;
|
||||
uniform vec2 noise_module_size = vec2(300.0, 240.0);
|
||||
uniform float swirl_strength : hint_range(-2.0, 2.0) = 0.5;
|
||||
uniform float hue_shift_speed : hint_range(0.0, 5.0) = 0.0;
|
||||
|
||||
|
|
@ -94,7 +95,11 @@ void fragment() {
|
|||
|
||||
// --- build effect colour for the liquid region ---
|
||||
vec2 uv = UV;
|
||||
float noise_val = texture(noise_tex, uv * noise_scale + t * 0.05).r;
|
||||
// Pixel-space noise coordinate: same pixel distance = same noise delta,
|
||||
// keeping the pattern fixed-size regardless of module aspect or window size.
|
||||
// The 100.0 constant matches the noise texture size (100×100).
|
||||
vec2 noise_uv = uv * noise_module_size / 100.0 * noise_scale + t * 0.05;
|
||||
float noise_val = texture(noise_tex, noise_uv).r;
|
||||
|
||||
// wave distortion
|
||||
uv.y += sin(uv.x * 10.0 + t) * wave_strength * noise_val;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue