distorsion/nebulosa

es un efecto de ruido que sirve solo para los sprites y se inspira en un efecto mas usado en juegos espaciales

Shader code
shader_type canvas_item;

// ParĂ¡metros ajustables
uniform float nebula_intensity : hint_range(0.0, 1.0) = 0.4;
uniform vec3 nebula_tint = vec3(0.4, 0.2, 0.7);
uniform vec3 space_color = vec3(0.02, 0.03, 0.1);

// Ruido simple (hash)
float hash(vec2 p) {
    return fract(sin(dot(p, vec2(12.9898, 78.233))) * 43758.5453);
}

float nebula_noise(vec2 uv, float t) {
    float n = hash(uv * 4.0 + t); // Detalle aumentado
    n = pow(n, 3.0);
    return n * nebula_intensity;
}

void fragment() {
    vec2 uv = UV;
    float t = TIME * 0.2;

    // Textura base (tu imagen)
    vec4 tex = texture(TEXTURE, uv);

    // Nebulosa generada
    float neb = nebula_noise(uv, t);
    vec3 neb_col = neb * nebula_tint;

    // Fondo espacial (oscuro)
    vec3 base = mix(space_color, tex.rgb, tex.a); // Solo si hay alpha

    // Mezcla textura + nebulosa
    vec3 final_rgb = base + neb_col;

    COLOR = vec4(final_rgb, tex.a); // Mantiene transparencia de la textura
}
Tags
nebulosa
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

guest

0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments