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

@ -6,7 +6,7 @@ PROJECT_INFO_FILE=prod.nfo
PROJECT_SCREENSHOT=
# Currently active config file name
ACTIVE_CONFIG=minified.config
ACTIVE_CONFIG=base.config
# ------- GUI options/preferences --------
# Automatically rebuild DLLs when things have changed?

View File

@ -8,8 +8,8 @@ MUSIC_BEATS_PER_BAR=4.0
########### Visuals ############
SHADER_FILE=shader.glsl
RESOLUTION_X=1920
RESOLUTION_Y=1080
RESOLUTION_X=1280
RESOLUTION_Y=720
USE_TIME_UNIFORM=1
TIME_UNIFORM_NAME='u_time'
@ -23,7 +23,7 @@ FRAME_TO_TEXTURE=0
USE_MIPMAP=0
SECOND_PASS_NEGATIVE_TIME=0
# Texts
# Texts
USE_TEXTS=0
USE_TEXTS_UNIFORM=0
TEXTS_UNIFORM_NAME='texts'

View File

@ -170,7 +170,7 @@ vec3 map(vec3 p, int displace)
vec3 p2 = ringAnim(p), q2=p2;
an = PI/16.;
q2.xy = rot2D(floor((atan(p2.y,p2.x)/an) + .5)*an)*q2.xy;
d2 = sdBox2( q2.xyz - vec3(1.75,0.,0.), vec3(.04, .14, .05) ) - .02;
d2 = sdBox2( q2.xyz - vec3(1.75,0.,0.), vec3(.04, .14, .05) ) - .02 + noise(p.xy*100.,1e-3,0);
d = min(d, d2);
if (d==d2) mat = 6.;

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;"
"}"