• NFT
  • Explore
  • Challenge
Sign in Sign up
Create Art arrow_drop_down
settings
Templates Resources
help CANCEL
Save
xxxxxxxxxx
40
 
1
//Reference:https://neort.io/product/bvcrf5s3p9f7gigeevf0
2
precision highp float;
3
uniform vec2 resolution;
4
uniform float time;
5
#define rot(a) mat2(cos(a),sin(a),-sin(a),cos(a))
6
#define TAU atan(1.)*8.
7
vec2 pmod(vec2 p, float n)
8
{
9
  float a=mod(atan(p.y, p.x),TAU/n)-.5 *TAU/n;
10
  return length(p)*vec2(sin(a),cos(a));
11
}
12
float map(vec3 p)
13
{
14
    p.z-=-time*2.;
15
    p.z=mod(p.z,4.)-2.0;
16
    for(int i=0;i<6;i++)
17
    {
18
        p.xy=pmod(p.xy,8.);
19
        p.y-=1.935;
20
    }
21
    return dot(abs(p),normalize(vec3(1,0,1)))-0.2;
22
}
23
void main(){
24
    vec4 fragColor = vec4(0.0);
25
    vec2 uv=(gl_FragCoord.xy-.5*resolution)/resolution.y;
26
    vec3 rd=normalize(vec3(uv,1));
27
    vec3 p=vec3(0,0,-70);
28
    float d=1.,ix;
29
    for(int i=0;i<99;i++){
30
      p+=rd*(d=map(p));
31
      ix++;
32
      if (d<.001){break;}
33
    }
34
    if(d<.001) {
35
      fragColor += 4.6/ix;
36
      fragColor += normalize(vec4(100,35,00,0))*9./ix;
37
    }
38
    gl_FragColor = fragColor;
39
    gl_FragColor.w = 1.0;
autorenew