Instagram post by @baulandscape3 Bau Landscape

#threejs #shader #fragment #landscape #generative #procedural #Soderfors #SE #64.816673 #18.049999 #broken_clouds #7.53°C #define MAX_OCTAVES 7
uniform vec2 u_resolution;
float map(float value,float min1,float max1,float min2,float max2){
return min2+(value-min1)*(max2-min2)/(max1-min1);
}
float random(in vec2 st){
return fract(sin(dot(st.xy,vec2(12.9898,78.233)))*43758.5453123);
}
float noise(in vec2 st){
vec2 i=floor(st);
vec2 f=fract(st);
float a=random(i);
float b=random(i+vec2(1.,.0));
float c=random(i+vec2(.0,1.));
float d=random(i+vec2(1.,1.));
vec2 u=f*f*(3.-2.*f);
return mix(a,b,u.x)+(c-a)*u.y*(1.-u.x)+(d-b)*u.x*u.y;
}
float fbm(in vec2 n,in float l){
float v=.0;
float lacunarity=2.;
float a=.75;
n*=l;
for(int i=0;i<MAX_OCTAVES;i++){
v+=a*noise(n);
n*=lacunarity;
a*=.5;
}
return v;
}
float plot(vec2 st,float pct){
return 1.-smoothstep(pct,pct+.005,st.y);
}
void main(){
vec2 st=gl_FragCoord.xy/u_resolution.xy;
st.x*=u_resolution.x/u_resolution.y;
float m=st.x*.5+.5;
vec3 colorA=vec3(0.70,0.24,1.00);
vec3 colorB=vec3(0.92,0.08,1.00);
vec3 color=vec3(0.14,0.24,1.00);
float y;
float pct;
vec2 coords=vec2(64.816673,18.049999);
float i;
for(float i=4.0;i>0.;i--){
y=i/(4.0*i)*m*(fbm(.2*m*coords*i,1./(4.0+i))-.75)+i*2./(4.0+i);
pct=plot(st,y);
color=mix(color,vec3(map(i,.0,4.0,colorA.r,colorB.r),map(i,.0,4.0,colorA.g,colorB.g),map(i,.0,4.0,colorA.b,colorB.b)),pct);
}
gl_FragColor=vec4(color,1.);
}

Most Popular Instagram Hashtags