add noise

This commit is contained in:
2024-07-31 21:03:25 +03:00
parent 485df6c245
commit 96f49bfdff
4 changed files with 19 additions and 18 deletions

View File

@ -24,8 +24,8 @@ const char *__temp_cleaned_shader_glsl =
"}"
"float n(float v,float y,float m)"
"{"
"float f=max(m-abs(v-y),0.);"
"return max(v,y)+f*f*.25/m;"
"float z=max(m-abs(v-y),0.);"
"return max(v,y)+z*z*.25/m;"
"}"
"float f(vec2 v,int y)"
"{"
@ -117,7 +117,7 @@ const char *__temp_cleaned_shader_glsl =
"float F=1.5,e=0.,b,g=4.,E=.6,D=.2;"
"for(int i=0;i<4;i++)"
"p=n(vec3(v.x,v.y+F+.05,v.z),vec3(2,.2,F))-.05,l=min(l,p),F+=.2;"
"l+=x(v.xz*50.+2e2,.01,0);"
"l+=x(v.xz*50.+2e2,.01,0)-x(v.yz*2.+1.5,.15,0);"
"c=min(c,l);"
"if(c==l)"
"z=2.;"
@ -159,21 +159,22 @@ const char *__temp_cleaned_shader_glsl =
"z=4.;"
"if(c==f)"
"if(y>p+.2)"
"z=5.,i=f;"
"z=5.,i=min(l,f);"
"}"
"}"
"return vec3(c,z,i);"
"}"
"float t(vec3 v,vec3 y,int f)"
"{"
"float m,i=0.;"
"vec3 m;"
"float i=0.;"
"for(int c=0;c<100;c++)"
"{"
"m=x(v+y*i,0).x;"
"m=x(v+y*i,0);"
"if(f==0)"
"z+=.05/(1.+10.*pow(x(v+y*i,0).z,.5));"
"i+=m;"
"if(m<1e-4||i>6e2)"
"z+=.05/(1.+10.*pow(m.z,.5));"
"i+=m.x;"
"if(m.x<.001||i>4e2)"
"break;"
"}"
"return i;"
@ -183,13 +184,13 @@ const char *__temp_cleaned_shader_glsl =
"vec2 y=vec2(.01,0);"
"return f(x(v,1).x-vec3(x(v-y.xyy,1).x,x(v-y.yxy,1).x,x(v-y.yyx,1)));"
"}"
"float f(vec3 v,vec3 y,float m,vec3 c)"
"float f(vec3 v,vec3 y,float m,vec3 z)"
"{"
"float i=1.;"
"vec3 l=f(y-v);"
"i=f(dot(c,l),0.,i);"
"float d=t(v+c*.0025,l,1);"
"if(d<length(y-v))"
"i=f(dot(z,l),0.,i);"
"float c=t(v+z*.0025,l,1);"
"if(c<length(y-v))"
"i*=m;"
"return i;"
"}"