sombreadar de ruido de tablero

hace como si fuera un tablero de billar 

Shader code
shader_type canvas_item;

uniform vec4 base_color : source_color = vec4(0.004, 0.902, 0.522, 1.0);
uniform float brightness : hint_range(0.5, 2.0) = 1.25;

uniform float noise_scale : hint_range(0.5, 100.0) = 35.5;
uniform float noise_strength : hint_range(0.0, 1.0) = 0.045;
uniform vec2 movement = vec2(0.01, 0.015);

float random(vec2 p) {
    return fract(sin(dot(p, vec2(127.1, 311.7))) * 43758.5453);
}

float smooth_noise(vec2 p) {
    vec2 i = floor(p);
    vec2 f = fract(p);

    float a = random(i);
    float b = random(i + vec2(1.0, 0.0));
    float c = random(i + vec2(0.0, 1.0));
    float d = random(i + vec2(1.0, 1.0));

    vec2 u = f * f * (3.0 - 2.0 * f);

    return mix(a, b, u.x) +
           (c - a) * u.y * (1.0 - u.x) +
           (d - b) * u.x * u.y;
}

float fbm(vec2 p) {
    float value = 0.0;
    float amplitude = 0.5;

    for (int i = 0; i < 4; i++) {
        value += amplitude * smooth_noise(p);
        p *= 2.0;
        amplitude *= 0.5;
    }

    return value;
}

void fragment() {
    vec2 uv = UV * noise_scale;
    uv += TIME * movement;

    float n = fbm(uv);

    // Centrar y suavizar
    n = mix(0.7, n, noise_strength);

    vec3 color = base_color.rgb * n * brightness;

    COLOR = vec4(color, base_color.a);
}
Live Preview
Tags
ruido
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.

More from izannnn

shader de degradado de colores grises

movimiento en ondas 2d

distorsion/nebulosa

guest

0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments