Barber

Barber polls!

Shader code
shader_type canvas_item;

#define time TIME*10.

void vertex() {
	// Called for every vertex the material is visible on.
}

float stripe(vec2 uv) {
    return cos(uv.x*20.-time+uv.y*-30.);
}

float glass(vec2 uv) {
    return cos(dot(uv.xy, vec2(12.41234,2442.123))*cos(uv.y));
}

void fragment() {
	vec2 uv = UV;
	vec2 resolution = 1.0 / TEXTURE_PIXEL_SIZE;
	float a = TEXTURE_PIXEL_SIZE.x/TEXTURE_PIXEL_SIZE.y;
	uv.x *= a;
	
	float g = stripe(uv);
	
	vec3 col = vec3(smoothstep(0., .2, g));

    col.r = .8;
    col /= (pow(glass(vec2(uv.x*3., uv.y)),2.))+.5;
    
  
    //Mask sides
    col *= smoothstep(.12, .0, abs(uv.x - .5*a));

    //Mask top and bottom
    col *= smoothstep(.33, .30, abs(uv.y - .5));

    if (uv.y > .80 && uv.y < .94 || uv.y < .2 && uv.y >.06) {
       col = vec3(smoothstep(.13, .0, abs(uv.x - .5*a)));
    
    }

    if (uv.y > .77 && uv.y < .87 || uv.y < .23 && uv.y >.13) {
       col = vec3(smoothstep(.15, .0, abs(uv.x - .5*a)));
        
    }
	
	// Called for every pixel the material is visible on.
	//vec3 color = vec3(1.0, 0.,0.);
	COLOR = vec4(col, 1.0);
}

//void light() {
	// Called for every pixel for every light affecting the CanvasItem.
	// Uncomment to replace the default light processing function with this one.
//}
The shader code and all code snippets in this post are under MIT license and can be used freely. Images and videos, and assets depicted in those, do not fall under this license. For more info, see our License terms.
Subscribe
Notify of
guest

0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments