Back to shaders
Shader test bench
Velvet Fiber Sheen
runnable fragment
Complete GLSL fragment shader. Stronghold runs it directly when the browser can compile it.
Code
precision mediump float;
uniform vec2 resolution;
uniform float time;
float hash(vec2 p){return fract(sin(dot(p,vec2(27.1,61.7)))*43758.5453);}
void main(){
vec2 uv=gl_FragCoord.xy/resolution.xy;
float fibers=0.0;
for(int i=0;i<4;i++){float fi=float(i); vec2 p=uv*vec2(30.0+fi*12.0,180.0); float r=hash(floor(p)+fi); fibers+=smoothstep(0.985,1.0,sin((uv.x*45.0+uv.y*9.0+fi)*3.14159+r*6.283));}
float nap=pow(max(0.0,1.0-distance(uv,vec2(0.5+0.15*sin(time*.2),0.45))*1.7),2.0);
vec3 col=mix(vec3(0.08,0.01,0.07),vec3(0.55,0.08,0.38),nap)+fibers*0.035;
gl_FragColor=vec4(col,1.0);
}