Black Souls Dribble/Schizo/Insanity

Needs opaque material/mesh below this, since this is fully transparent except the lines ofc.
Increase `stroke_count` for insanity effect.

Shader code
shader_type spatial;

uniform sampler2D albedo_texture : source_color;
uniform int stroke_count = 40;        // number of strokes per layer
uniform float stroke_sharpness_multiplier = 1;
uniform float stroke_jitter = 0.4;   // Randomized per camera shot
uniform float stroke_intensity = 0.7;
uniform float noise_scale = 8.0;       // Randomized per camera shot
uniform int layers = 3;                // default overlapping stroke layers

float hash(float n){ return fract(sin(n*12.9898)*43758.5453); }
float hash2(vec2 p){ return fract(sin(dot(p, vec2(12.9898,78.233)))*43758.5453); }
float noise(vec2 p){
    vec2 i = floor(p);
    vec2 f = fract(p);
    float a = hash2(i);
    float b = hash2(i + vec2(1.0,0.0));
    float c = hash2(i + vec2(0.0,1.0));
    float d = hash2(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;
}

void fragment() {
    vec4 base = texture(albedo_texture, UV);
    vec3 color = base.rgb;

    for(int l = 0; l < layers; l++){
        float angle = hash(float(l)) * 6.2831;
        vec2 dir = vec2(cos(angle), sin(angle));
        vec2 perp = vec2(-dir.y, dir.x);

        for(int i = 0; i < stroke_count; i++){
            float t = float(i)/float(stroke_count);
            vec2 center = dir * t;

            float dist = dot(UV - center, perp);
            dist += (noise(UV*noise_scale + float(i)*10.0 + float(l)*20.0) - 0.5) * stroke_jitter;

            float line = 1.0 - smoothstep(0.0, 0.001 * stroke_sharpness_multiplier, abs(dist));

            // blend without dividing by layers (optional)
            color = mix(color, vec3(0.0), line * stroke_intensity);
        }
    }

    ALBEDO = color;
    ALPHA = base.a;
}
Live Preview
Tags
sketch drawing black-souls schizo art lines
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 leaf_enjoyer

Related shaders

guest

0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments