0x4f59…60c8

All memos sent from and to 0x4f59…60c8.

***Laterals*** began with a simple premise: to evoke a sense of deliberate structure despite the purely aleatoric nature of the underlying algorithm. The title refers to the various rotations given to the cuboids that conform to the scenes. The pieces are constructed with fundamental primitives in three-dimensional computer graphics. The organization of the objects on the scene originates from different noise distributions. I chose an isometric projection to create a certain ambiguity in depth. That allows for interesting dynamics of colour, light and shadow. I am fascinated by how, as humans, we are bound and almost desperate to find order, meaning and patterns, even in the face of explicitly random events. **Note:** The piece's configurations are determined by their mint number. While they fully generate in real-time, they are a pre-selection of random structures encoded in an "alias" described in the feature set of any given piece. That means that there are only 50 possible pre-selected outputs that can occur, based on minting order from 0 to 49. **Exporting instructions** You may export your pieces to disk with different resolutions via the interactive controls. If you intend to make a printout, ensure you first disable the background effects (using *shift+N*) and only then export. Otherwise, you will be exporting additional digital textures unnecessary for printing on paper. **Controls** **shift+O**: export at current resolution **shift+E**: export at 4k **shift+S**: export at 6k **shift+N**: remove background effects **shift+B**: add background effects
ottom=-5,s.shadow.mapSize.set(6*i.x,6*i.y),s}function generateCubeMap(){var e=document.createElement("canvas");const t=1024,r=1024;e.width=t,e.height=r;var a=e.getContext("2d");function i(e,t,r){e.addColorStop(0,t),e.addColorStop(1,r),a.fillStyle=e}function s(e){a.fillStyle=e,a.fillRect(0,0,t,r)}function n(e){let s={x:.65,y:.05};var n=a.createRadialGradient(t*s.x,r*s.y,204.8,t*s.x,r*s.y,819.2);i(n,"white","#777065");const o=e?[.15,1]:[0,.75];a.fillRect(t*o[0],153.6,t*o[1],409.6),e&&(s={x:.5,y:.5},i(n=a.createRadialGradient(t*s.x,r*s.y,204.8,t*s.x,r*s.y,614.4),"white","blue"),a.fillRect(153.6,358.4,716.8,204.8)),s={x:.5,y:.1},i(n=a.createRadialGradient(t*s.x,r*s.y,512,t*s.x,r*s.y,921.6),"#3d3c3b","#777065"),a.fillRect(0,614.4,t,921.6)}let o=[];const l=[n,n,s,s,function(e){let s={x:.5,y:.5};var n=a.createRadialGradient(t*s.x,r*s.y,0,t*s.x,r*s.y,512);i(n,"white","#858ba0"),a.fillRect(0,358.4,t,204.8),s={x:.5,y:.1},i(n=a.createRadialGradient(t*s.x,r*s.y,409.6,t*s.x,r*s.y,819.2),"white","#777065"),a.fillRect(0,614.4,t,921.6)},function(e){i(a.createRadialGradient(512,512,204.8,512,512,768),"white","blue"),a.fillRect(0,358.4,t,256)}],u=[!0,!1,"000000","3f3d3c",1,1];for(let i=0;i<6;i++)a.fillStyle="#000000",a.fillRect(0,0,t,r),l[i](u[i]),o.push(e.toDataURL());return o}function getParams(){let e=mintParams.rotation,t=mintParams.sphereSettings[1],r=mintParams.circleSettings[1];return{palette:palettes[mintParams.color],ratioMode:1,cameraZ:10,viewSize:2.5,bgMode:0,background:new THREE.Color(mintParams.background[0],mintParams.background[1],mintParams.background[2]),wrapMode:"mirror",toneMappingExposure:1.75,baseColor:new THREE.Vector4(1,1,1,1),generalScale:mintParams.generalScale,lightPos1:mintParams.lights[0][0],lightIntensity1:mintParams.lights[0][1],lightPos2:mintParams.lights[1][0],lightIntensity2:mintParams.lights[1][1],boxSimplexFreq:1e3,boxBaseScale:.5,boxOpacity:.9,boxEnvIntensity:.3,boxRoughness:.5,boxMetalness:.1,boxRotation:90,boxInstances:mintParams.boxSettings[0],boxScaleRange:mintParams.boxSettings[1],boxPosRange:mintParams.boxSettings[2],boxMeshRot:e,boxVtxDisp:0,boxColoringMode:mintParams.boxSettings[3],sphereOpacity:.8,sphereEnvIntensity:.9,sphereRoughness:.9,sphereMetalness:.3,sphereRotation:0,sphereInstances:mintParams.sphereSettings[0],sphereScaleRange:[t,t,t],spherePosRange:mintParams.sphereSettings[2],sphereMeshPos:[0,0,0],sphereMeshRot:e,sphereVtxDisp:0,sphereColoringMode:[0,0],circleOpacity:.75,circleMeshPosition:[0,0,3],circleEnvIntensity:1,circleRoughness:1,circleMetalness:1,circleBaseScale:.5,circleRotation:0,circleInstances:mintParams.circleSettings[0],circleScaleRange:[r,r,r],circlePosRange:mintParams.circleSettings[2],circleMeshRot:e,circleVtxDisp:0,circleColoringMode:[0,0],lineOpacity:.25,lineRotation:90,lineInstances:mintParams.lineSettings[0],lineScaleRange:[mintParams.lineSettings[1][0],mintParams.lineSettings[1][1],mintParams.lineSettings[1][1]],linePosRange:mintParams.sphereSettings[2],lineMeshRot:e,lineVtxDisp:0,lineColoringMode:[1,0],saoBias:mintParams.saoBias,saoIntensity:.38,saoScale:.5,saoKernelRadius:85,saoMinResolution:5e-4,saoBlurRadius:60,saoBlurStdDev:20,saoBlurDepthCutoff:.0015,bloomThreshold:mintParams.bloom[0],bloomStrength:mintParams.bloom[1],bloomRadius:mintParams.bloom[2],displacementOctaves:3,noiseSeed:100*R.r(),applyCanvas:!0,canvasDetail:2.5,grainAmt:.05}}function customPBRMaterial(e,t){e.uniforms=t;const r="#include <common>\n#define I int\n#define F float\n#define V2 vec2\n#define V3 vec3\n#define V4 vec4\n#define FR fract\n#define M mix\nuniform vec4 uBC; uniform vec3 uSR; uniform vec3 uPR;uniform float uRT;uniform float uVD;uniform float uGS;attribute int aID;attribute vec3 aPos;attribute vec3 aScale;attribute vec3 aAxis;attribute vec3 aColor;varying vec2 vUv;varying vec4 vc;flat varying int vTexID;flat varying int vvi;varying vec3 vrv;varying float vRatio;mat4 rotationMatrix(V3 v, F a){v=normalize(v);F s=sin(a);F c=cos(a);F oc=1.-c;return mat4(oc*v.x*v.x+c, oc*v.x*v.y-v.z*s, oc*v.z*v.x+v.y*s, 0.,oc*v.x*v.y+v.z*s, oc*v.y*v.y+c, oc*v.y*v.z-v.x*s, 0.,oc*v.z*v.x-v.y*s, oc*v.y*v.z+v.x*s,oc*v.z*v.z+c,0.,0.,0.,0.,1.);}F hash11(F p){p = FR(p*.1031);p*=p+ 33.33;p*=p+p;return FR(p);}V3 hash31(F p) {V3 p3 = FR(V3(p)*V3(.1031,.1030,.0973));p3+=dot(p3,p3.yzx+33.33); return FR((p3.xxy+p3.yzz)*p3.zyx);}",a="I id=aID; I vid=gl_VertexID; V3 NS=hash31(F(id)*3.+F(vid))*2.-1.; V3 P=transformed; V3 SC=aScale*uSR; V3 TS=aPos*uPR;V3 NP=P*SC;V4 RT=rotationMat*V4(NP, 1.);NP=RT.xyz;NP+=TS;NP+=NS*uVD;NP*=uGS;transformed=NP;vUv=uv;vc=V4(1.);vvi=vid;vrv=hash31(F(id));";e.onBeforeCompile=e=>{for(const r in t)e.uniforms[r]=t[r];e.vertexShader=e.vertexShader.replace("#include <common>",r),e.vertexShader=e.vertexShader.replace("#include <beginnormal_vertex>"," #include <beginnormal_vertex>\nmat4 rotationMat = rotationMatrix(aAxis, radians(uRT));V4 NN=rotationMat*V4(objectNormal, 1);objectNormal=normalize(NN.xyz);"),e.vertexShader=e.vertexShader.replace("#include <begin_vertex>",`#include <begin_vertex>\n${a} vc = V4(aColor,1.)*uBC;\n `),e.fragmentShader=e.fragmentShader.replace("#include <common>","#include <common>\n#define I int\n#define V2 vec2\n#define V3 vec3\n#define V4 vec4\n#define FR fract\n#define M mix\n#define GRAD 1 \n#define SEMI 3\n#define SGRAD 4\nvarying vec4 vc;varying vec2 vUv;flat varying int vvi;varying vec3 vrv;uniform vec3 uC0;uniform vec3 uC1;uniform vec3 uC2;uniform vec3 uC3;uniform vec3 uC4;uniform vec2 uCM;"),e.fragmentShader=e.fragmentShader.replace("vec4 diffuseColor = vec4( diffuse, opacity );","V2 uv=vUv;V4 diffuseColor=V4(vc.rgb,opacity);V3 cs[5]=V3[5](uC0,uC1,uC2,uC3,uC4);I i=I(vrv.x * 2.99);I j=I(vrv.y*1.99);I m=I(uCM.x);I o=I(uCM.y);V3 fc=diffuseColor.rgb;if(m==GRAD){fc=M(diffuseColor.rgb,cs[(i+o)%5],uv[j]);}else if(m==SEMI){V3 color=vvi<6?cs[(0+o)%5]:vvi<12?cs[(1+o)%5]:vvi<18?cs[(2+o)%5]:cs[(4+o)%5];fc=color;}else if(m==SGRAD){V3 color=vvi<6?M(cs[(0+o)%5],cs[(1+o)%5],(uv.x+uv.y)*.5):vvi<12?M(cs[(2+o)%5],cs[(3+o)%5],uv.x):vvi<18?M(cs[(4+o)%5],cs[(0+o)%5],uv.y):M(cs[(1+o)%5],cs[(2+o)%5],(uv.y+uv.x)*.5);fc=color;}diffuseColor.rgb=fc;")};const i=new THREE.MeshDepthMaterial({depthPacking:THREE.RGBADepthPacking});return i.onBeforeCompile=e=>{for(const r in t)e.uniforms[r]=t[r];e.vertexShader=e.vertexShader.replace("#include <common>",r),e.vertexShader=e.vertexShader.replace("#include <begin_vertex>",`#include <begin_vertex>\nmat4 rotationMat=rotationMatrix(aAxis,radians(uRT));${a}`)},[e,i]}function getNoiseTexture(e,t,r,a){return{shader:new THREE.ShaderMaterial({uniforms:{uTime:u(0),uRes:u(e),uSeed:u(t)},vertexShader:"varying vec2 vUv;void main(){vUv = uv;gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.);}",fragmentShader:`\n #define PI 3.141592\n #define FL float\nvarying vec2 vUv;uniform float uTime;uniform vec2 uRes;uniform float uSeed;${simplexNoise}FL fbm(vec3 x, FL f, FL g, FL amp, FL o){FL t=0.;FL a=1.;for(int i=0;i<${a};i++){t+=psrdnoise(f*x,vec3(0.),1.);f*=2.;a*=g;}return t*amp+o;}void main(){vec2 res=uRes;vec2 uv=vUv;FL aspect=res.x/res.y;uv.x*=aspect;${r}gl_FragColor = vec4(vec3(c),1.);}`}),pixelFormat:{depthBuffer:!1,stencilBuffer:!1,format:THREE.RGBAFormat,type:THREE.FloatType,internalFormat:"RGB8"}}}function displacementShader(e,t){return{uniforms:{tDiffuse:u(null),uRes:u([e.x*t,e.y*t]),sNoise:u(null),uCF:u([p.canvasDetail,p.applyCanvas]),uGF:u(p.grainAmt),uPF:u(postFX?1:0)},vertexShader:"varying vec2 vUv; void main(){gl_Position=projectionMatrix*modelViewMatrix*vec4(position,1.);vUv=uv;}",fragmentShader:"#define TAU 6.28318530718\n#define V2 vec2\n#define V3 vec3\n#define V4 vec4\n#define FL float\n\nuniform sampler2D tDiffuse;uniform vec2 uRes;uniform sampler2D sNoise;uniform vec2 uCF;uniform float uGF;uniform float uPF;varying vec2 vUv;FL hash12(V2 p){V3 p3=fract(V3(p.xyx)*.1031);p3+=dot(p3,p3.yzx+33.33);return fract((p3.x+p3.y)*p3.z);}V2 uvS(V2 p,V2 r){return p+.6*sin(p*r*TAU)/TAU/r;}V4 sno(V2 p,V2 r){V2 uv=p/r;uv=uvS(uv,r);return texture(sNoise,uv);}V3 gct(V2 xy,FL s,V2 q){V4 r=sno(xy*1.2/sqrt(s),q)-sno(xy*1.2/sqrt(s)+V2(1,-1)*1.5,q);return .95+.05*r.xxx+.05*r.xyz;}void main(){V2 uv=vUv;V2 xy=gl_FragCoord.xy;V4 data=texture2D(tDiffuse,uv);V3 C=data.rgb;FL S=uCF.x;V3 ca=gct(xy,S,uRes);C=mix(C,C*ca,uCF.y*uPF);FL gr=hash12(xy)*uGF;C+=(C*gr*uPF);gl_FragColor=V4(C,1.);}"}}function createNoiseTexture(e,t){return noisePass=getNoiseTexture(e,p.noiseSeed,"FL c=fbm(vec3(uv,uSeed),15.,.7,.2,.3);c+=fbm(vec3(uv,uSeed),193.,.4,.15,.05);",p.displacementOctaves),writeStaticTexture(renderer,{x:e.x,y:e.y},noisePass.pixelFormat,noisePass.shader)}const setArrayIdxs=(e,t,r)=>{e[t]=r[0],e[t+1]=r[1],e[t+2]=r[2]},setAttr=(e,t,r,a)=>{a.setAttribute(e,new THREE.InstancedBufferAttribute(t,r))},af32=e=>new Float32Array(3*e),ai32=e=>new Int32Array(e);function createAttributes(e){return{ids:ai32(e),pos:af32(e),sca:af32(e),axi:af32(e),col:af32(e),rot:ai32(e)}}function updateAttributes(e,t,r,a,i,s){e.ids[a]=s[0],setArrayIdxs(e.sca,i,s[2]),setArrayIdxs(e.pos,i,s[3]),setArrayIdxs(e.axi,i,s[4]),setArrayIdxs(e.col,i,s[5]),t.position.set(0,0,0),t.updateMatrix(),r.setMatrixAt(a,t.matrix)}function setAttributes(e,t){setAttr("aID",e.ids,1,t),setAttr("aPos",e.pos,3,t),setAttr("aScale",e.sca,3,t),setAttr("aAxis",e.axi,3,t),setAttr("aColor",e.col,3,t)}function createInstances(e,t,r,a,i=!1,s=[]){const n=Math.sqrt(e),o=createNoise2D(new Random),l=new THREE.Object3D;let u=createAttributes(e);const h=p.boxSimplexFreq;for(let t=0,r=0,c=e;t<c;t++,r+=3){let e=[parseInt(t%n)/n*h,parseInt(t/n)/n*h];const c=[.5*o(e[0],e[1])+.5,.5*o(e[0]+h,e[1]+h)+.5,.5*o(e[0]+2*h,e[1]+2*h)+.5];let d,m=s.length;if(m<1){d=[o(e[0]+3*h,e[1]+3*h),o(e[0]+4*h,e[1]+4*h),o(e[0]+5*h,e[1]+5*h)]}else d=s[t%m];const f=o(e[0]+6*h,e[1]+6*h);let v=[0,0,0],g=1,x=p.palette[0];f<.25?(v=[0,1,0],x=p.palette[1]):f<.5?(v=[0,0,1],x=p.palette[2]):f<.75?(v=[-1,0,0],x=p.palette[0]):g=0,i&&(x=p.palette[R.ri(0,4)]);updateAttributes(u,l,a,t,r,[t,g,c,d,v,toRGB(x)])}setAttributes(u,r)}function createSphereInstances(e,t,r,a){const i=new THREE.Object3D;let s=createAttributes(e),n=[];for(let t=0,r=0,o=e;t<o;t++,r+=3){const e=R.r(),o=[e,e,e],l=[R.rr(-1,1),R.rr(-1,1),R.rr(-1,1)];n.push(l);const u=R.r();let h=[0,0,0],c=1;u<.25?h=[0,1,0]:u<.5?h=[0,0,1]:u<.75?h=[-1,0,0]:c=0,updateAttributes(s,i,a,t,r,[t,c,o,l,h,toRGB(p.palette[R.rc([0,3,4])])])}return setAttributes(s,r),n}function createCircleInstances(e,t,r,a){const i=createNoise2D(new Random);let s=100;const n=Math.floor(Math.sqrt(e)),o=new THREE.Object3D;let l=createAttributes(e);for(let t=0,r=0,u=e;t<u;t++,r+=3){let e=[parseInt(t%n)/n*s,parseInt(t/n)/n*s];const u=R.r(),h=[u,u,u],c=[i(e[0]+s,e[1]+s),i(e[0]+200,e[1]+200),i(e[0]+300,e[1]+300)],d=R.r();let m=[0,0,0],f=1;d<.25?m=[0,1,0]:d<.5?m=[0,0,1]:d<.75?m=[-1,0,0]:f=0,updateAttributes(l,o,a,t,r,[t,f,h,c,m,toRGB(p.palette[R.ri(0,4)])])}setAttributes(l,r)}function applyCubeMap(e,t,r=!1,a=null){const i=new THREE.PMREMGenerator(renderer),s=(new THREE.CubeTextureLoader).load(e,(()=>{for(let e of t)e.envMap=i.fromCubemap(s).texture;i.dispose(),composer.render(),r&&exportCustom()}))}function prepareMesh(e,t){e.receiveShadow=e.castShadow=e.frustumCulled=!0,e.customDepthMaterial=t,e.needsUpdate=!0,scene.add(e)}function getDim(e,t=null){let r=window.innerHeight,a=window.innerHeight;return null!==t&&(r=a=t),r*=.75,{x:r,y:a,a:.75}}function makeUniforms(e,t,r,a,i){return{uGS:u(p.generalScale),uC0:u(toRGB(p.palette[0])),uC1:u(toRGB(p.palette[1])),uC2:u(toRGB(p.palette[2])),uC3:u(toRGB(p.palette[3])),uC4:u(toRGB(p.palette[4])),uRT:u(e),uSR:u(t),uPR:u(r),uBC:u(p.baseColor),uVD:u(a),uCM:u(i)}}function init(e=null){R=new Random,p=getParams(),dim=getDim(p.ratioMode,e),scene=new THREE.Scene,renderer=new THREE.WebGLRenderer({antialias:!0,preserveDrawingBuffer:1,powerPreference:"high-performance"}),createContainer(renderer),renderer.setSize(dim.x,dim.y),renderer.setClearColor(p.background,1),renderer.physicallyCorrectLights=!0,renderer.toneMapping=THREE.ACESFilmicToneMapping,renderer.toneMappingExposure=p.toneMappingExposure,renderer.outputEncoding=THREE.sRGBEncoding,renderer.shadowMap.enabled=!0,renderer.shadowMap.type=THREE.PCFSoftShadowMap;const t=new THREE.Vector2;renderer.getDrawingBufferSize(t),dim={x:t.width,y:t.height,a:t.width/t.height};renderer.setPixelRatio(2);const r=p.viewSize;camera=new THREE.OrthographicCamera(-r*dim.a,r*dim.a,r,-r,.1,30),camera.position.set(0,0,p.cameraZ);let a=new THREE.MeshStandardMaterial;a.envMapIntensity=p.boxEnvIntensity,a.roughness=p.boxRoughness,a.metalness=p.boxMetalness,a.opacity=p.boxOpacity,a.transparent=!0;let i=new THREE.MeshStandardMaterial;i.envMapIntensity=p.sphereEnvIntensity,i.roughness=p.sphereRoughness,i.metalness=p.sphereMetalness,i.opacity=p.sphereOpacity,i.transparent=!0;let s=new THREE.MeshStandardMaterial;s.envMapIntensity=1,s.roughness=p.circleRoughness,s.metalness=p.circleMetalness,s.opacity=p.circleOpacity,s.transparent=!0;let n,o,l,u=new THREE.MeshStandardMaterial;u.envMapIntensity=p.boxEnvIntensity,u.roughness=p.boxRoughness,u.metalness=p.boxMetalness,u.opacity=p.lineOpacity,u.transparent=!0,materialsList=[a,u,i,s],n=makeUniforms(p.boxRotation,p.boxScaleRange,p.boxPosRange,p.boxVtxDisp,p.boxColoringMode);const h=customPBRMaterial(a,n);o=h[0],l=h[1];let c=p.boxBaseScale,d=new THREE.BoxBufferGeometry(c,c,c),m=new THREE.InstancedMesh(d,o,p.boxInstances);prepareMesh(m,l),createInstances(p.boxInstances,o,d,m),m.rotation.set(toRadians(p.boxMeshRot[0]),toRadians(p.boxMeshRot[1]),toRadians(p.boxMeshRot[2])),n=makeUniforms(p.sphereRotation,p.sphereScaleRange,p.spherePosRange,p.sphereVtxDisp,p.sphereColoringMode);const f=customPBRMaterial(i,n);o=f[0],l=f[1];let v=new THREE.SphereBufferGeometry(1,32,32),g=new THREE.InstancedMesh(v,o,p.sphereInstances);prepareMesh(g,l);let x=createSphereInstances(p.sphereInstances,o,v,g);g.position.set(p.sphereMeshPos[0],p.sphereMeshPos[1],p.sphereMeshPos[2]),g.rotation.set(toRadians(p.sphereMeshRot[0]),toRadians(p.sphereMeshRot[1]),toRadians(p.sphereMeshRot[2])),n=makeUniforms(p.circleRotation,p.circleScaleRange,p.circlePosRange,p.circleVtxDisp,p.circleColoringMode);const E=customPBRMaterial(s,n);o=E[0],l=E[1];let M=new THREE.CircleBufferGeometry(p.circleBaseScale,32),T=new THREE.InstancedMesh(M,o,p.circleInstances);prepareMesh(T,l),createCircleInstances(p.circleInstances,o,M,T),T.position.set(p.circleMeshPosition[0],p.circleMeshPosition[1],p.circleMeshPosition[2]),n=makeUniforms(p.lineRotation,p.lineScaleRange,p.linePosRange,p.lineVtxDisp,p.lineColoringMode);const S=customPBRMaterial(u,n);o=S[0],l=S[1],c=p.boxBaseScale;let C=new THREE.BoxBufferGeometry(c,c,c),y=new THREE.InstancedMesh(C,o,p.lineInstances);y.receiveShadow=y.castShadow=y.frustumCulled=!1,y.customDepthMaterial=l,y.needsUpdate=!0,scene.add(y),createInstances(p.boxInstances,o,C,y,!0,x),y.rotation.set(toRadians(p.boxMeshRot[0]),toRadians(p.boxMeshRot[1]),toRadians(p.boxMeshRot[2]));const b=new THREE.AmbientLight(16777215,.25);scene.add(b);let D=getDirLight(p.lightPos1,16777215,p.lightIntensity1,!0,dim);scene.add(D);let P=getDirLight(p.lightPos2,16777215,p.lightIntensity2,!0,dim);scene.add(P);let w=913;const B=new THREE.WebGLMultisampleRenderTarget(dim.x,dim.y,{minFilter:THREE.LinearFilter,magFilter:THREE.LinearFilter,format:THREE.RGBAFormat});composer=new EffectComposer(renderer,B),composer.setSize(2*dim.x,2*dim.y);let F=new RenderPass(scene,camera);composer.addPass(F);let A=new SAOPass(scene,camera,!0,!1);A.resolution.set(2*dim.x,2*dim.y),A.params.saoBias=p.saoBias,A.params.saoScale=p.saoScale,A.params.saoKernelRadius=dim.y>w?p.saoKernelRadius*Math.pow(dim.y/w,1.24):p.saoKernelRadius,A.params.saoIntensity=dim.y>w?p.saoIntensity*Math.pow(w/dim.y,.5):p.saoIntensity,A.params.saoMinResolution=p.saoMinResolution,A.params.saoBlurRadius=p.saoBlurRadius,A.params.saoBlurStdDev=p.saoBlurStdDev,A.params.saoBlurDepthCutoff=p.saoBlurDepthCutoff,composer.addPass(A),saoComposer=new EffectComposer(renderer),saoComposer.setSize(2*dim.x,2*dim.y),saoComposer.renderToScreen=!1,saoComposer.addPass(F),saoComposer.addPass(A);let H=new UnrealBloomPass(dim,.1,.5,.75);H.threshold=p.bloomThreshold,H.radius=p.bloomRadius,H.strength=dim.y>w?p.bloomStrength*Math.pow(w/dim.y,.33):p.bloomStrength,composer.addPass(H);let V=createNoiseTexture(dim,2);postfxPass=new ShaderPass(displacementShader(dim,2)),postfxPass.uniforms.sNoise.value=V,composer.addPass(postfxPass),camera.lookAt(m.position),window.addEventListener("resize",onWindowResize),document.addEventListener("keydown",onDocumentKeyDown,!1)}function updateResize(){const e=new THREE.Vector2;renderer.getDrawingBufferSize(e);const t={x:e.width,y:e.height,aspect:e.width/e.height};noisePass.shader.uniforms.uRes.value=[t.x,t.y],postfxPass.uniforms.uRes.value=[t.x,t.y],camera.aspect=t.aspect,camera.updateProjectionMatrix()}function sizeTransform(e=null,t=2){let r=getDim(p.ratioMode,e);renderer.setSize(r.x,r.y),renderer.setPixelRatio(t),updateResize(),composer.render()}function onWindowResize(){sizeTransform()}function onDocumentKeyDown(e){var t=e.which;if(e.shiftKey)switch(t){case 69:sizeTransform(3840,1),exportCustom();break;case 83:sizeTransform(5760,1),exportCustom();break;case 66:postFX=!0,postfxPass.uniforms.uPF.value=postFX,composer.render();break;case 78:postFX=!1,postfxPass.uniforms.uPF.value=postFX,composer.render();break;case 79:composer.render(),exportCustom()}}const saveFile=function(e,t){const r=document.createElement("a");"string"==typeof r.download?(document.body.appendChild(r),r.download=t,r.href=e,r.click(),document.body.removeChild(r)):location.replace(uri)};function exportCustom(){let e;Date.now||(Date.now=function(){return(new Date).getTime()});let t=Math.floor(Date.now()/1e3);try{const r="image/png";e=renderer.domElement.toDataURL(r),saveFile(e.replace(r,"image/octet-stream"),`Laterals#${mintNumber}_${t}.png`)}catch(e){return void console.log(e)}sizeTransform(window.innerHeight)}init(null),applyCubeMap(cubemap,materialsList);
s(e,t,r,a,i){e.getClearColor(this.originalClearColor);const s=e.getClearAlpha(),n=e.autoClear;e.setRenderTarget(r),e.autoClear=!1,null!=a&&(e.setClearColor(a),e.setClearAlpha(i||0),e.clear()),this.fsQuad.material=t,this.fsQuad.render(e),e.autoClear=n,e.setClearColor(this.originalClearColor),e.setClearAlpha(s)}renderOverride(e,t,r,a,i){e.getClearColor(this.originalClearColor);const s=e.getClearAlpha(),n=e.autoClear;e.setRenderTarget(r),e.autoClear=!1,a=t.clearColor||a,i=t.clearAlpha||i,null!=a&&(e.setClearColor(a),e.setClearAlpha(i||0),e.clear()),this.scene.overrideMaterial=t,e.render(this.scene,this.camera),this.scene.overrideMaterial=null,e.autoClear=n,e.setClearColor(this.originalClearColor),e.setClearAlpha(s)}setSize(e,t){this.beautyRenderTarget.setSize(e,t),this.saoRenderTarget.setSize(e,t),this.blurIntermediateRenderTarget.setSize(e,t),this.normalRenderTarget.setSize(e,t),this.depthRenderTarget.setSize(e,t),this.saoMaterial.uniforms.size.value.set(e,t),this.saoMaterial.uniforms.cameraInverseProjectionMatrix.value.copy(this.camera.projectionMatrixInverse),this.saoMaterial.uniforms.cameraProjectionMatrix.value=this.camera.projectionMatrix,this.saoMaterial.needsUpdate=!0,this.vBlurMaterial.uniforms.size.value.set(e,t),this.vBlurMaterial.needsUpdate=!0,this.hBlurMaterial.uniforms.size.value.set(e,t),this.hBlurMaterial.needsUpdate=!0}}SAOPass.OUTPUT={Beauty:1,Default:0,SAO:2,Depth:3,Normal:4};const LuminosityHighPassShader={shaderID:"luminosityHighPass",uniforms:{tDiffuse:{value:null},luminosityThreshold:{value:1},smoothWidth:{value:1},defaultColor:{value:new THREE.Color(0)},defaultOpacity:{value:0}},vertexShader:"varying vec2 vUv;void main(){vUv=uv;gl_Position=projectionMatrix*modelViewMatrix*vec4(position,1);}",fragmentShader:"uniform sampler2D tDiffuse;uniform vec3 defaultColor;uniform float defaultOpacity,luminosityThreshold,smoothWidth;varying vec2 vUv;void main(){vec4 d=texture2D(tDiffuse,vUv);vec3 v=vec3(.299,.587,.114);float l=dot(d.xyz,v);vec4 t=vec4(defaultColor.xyz,defaultOpacity);float s=smoothstep(luminosityThreshold,luminosityThreshold+smoothWidth,l);gl_FragColor=mix(t,d,s);}"};class UnrealBloomPass extends Pass{constructor(e,t,r,a){super(),this.strength=t,this.radius=r,this.threshold=a,this.resolution=new THREE.Vector2(e.x,e.y),this.clearColor=new THREE.Color(0,0,0),this.renderTargetsHorizontal=[],this.renderTargetsVertical=[],this.nMips=5;let i=Math.round(this.resolution.x/2),s=Math.round(this.resolution.y/2);this.renderTargetBright=new THREE.WebGLRenderTarget(i,s,{type:THREE.HalfFloatType}),this.renderTargetBright.texture.name="UnrealBloomPass.bright",this.renderTargetBright.texture.generateMipmaps=!1;for(let e=0;e<this.nMips;e++){const t=new THREE.WebGLRenderTarget(i,s,{type:THREE.HalfFloatType});t.texture.name="UnrealBloomPass.h"+e,t.texture.generateMipmaps=!1,this.renderTargetsHorizontal.push(t);const r=new THREE.WebGLRenderTarget(i,s,{type:THREE.HalfFloatType});r.texture.name="UnrealBloomPass.v"+e,r.texture.generateMipmaps=!1,this.renderTargetsVertical.push(r),i=Math.round(i/2),s=Math.round(s/2)}const n=LuminosityHighPassShader;this.highPassUniforms=THREE.UniformsUtils.clone(n.uniforms),this.highPassUniforms.luminosityThreshold.value=a,this.highPassUniforms.smoothWidth.value=.01,this.materialHighPassFilter=new THREE.ShaderMaterial({uniforms:this.highPassUniforms,vertexShader:n.vertexShader,fragmentShader:n.fragmentShader}),this.separableBlurMaterials=[];const o=[3,5,7,9,11];i=Math.round(this.resolution.x/2),s=Math.round(this.resolution.y/2);for(let e=0;e<this.nMips;e++)this.separableBlurMaterials.push(this.getSeperableBlurMaterial(o[e])),this.separableBlurMaterials[e].uniforms.texSize.value=new THREE.Vector2(i,s),i=Math.round(i/2),s=Math.round(s/2);this.compositeMaterial=this.getCompositeMaterial(this.nMips),this.compositeMaterial.uniforms.blurTexture1.value=this.renderTargetsVertical[0].texture,this.compositeMaterial.uniforms.blurTexture2.value=this.renderTargetsVertical[1].texture,this.compositeMaterial.uniforms.blurTexture3.value=this.renderTargetsVertical[2].texture,this.compositeMaterial.uniforms.blurTexture4.value=this.renderTargetsVertical[3].texture,this.compositeMaterial.uniforms.blurTexture5.value=this.renderTargetsVertical[4].texture,this.compositeMaterial.uniforms.bloomStrength.value=t,this.compositeMaterial.uniforms.bloomRadius.value=.1,this.compositeMaterial.uniforms.bloomFactors.value=[1,.8,.6,.4,.2],this.bloomTintColors=[new THREE.Vector3(1,1,1),new THREE.Vector3(1,1,1),new THREE.Vector3(1,1,1),new THREE.Vector3(1,1,1),new THREE.Vector3(1,1,1)],this.compositeMaterial.uniforms.bloomTintColors.value=this.bloomTintColors;const l=CopyShader;this.copyUniforms=THREE.UniformsUtils.clone(l.uniforms),this.blendMaterial=new THREE.ShaderMaterial({uniforms:this.copyUniforms,vertexShader:l.vertexShader,fragmentShader:l.fragmentShader,blending:THREE.AdditiveBlending,depthTest:!1,depthWrite:!1,transparent:!0}),this.enabled=!0,this.needsSwap=!1,this._oldClearColor=new THREE.Color,this.oldClearAlpha=1,this.basic=new THREE.MeshBasicMaterial({transparent:!0}),this.fsQuad=new FullScreenQuad(null)}dispose(){for(let e=0;e<this.renderTargetsHorizontal.length;e++)this.renderTargetsHorizontal[e].dispose();for(let e=0;e<this.renderTargetsVertical.length;e++)this.renderTargetsVertical[e].dispose();this.renderTargetBright.dispose();for(let e=0;e<this.separableBlurMaterials.length;e++)this.separableBlurMaterials[e].dispose();this.compositeMaterial.dispose(),this.blendMaterial.dispose(),this.basic.dispose(),this.fsQuad.dispose()}setSize(e,t){let r=Math.round(e/2),a=Math.round(t/2);this.renderTargetBright.setSize(r,a);for(let e=0;e<this.nMips;e++)this.renderTargetsHorizontal[e].setSize(r,a),this.renderTargetsVertical[e].setSize(r,a),this.separableBlurMaterials[e].uniforms.texSize.value=new THREE.Vector2(r,a),r=Math.round(r/2),a=Math.round(a/2)}render(e,t,r,a,i){e.getClearColor(this._oldClearColor),this.oldClearAlpha=e.getClearAlpha();const s=e.autoClear;e.autoClear=!1,e.setClearColor(this.clearColor,0),i&&e.state.buffers.stencil.setTest(!1),this.renderToScreen&&(this.fsQuad.material=this.basic,this.basic.map=r.texture,e.setRenderTarget(null),e.clear(),this.fsQuad.render(e)),this.highPassUniforms.tDiffuse.value=r.texture,this.highPassUniforms.luminosityThreshold.value=this.threshold,this.fsQuad.material=this.materialHighPassFilter,e.setRenderTarget(this.renderTargetBright),e.clear(),this.fsQuad.render(e);let n=this.renderTargetBright;for(let t=0;t<this.nMips;t++)this.fsQuad.material=this.separableBlurMaterials[t],this.separableBlurMaterials[t].uniforms.colorTexture.value=n.texture,this.separableBlurMaterials[t].uniforms.direction.value=UnrealBloomPass.BlurDirectionX,e.setRenderTarget(this.renderTargetsHorizontal[t]),e.clear(),this.fsQuad.render(e),this.separableBlurMaterials[t].uniforms.colorTexture.value=this.renderTargetsHorizontal[t].texture,this.separableBlurMaterials[t].uniforms.direction.value=UnrealBloomPass.BlurDirectionY,e.setRenderTarget(this.renderTargetsVertical[t]),e.clear(),this.fsQuad.render(e),n=this.renderTargetsVertical[t];this.fsQuad.material=this.compositeMaterial,this.compositeMaterial.uniforms.bloomStrength.value=this.strength,this.compositeMaterial.uniforms.bloomRadius.value=this.radius,this.compositeMaterial.uniforms.bloomTintColors.value=this.bloomTintColors,e.setRenderTarget(this.renderTargetsHorizontal[0]),e.clear(),this.fsQuad.render(e),this.fsQuad.material=this.blendMaterial,this.copyUniforms.tDiffuse.value=this.renderTargetsHorizontal[0].texture,i&&e.state.buffers.stencil.setTest(!0),this.renderToScreen?(e.setRenderTarget(null),this.fsQuad.render(e)):(e.setRenderTarget(r),this.fsQuad.render(e)),e.setClearColor(this._oldClearColor,this.oldClearAlpha),e.autoClear=s}getSeperableBlurMaterial(e){return new THREE.ShaderMaterial({defines:{KERNEL_RADIUS:e,SIGMA:e},uniforms:{colorTexture:{value:null},texSize:{value:new THREE.Vector2(.5,.5)},direction:{value:new THREE.Vector2(.5,.5)}},vertexShader:"varying vec2 vUv;void main(){vUv=uv;gl_Position=projectionMatrix*modelViewMatrix*vec4(position,1);}",fragmentShader:"#include <common>\nvarying vec2 vUv;uniform sampler2D colorTexture;uniform vec2 texSize,direction;float gaussianPdf(float e,float v){return.39894*exp(-.5*e*e/(v*v))/v;}void main(){vec2 v=1./texSize;float A=float(SIGMA),e=gaussianPdf(0.,A);vec4 c=texture2D(colorTexture,vUv)*e;for(int f=1;f<KERNEL_RADIUS;f++){float S=float(f),d=gaussianPdf(S,A);vec2 g=direction*v*S;vec4 i=texture2D(colorTexture,vUv+g),r=texture2D(colorTexture,vUv-g);c+=(i+r)*d;e+=2.*d;}gl_FragColor=vec4(c/e);}"})}getCompositeMaterial(e){return new THREE.ShaderMaterial({defines:{NUM_MIPS:e},uniforms:{blurTexture1:{value:null},blurTexture2:{value:null},blurTexture3:{value:null},blurTexture4:{value:null},blurTexture5:{value:null},bloomStrength:{value:1},bloomFactors:{value:null},bloomTintColors:{value:null},bloomRadius:{value:0}},vertexShader:"varying vec2 vUv;void main(){vUv=uv;gl_Position=projectionMatrix*modelViewMatrix*vec4(position,1);}",fragmentShader:"varying vec2 vUv;uniform sampler2D blurTexture1,blurTexture2,blurTexture3,blurTexture4,blurTexture5;uniform float bloomStrength,bloomRadius,bloomFactors[NUM_MIPS];uniform vec3 bloomTintColors[NUM_MIPS];float lerpBloomFactor(const float b){float v=1.2-b;return mix(b,v,bloomRadius);}void main(){gl_FragColor=bloomStrength*(lerpBloomFactor(bloomFactors[0])*vec4(bloomTintColors[0],1)*texture2D(blurTexture1,vUv)+lerpBloomFactor(bloomFactors[1])*vec4(bloomTintColors[1],1)*texture2D(blurTexture2,vUv)+lerpBloomFactor(bloomFactors[2])*vec4(bloomTintColors[2],1)*texture2D(blurTexture3,vUv)+lerpBloomFactor(bloomFactors[3])*vec4(bloomTintColors[3],1)*texture2D(blurTexture4,vUv)+lerpBloomFactor(bloomFactors[4])*vec4(bloomTintColors[4],1)*texture2D(blurTexture5,vUv));}"})}}let R,dim,p,renderer,scene,camera,composer,clock,materialsList;UnrealBloomPass.BlurDirectionX=new THREE.Vector2(1,0),UnrealBloomPass.BlurDirectionY=new THREE.Vector2(0,1);let noisePass,postfxPass,saoComposer,postFX=!0,cubemap=generateCubeMap(),simplexNoise="vec4 v(vec4 a){vec4 b=mod(a,289.);return mod((b*34.+10.)*b,289.);}float psrdnoise(vec3 f,vec3 o,float F){const mat3 G=mat3(0.,1.,1.,1.,0.,1.,1.,1.,0.),I=mat3(-.5,.5,.5,.5,-.5,.5,.5,.5,-.5);vec3 H;H=G*f;vec3 a=floor(H),J=fract(H),w=step(J.xyx,J.yzz),K=1.-w,L=vec3(K.z,w.xy),M=vec3(K.xy,w.z),Z=min(L,M),_=max(L,M),k=a+Z,l=a+_,m=a+vec3(1.),g,h,i,j;g=I*a,h=I*k,i=I*l,j=I*m;vec3 x=f-g,y=f-h,z=f-i,A=f-j;if(any(greaterThan(o,vec3(0.)))){vec4 p=vec4(g.x,h.x,i.x,j.x),q=vec4(g.y,h.y,i.y,j.y),r=vec4(g.z,h.z,i.z,j.z);p=o.x>0.?mod(p,o.x):p,q=o.y>0.?mod(q,o.y):q,r=o.z>0.?mod(r,o.z):r,a=floor(G*vec3(p.x,q.x,r.x)+.5),k=floor(G*vec3(p.y,q.y,r.y)+.5),l=floor(G*vec3(p.z,q.z,r.z)+.5),m=floor(G*vec3(p.w,q.w,r.w)+.5);}vec4 B=v(v(v(vec4(a.z,k.z,l.z,m.z))+vec4(a.y,k.y,l.y,m.y))+vec4(a.x,k.x,l.x,m.x)),N=B*3.883222,b=B*-.00692+.99654,O=B*.108706,s=cos(N),t=sin(N),C=sqrt(1.-b*b),c,d,e;if(F!=0.){vec4 S=s*C,T=t*C,oa=b,D=sin(O),E=cos(O),P=t*D-s*E,pa=mix(P*t,D,b),qa=mix(-P*s,E,b),ra=-(T*E+S*D),U=vec4(sin(F)),V=vec4(cos(F));c=V*S+U*pa,d=V*T+U*qa,e=V*oa+U*ra;}else c=s*C,d=t*C,e=b;vec3 aa=vec3(c.x,d.x,e.x),ba=vec3(c.y,d.y,e.y),ca=vec3(c.z,d.z,e.z),da=vec3(c.w,d.w,e.w);vec4 n=.5-vec4(dot(x,x),dot(y,y),dot(z,z),dot(A,A));n=max(n,0.);vec4 ea=n*n,fa=ea*n,ga=vec4(dot(aa,x),dot(ba,y),dot(ca,z),dot(da,A));float sa=dot(fa,ga);return 39.5*sa;}";function makeMint(e,t,r,a,i,s,n,o,l,u,h,c){return{hash:e,lights:t,color:r,rotation:a,boxSettings:i,sphereSettings:s,circleSettings:n,lineSettings:o,generalScale:l,bloom:u,saoBias:h,background:c}}function getMint(e,t=0){let r,a={0:makeMint("0xDeterminant",[[[-5,2,3],.25],[[5,3,3],1.5]],0,[45,45,0],[2e3,[1,.25,.13],[1,1.5,1],[0,0]],[250,.035,[1,2,1]],[0,.1,[1,1.5,1]],[500,[10,.005]],3,[.38,.38,1],40,[.1,.1,.1]),1:makeMint("0xAmaranthEsquiva",[[[2.2,1.5,2.7],1],[[2,-5,5],1]],593,[45,45,0],[2e3,[1,3,.02],[1,1.5,3.5],[4,3]],[500,.02,[1,1.5,1]],[500,.01,[1,1.5,1]],[100,[30,.005]],3,[.3,.33,1],40,[.1,.1,.1]),2:makeMint("0xAnhidridaex",[[[-5,-.2,5],1.04],[[-5,5,5],.85]],532,[45,45,0],[2e3,[2,.05,.5],[1,1.45,.5],[1,0]],[1e3,.015,[1,1.4,1]],[1e3,.01,[1,1,1]],[2e3,[2,.003]],1.5,[.5,.3,1],40,[.1,.1,.1]),3:makeMint("0xApexLiminal",[[[-.5,.8,5],1],[[-.1,2,5],1]],1435,[45,-45,0],[2e3,[1,2,.02],[1,2,1],[1,1]],[50,.02,[1.3,1.5,1.1]],[500,.01,[1,1,1]],[200,[20,.005]],2,[.25,.28,1],48,[.1,.1,.1]),4:makeMint("0xAxialApathy",[[[1.5,1.5,5],1],[[5,5,5],1]],1185,[-45,0,45],[2e3,[.04,.35,1],[.5,.5,.9],[1,0]],[300,.015,[.5,.5,1]],[500,.008,[.75,1,0]],[200,[10,.003]],2.3,[.4,.28,1],40,[.1,.11,.1]),5:makeMint("0xBekhertinsHark",[[[2,2,5],1],[[.3,.3,5],.7]],270,[45,45,90],[2500,[1,.25,.13],[1.5,1.5,1.5],[1,0]],[500,.015,[1,1.5,1]],[1e3,.015,[1,1.5,1]],[500,[10,.005]],2.5,[.33,.24,1],50,[.05,.05,.05]),6:makeMint("0xDexhathroneBarbican",[[[5,2,5],2.5],[[5,1,5],2.5]],448,[45,0,0],[2500,[.25,.02,1.5],[1,1,1],[4,1]],[500,.035,[1,1.5,1]],[1e3,.015,[1,1.5,1]],[100,[10,.005]],2.5,[.5,.15,1],40,[.1,.1,.1]),7:makeMint("0xDeviantMillica",[[[-5,-3.3,5],1],[[-1.9,2,.8],1.28]],162,[45,-50,0],[1e3,[1,1,1],[2,.15,2],[4,2]],[2e3,.015,[1.5,.5,2]],[1e3,.01,[1.5,2,1]],[300,[5,.005]],2,[.5,.25,1],50,[.1,.1,.1]),8:makeMint("0xFantomPaper",[[[-5,5,5],.25],[[0,1,2],1]],1499,[-45,0,45],[3e3,[1.89,1.41,.025],[1.25,1.25,2.2],[1,0]],[500,.02,[1.3,1.3,2]],[200,.01,[1.5,1.5,2]],[300,[10,.005]],1,[.35,.4,1],40,[.12,.12,.15]),9:makeMint("0xDaemonFluxus",[[[0,5,1],.3],[[5,.8,3],.8]],592,[56.5,30,53],[500,[1,3.5,.1],[.5,.5,1],[4,1]],[500,.01,[1,1.5,1]],[500,.01,[1,1.5,1]],[150,[10,.005]],3.65,[.15,.33,1],50,[1,.01,.01]),10:makeMint("0xCetraParallax",[[[-2,0,3],.75],[[.5,1,3],.8]],532,[56.5,30,53],[2e3,[1,.25,.75],[1.5,1,1],[1,0]],[500,.015,[1,2,1]],[1e3,.01,[1,1,1]],[100,[20,.005]],3,[.33,.19,1],41,[.4,.4,.4]),11:makeMint("0xElephantStaircase",[[[-2.5,-1.5,5],.75],[[-5,2,5],.9]],200,[45,-50,0],[1e3,[1,1,1],[2,.15,2],[1,2]],[250,.015,[1.5,1,1]],[500,.01,[1,1,1]],[50,[25,.005]],3,[.25,.2,1],45,[1,0,0]),12:makeMint("0xAldebaran",[[[3.6,2,5],.9],[[.8,3.3,3],.8]],1050,[45,45,0],[2e3,[.05,2,2.75],[1.1,1.6,1.1],[1,0]],[1e3,.02,[1,2.15,1]],[500,.018,[1,2,1]],[1e3,[4,.005]],1,[.4,.3,1],39,[.1,.135,.12]),13:makeMint("0xAhrkanaCetrum",[[[2,3.5,5],.6],[[0,1,5],.8]],4,[-45,0,-45],[2e3,[.25,1,.5],[1,1.3,1],[1,0]],[500,.035,[2.3,1.6,2.1]],[120,.1,[1.2,1,.4]],[200,[10,.004]],3,[.5,.18,1],42,[.3,.3,.3]),14:makeMint("0xViracocha",[[[.7,-5,5],.33],[[5,5,5],1.5]],591,[45,45,0],[2e3,[1,.6,.02],[1,.8,1],[1,0]],[1e3,.01,[1,1,1]],[1e3,.005,[1,1,1]],[1e3,[1.25,.005]],3.4,[.15,.33,1],50,[1,.1,.1]),15:makeMint("0xFermiRizhome",[[[-2,5,5],.75],[[0,2.5,5],.75]],200,[45,45,0],[1e3,[.5,2,1],[1,2,1],[1,1]],[1e3,.012,[1.25,2.05,1.25]],[500,.01,[1.4,2.5,1]],[1e3,[5,.005]],1.1,[.3,.21,1],40,[.13,.1,.1]),16:makeMint("0xFortressFaladakh",[[[-5,5,5],1],[[-1,2,5],1.25]],4,[45,45,0],[1e3,[1,1,1],[1,1,2],[1,2]],[250,.015,[1.5,1,1]],[500,.01,[1,1,1]],[300,[5,.005]],3,[.7,.18,1],45,[1,.1,.1]),17:makeMint("0xAhltaEdifice",[[[5,5,5],.35],[[-4,1.3,2],1]],1412,[-45,0,45],[3e3,[.05,1.5,.3],[.65,.6,2.8],[1,0]],[500,.02,[1,1,2.25]],[200,.01,[1,1.5,1]],[500,[4,.005]],1,[.2,.56,1],35,[.1,.105,.1]),18:makeMint("0xDecafonAvaricis",[[[-5,5,5],1.5],[[.5,.5,5],1.5]],264,[45,45,0],[1e3,[1,.1,1],[1,1.5,2],[4,2]],[500,.015,[1,1,1]],[1e3,.01,[1,1,1]],[50,[20,.005]],3,[.5,.12,1],45,[.1,.1,.8]),19:makeMint("0xAmaru",[[[5,2.5,5],1.25],[[2,1,5],1]],591,[56.5,30,53],[2e3,[1,4.5,.03],[.5,.5,1],[1,0]],[1e3,.01,[1,1,1]],[1e3,.005,[1,1,1]],[250,[5,.005]],3,[.2,.2,1],45,[.9,.5,.1]),20:makeMint("0xGhoikerinku",[[[1,1,5],1],[[5,5,5],1]],421,[45,45,0],[2e3,[.75,1.5,.25],[1,1.5,.7],[1,0]],[500,.03,[1,1,1]],[500,.02,[1,1,1]],[250,[50,.005]],3,[.3,.2,1],43,[.3,.9,.1]),21:makeMint("0xAnagramInverted",[[[-5,5,5],1],[[-5,0,5],1.5]],424,[45,45,0],[1e3,[1,.9,1],[1,1,2],[4,2]],[500,.015,[1,1,1]],[1500,.01,[1,1,1]],[100,[50,.005]],3,[.5,.15,1],50,[.1,.1,.8]),22:makeMint("0xEntoCholeoptera",[[[.2,5,5],1],[[-1.8,5,5],1]],175,[-45,0,45],[1e3,[.1,.3,1.8],[1,1,1.3],[1,3]],[250,.03,[1,1,1.5]],[1500,.01,[1.2,1.5,0]],[250,[5,.008]],1.35,[.33,.3,1],40,[.1,.1,.12]),23:makeMint("0xCloromorphicolAbatica",[[[3.1,2.5,5],1],[[-2,2,2.5],.5]],1040,[45,-45,0],[2e3,[1,.03,3],[1,1,1],[1,4]],[100,.02,[2.2,1.25,2]],[500,.01,[1,1,1]],[50,[10,.005]],2.35,[.15,.28,1],47,[1,0,1]),24:makeMint("0xBoulderSculptorica",[[[-5,5,5],.75],[[0,1,2],1.4]],1498,[-45,0,45],[2200,[2.7,1.41,.025],[1.4,.75,2],[1,0]],[500,.02,[1.5,1.5,1.8]],[1e3,.01,[3,3,0]],[500,[10,.005]],1,[.35,.32,1],42,[.1,.11,.15]),25:makeMint("0xHorizonVertical",[[[-5,1,5],1],[[2.5,3,5],1]],200,[45,45,0],[1002,[2,2,.5],[1,1,1],[1,2]],[250,.015,[1.32,2.6,1]],[1e3,.01,[1,1.5,1]],[100,[30,.005]],2.5,[.6,.18,1],45,[0,.5,1]),26:makeMint("0xFerraraHallucina",[[[-5,-3.3,5],1],[[-1.9,2,.8],1.28]],1050,[45,-50,0],[1e3,[1.3,.45,1],[2,.15,2],[4,2]],[800,.015,[1.5,.5,2]],[500,.01,[1.5,2,1]],[300,[5,.005]],2,[.5,.28,1],50,[.4,.1,.25]),27:makeMint("0xCaminataBifurcata",[[[0,5,5],.5],[[5,5,5],1]],362,[45,45,90],[2e3,[1,.25,.13],[1.5,1.5,1.5],[1,3]],[500,.035,[1,1.5,1]],[800,.01,[1,1.5,1]],[500,[10,.005]],2.5,[.35,.3,1],50,[.4,.4,.5]),28:makeMint("0xCorniusAngle",[[[-5,5,5],1],[[5,5,5],1]],1250,[0,-45,45],[2e3,[.025,1,3.5],[1,.38,.38],[3,1]],[60,.01,[1.22,1,1.31]],[1e3,.005,[1.4,1.5,0]],[240,[4,.01]],1.75,[.2,6,1],38,[.02,.02,.02]),29:makeMint("0xDehfaMinim",[[[-5,5,5],1.8],[[-1.5,5,5],1]],306,[45,45,0],[2e3,[3.5,3.27,.04],[-1.08,.64,1.1],[1,1]],[100,.02,[1.5,1.2,1.5]],[1e3,.01,[2,2,0]],[400,[30,.003]],2.3,[.15,.25,1],45,[1,.01,.01]),30:makeMint("0xAncoraBeatha",[[[5,5,5],1],[[-5,5,5],.75]],389,[45,45,90],[2500,[1,.6,.01],[.7,1.5,1.6],[4,3]],[200,.02,[1,1,1]],[1e3,.015,[2,2,2]],[200,[10,.005]],2,[.2,.25,1],42,[.08,.08,.12]),31:makeMint("0xDhenteMicelia",[[[-5,5,5],.5],[[0,.8,5],.5]],593,[45,45,0],[2500,[.75,2.5,.025],[.7,1.5,1.3],[4,4]],[200,.02,[1,1,1]],[1e3,.015,[2,2,2]],[100,[10,.005]],2.3,[.15,.37,1],42,[.05,.05,.08]),32:makeMint("0xEhafaDehafa",[[[1,1,5],1.5],[[1.5,-5,5],2]],1498,[45,45,0],[1e3,[2,.05,1.4],[1.6,1.9,1],[1,1]],[100,.02,[1.7,2.1,1]],[500,.015,[2,2,0]],[400,[5,.005]],1,[.35,.25,1],42,[.1,.1,.16]),33:makeMint("0xDecaFern",[[[0,4,5],.8],[[3.3,3,2],.8]],449,[56.5,-30,-53],[2e3,[1,3.5,.025],[.5,.5,1],[1,2]],[60,.015,[.6,.75,1]],[0,.005,[-.5,.5,3]],[240,[20,.003]],3.5,[.4,.3,1],50,[.1,.1,.1]),34:makeMint("0xFehrriDexatrone",[[[-5,5,2.5],1],[[5,5,5],1]],1330,[45,0,0],[2500,[.25,.02,1.5],[1,1,1],[3,0]],[100,.015,[.85,1,1]],[2e3,.01,[1,1.5,1]],[100,[10,.005]],2.5,[.5,.25,1],38,[.11,.1,.1]),35:makeMint("0xFacaciaNubia",[[[-3,5,5],.5],[[2.5,0,1.5],.75]],135,[45,45,0],[1e3,[1.5,1.5,.5],[1,1,1],[4,0]],[500,.01,[1.4,1.16,.98]],[1e3,.008,[1,1,1]],[200,[30,.005]],3,[.25,.26,1],45,[1,.1,.5]),36:makeMint("0xEblemaFahr",[[[-5,5,5],.75],[[-5,5,5],.75]],4,[45,-50,0],[1e3,[1,1,1],[2.25,.45,1.85],[4,4]],[2e3,.015,[1.5,.5,2]],[1e3,.01,[1.5,2,1]],[0,[20,.005]],2,[.35,.17,1],50,[.9,.3,.1]),37:makeMint("0xDheliosFarenheit",[[[-5,5,5],1.5],[[-5,0,5],1.5]],532,[45,45,0],[1e3,[1,1,1],[1,1,2],[4,2]],[500,.015,[1.4,1.31,1.05]],[1500,.007,[1,1,1]],[0,[25,.005]],3,[.75,.08,1],45,[.1,.1,.1]),38:makeMint("0xHeliosTrifacta",[[[5,3,3],2],[[-3.5,3.5,3],1]],259,[-45,0,45],[1250,[1,1.4,.02],[2,2,1.5],[1,4]],[100,.03,[0,1,4]],[500,.01,[1,1,1]],[200,[20,.005]],2,[.18,.15,1],40,[.1,.1,.1]),39:makeMint("0xDaedalus",[[[0,5,5],.35],[[2.5,1,2],1]],1499,[-45,0,45],[3e3,[.05,.91,.21],[1.25,1.25,2.1],[1,2]],[500,.02,[1,1,1.5]],[200,.01,[1,1.5,1]],[0,[5,.005]],2,[.38,.5,1],40,[.02,.02,.02]),40:makeMint("0xBehringerCabe",[[[-3,3.4,3],1],[[5,0,5],.5]],1095,[56.5,30,53],[1e3,[3,.1,7],[.5,.5,.5],[1,3]],[50,.02,[4,2.1,1.4]],[0,.02,[1.5,3,0]],[150,[25,.005]],1.3,[.35,.3,1],42,[.05,.09,.12]),41:makeMint("0xCefacHeamedh",[[[-5,2.8,5],.75],[[0,1,2],1.4]],179,[45,45,0],[2520,[2.5,1.41,.025],[1,2,1],[1,4]],[500,.025,[1.3,2,1.3]],[500,.01,[1,2,0]],[1e3,[5,.005]],1,[.32,.32,1],40,[.08,.08,.08]),42:makeMint("0xAbaceAhlta",[[[-5,.5,5],.8],[[0,3,2],.8]],1499,[0,45,-45],[2e3,[1,3.5,.05],[.5,.5,1],[1,1]],[550,.01,[1,1,1]],[1e3,.006,[1,1,1]],[100,[20,.005]],3.5,[.25,.25,1],43,[.1,.1,.1]),43:makeMint("0xEbehfAfaha",[[[1.4,.5,5],.75],[[5,5,5],.75]],1200,[45,45,90],[2500,[1.5,.5,.05],[.45,1.8,2],[4,3]],[100,.015,[1,1,1]],[500,.015,[2,2,2]],[200,[10,.005]],2.2,[.33,.25,1],42,[.05,.05,.05]),44:makeMint("0xDeahAfurah",[[[-5,5,5],1.5],[[.3,.3,5],1.5]],384,[45,45,0],[1e3,[1,1,1],[1,1,2],[4,2]],[500,.015,[1,1,1]],[1500,.01,[1,1,1]],[100,[23.8,.005]],3,[.4,.18,1],48,[.1,.1,.1]),45:makeMint("0xAherialDeah",[[[5,5,5],1],[[-5,.8,5],1]],385,[45,-45,0],[2e3,[2.5,.75,.01],[2,-.5,1.5],[1,0]],[100,.02,[1.02,.5,2.8]],[1e3,.012,[1,2,0]],[50,[20,.005]],2.25,[.25,.25,1],42,[.1,.1,.1]),46:makeMint("0xDarhaDendra",[[[1,1,5],1],[[0,1,5],1]],1040,[45,45,0],[1e3,[.05,2,2],[1,2,1],[1,0]],[500,.02,[1.1,1.95,1.3]],[1e3,.01,[2,2,1]],[200,[20,.005]],1.15,[.15,.25,1],45,[.1,.1,.12]),47:makeMint("0xFahciaAbea",[[[-2.5,3,3],1.5],[[1,3.4,3],.75]],360,[-45,0,45],[1250,[1,1.4,.01],[2,2,1.5],[1,4]],[200,.03,[1.5,1.5,1.5]],[1e3,.01,[1,2,1]],[100,[20,.005]],2,[.2,.22,1],40,[.1,.1,.1]),48:makeMint("0xBehmensAhmad",[[[5,5,5],.8],[[3,1.5,5],.8]],1e3,[45,45,90],[2500,[1,.8,.05],[.25,2,2],[4,2]],[200,.02,[1,1,1]],[1e3,.015,[2,2,2]],[50,[10,.005]],2,[.35,.25,1],45,[.01,.01,.01]),49:makeMint("0xCeaFehen",[[[1,3.2,5],.8],[[.7,1.2,2],.8]],1399,[45,0,45],[2e3,[.5,2.5,.02],[.5,.5,1],[1,2]],[50,.01,[1,1,1]],[500,.01,[1,1,0]],[400,[20,.005]],3.5,[.25,.28,1],42,[.1,.1,.1])};if(e in a)r=a[e];else{r=a[e%50]}return tokenData.hash=r.hash,null!=t&&(r.color=t),r}function u(e){return{value:e}}function toRGB(e){return[((e=Math.floor(e))>>16&255)/255,(e>>8&255)/255,(255&e)/255]}const toRadians=e=>Math.PI/180*e;function getRenderTarget(e,t,r,a){let i=new THREE.WebGLRenderTarget(e,t,r),s=new THREE.OrthographicCamera(-1,1,1,-1,0,1),n=new THREE.Scene,o=new THREE.PlaneGeometry(2,2),l=new THREE.Mesh(o,a);return n.add(l),{target:i,scene:n,camera:s}}function writeStaticTexture(e,t,r,a){let i=getRenderTarget(t.x,t.y,r,a);return e.setRenderTarget(i.target),e.render(i.scene,i.camera),e.setRenderTarget(null),i.target.texture}function createContainer(e){let t=document.createElement("div");return t.setAttribute("id","threecanvas"),t.setAttribute("class","threecanvas"),t.appendChild(e.domElement),document.body.appendChild(t),t}function getDirLight(e,t,r,a,i){const s=new THREE.DirectionalLight(t,r);return s.position.set(e[0],e[1],e[2]),s.castShadow=a,s.shadow.camera.near=0,s.shadow.camera.far=10,s.shadow.camera.left=-5,s.shadow.camera.right=5,s.shadow.camera.top=5,s.shadow.camera.b
"use strict";class Random{constructor(){this.useA=!1;let e=function(e){let t=parseInt(e.substr(0,8),16),r=parseInt(e.substr(8,8),16),a=parseInt(e.substr(16,8),16),i=parseInt(e.substr(24,8),16);return function(){let e=((t|=0)+(r|=0)|0)+(i|=0)|0;return i=i+1|0,t=r^r>>>9,r=(a|=0)+(a<<3)|0,a=(a=a<<21|a>>>11)+e|0,(e>>>0)/4294967296}};this.prngA=new e(tokenData.hash.substr(2,32)),this.prngB=new e(tokenData.hash.substr(34,32));for(let e=0;e<1e6;e+=2)this.prngA(),this.prngB()}r(){return this.useA=!this.useA,this.useA?this.prngA():this.prngB()}rr(e,t){return e+(t-e)*this.r()}ri(e,t){return Math.floor(this.rr(e,t+1))}rb(e){return this.r()<e}rc(e){return e[this.ri(0,e.length-1)]}}let projectNumber=Math.floor(parseInt(tokenData.tokenId)/1e6),mintNumber=parseInt(tokenData.tokenId)%1e6,mintParams=getMint(mintNumber,null),palettes={0:[7693161,16777215,12510188,14063714,16132628],4:[16777215,12510188,14063714,16132628,7693161],135:[8729183,15166307,7591828,10868960,4038310],162:[14146010,16777215,2965326,15937100,7782105],175:[4164769,3648955,16295204,16208664,16193555],179:[3648955,16295204,16208664,16193555,4164769],200:[5917265,9486258,15854272,15643238,15291745],264:[3054034,10874106,10066329,16136494,1330043],270:[5863782,15387781,13730120,10823211,6497604],259:[5467272,9486813,16777215,16295460,4213607],306:[16184298,3420720,4148561,8097393,10138301],360:[16365676,13855870,10971777,6708088,4676985],362:[6708088,4676985,16365676,13855870,10971777],384:[2524806,6011551,15510591,15026239,1323071],385:[3500688,7643582,15986141,13909793,15438702],389:[7643582,15986141,13909793,15438702,3500688],421:[3853501,16207127,10382956,7570324,5151658],424:[10382956,7570324,5151658,3853501,16207127],448:[8952518,2435136,16285726,16710124,13950206],449:[13950206,8952518,2435136,16285726,16710124],532:[7455903,16776436,5283251,1064539,14959703],591:[16287775,2898241,4217189,12571613,15790303],592:[15790303,16287775,2898241,4217189,12571613],593:[12571613,15790303,16287775,2898241,4217189],1e3:[6869478,10934999,14672843,15893807,16345088],1040:[40879,6900027,13316670,15361856,15517776],1050:[4110254,8308398,14276518,16686492,16661630],1095:[42949,4177866,16314854,11395384,9354496],1185:[11717462,15462272,16694591,15627118,11156826],1200:[11121322,12831414,15396552,15589302,15190446],1250:[16462923,2629918,1209212,638651,16512708],1330:[16119285,15198183,3289650,9961472,12059651],1399:[3117457,3061675,9610025,15449362,224394],1412:[16686125,9474150,10274987,16711110,16015639],1435:[5065801,3420977,9681252,2527151,2772337],1498:[16301685,9286084,6312564,13643836,14967131],1499:[14967131,16301685,9286084,6312564,13643836]};var F2=.5*(Math.sqrt(3)-1),G2=(3-Math.sqrt(3))/6,fastFloor=function(e){return 0|Math.floor(e)},grad2=new Float64Array([1,1,-1,1,1,-1,-1,-1,1,0,-1,0,1,0,-1,0,0,1,0,-1,0,1,0,-1]);function createNoise2D(e){var t=buildPermutationTable(e),r=new Float64Array(t).map((function(e){return grad2[e%12*2]})),a=new Float64Array(t).map((function(e){return grad2[e%12*2+1]}));return function(e,i){var s,n,o=0,l=0,u=0,h=(e+i)*F2,c=fastFloor(e+h),d=fastFloor(i+h),m=(c+d)*G2,p=e-(c-m),f=i-(d-m);p>f?(s=1,n=0):(s=0,n=1);var v=p-s+G2,g=f-n+G2,x=p-1+2*G2,R=f-1+2*G2,E=255&c,M=255&d,T=.5-p*p-f*f;if(T>=0){var S=E+t[M];o=(T*=T)*T*(r[S]*p+a[S]*f)}var C=.5-v*v-g*g;if(C>=0){var y=E+s+t[M+n];l=(C*=C)*C*(r[y]*v+a[y]*g)}var b=.5-x*x-R*R;if(b>=0){var D=E+1+t[M+1];u=(b*=b)*b*(r[D]*x+a[D]*R)}return 70*(o+l+u)}}function buildPermutationTable(e){for(var t=new Uint8Array(512),r=0;r<256;r++)t[r]=r;for(r=0;r<255;r++){var a=r+~~(e.r()*(256-r)),i=t[r];t[r]=t[a],t[a]=i}for(r=256;r<512;r++)t[r]=t[r-256];return t}const CopyShader={uniforms:{tDiffuse:{type:"t",value:null},opacity:{type:"f",value:1}},vertexShader:["varying vec2 vUv;","void main() {","vUv = uv;","gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );","}"].join("\n"),fragmentShader:["uniform float opacity;","uniform sampler2D tDiffuse;","varying vec2 vUv;","void main() {","vec4 texel = texture2D( tDiffuse, vUv );","gl_FragColor = opacity * texel;","}"].join("\n")};class EffectComposer{constructor(e,t){if(this.renderer=e,void 0===t){const r=e.getSize(new THREE.Vector2);this._pixelRatio=e.getPixelRatio(),this._width=r.width,this._height=r.height,(t=new THREE.WebGLRenderTarget(this._width*this._pixelRatio,this._height*this._pixelRatio)).texture.name="EffectComposer.rt1"}else this._pixelRatio=1,this._width=t.width,this._height=t.height;this.renderTarget1=t,this.renderTarget2=t.clone(),this.renderTarget2.texture.name="EffectComposer.rt2",this.writeBuffer=this.renderTarget1,this.readBuffer=this.renderTarget2,this.renderToScreen=!0,this.passes=[],this.copyPass=new ShaderPass(CopyShader),this.clock=new THREE.Clock}swapBuffers(){const e=this.readBuffer;this.readBuffer=this.writeBuffer,this.writeBuffer=e}addPass(e){this.passes.push(e),e.setSize(this._width*this._pixelRatio,this._height*this._pixelRatio)}insertPass(e,t){this.passes.splice(t,0,e),e.setSize(this._width*this._pixelRatio,this._height*this._pixelRatio)}removePass(e){const t=this.passes.indexOf(e);-1!==t&&this.passes.splice(t,1)}isLastEnabledPass(e){for(let t=e+1;t<this.passes.length;t++)if(this.passes[t].enabled)return!1;return!0}render(e){void 0===e&&(e=this.clock.getDelta());const t=this.renderer.getRenderTarget();let r=!1;for(let t=0,a=this.passes.length;t<a;t++){const a=this.passes[t];if(!1!==a.enabled){if(a.renderToScreen=this.renderToScreen&&this.isLastEnabledPass(t),a.render(this.renderer,this.writeBuffer,this.readBuffer,e,r),a.needsSwap){if(r){const t=this.renderer.getContext(),r=this.renderer.state.buffers.stencil;r.setFunc(t.NOTEQUAL,1,4294967295),this.copyPass.render(this.renderer,this.writeBuffer,this.readBuffer,e),r.setFunc(t.EQUAL,1,4294967295)}this.swapBuffers()}void 0!==THREE.MaskPass&&(a instanceof THREE.MaskPass?r=!0:a instanceof THREE.ClearMaskPass&&(r=!1))}}this.renderer.setRenderTarget(t)}reset(e){if(void 0===e){const t=this.renderer.getSize(new THREE.Vector2);this._pixelRatio=this.renderer.getPixelRatio(),this._width=t.width,this._height=t.height,(e=this.renderTarget1.clone()).setSize(this._width*this._pixelRatio,this._height*this._pixelRatio)}this.renderTarget1.dispose(),this.renderTarget2.dispose(),this.renderTarget1=e,this.renderTarget2=e.clone(),this.writeBuffer=this.renderTarget1,this.readBuffer=this.renderTarget2}setSize(e,t){this._width=e,this._height=t;const r=this._width*this._pixelRatio,a=this._height*this._pixelRatio;this.renderTarget1.setSize(r,a),this.renderTarget2.setSize(r,a);for(let e=0;e<this.passes.length;e++)this.passes[e].setSize(r,a)}setPixelRatio(e){this._pixelRatio=e,this.setSize(this._width,this._height)}}class Pass{constructor(){this.enabled=!0,this.needsSwap=!0,this.clear=!1,this.renderToScreen=!1}setSize(){}}class FullScreenQuad{constructor(e){const t=new THREE.BufferGeometry;t.setAttribute("position",new THREE.Float32BufferAttribute([-1,3,0,-1,-1,0,3,-1,0],3)),t.setAttribute("uv",new THREE.Float32BufferAttribute([0,2,0,0,2,0],2)),this._mesh=new THREE.Mesh(t,e)}dispose(){this._mesh.geometry.dispose()}render(e){e.render(this._mesh,new THREE.OrthographicCamera(-1,1,1,-1,0,1))}get material(){return this._mesh.material}set material(e){this._mesh.material=e}}class ShaderPass extends Pass{constructor(e,t){super(),this.textureID=void 0!==t?t:"tDiffuse",e instanceof THREE.ShaderMaterial?(this.uniforms=e.uniforms,this.material=e):e&&(this.uniforms=THREE.UniformsUtils.clone(e.uniforms),this.material=new THREE.ShaderMaterial({defines:Object.assign({},e.defines),uniforms:this.uniforms,vertexShader:e.vertexShader,fragmentShader:e.fragmentShader})),this.fsQuad=new FullScreenQuad(this.material)}render(e,t,r){this.uniforms[this.textureID]&&(this.uniforms[this.textureID].value=r.texture),this.fsQuad.material=this.material,this.renderToScreen?(e.setRenderTarget(null),this.fsQuad.render(e)):(e.setRenderTarget(t),this.clear&&e.clear(e.autoClearColor,e.autoClearDepth,e.autoClearStencil),this.fsQuad.render(e))}}class RenderPass extends Pass{constructor(e,t,r,a,i){super(),this.scene=e,this.camera=t,this.overrideMaterial=r,this.clearColor=a,this.clearAlpha=void 0!==i?i:0,this.clear=!0,this.clearDepth=!1,this.needsSwap=!1,this._oldClearColor=new THREE.Color}render(e,t,r){const a=e.autoClear;let i,s;e.autoClear=!1,void 0!==this.overrideMaterial&&(s=this.scene.overrideMaterial,this.scene.overrideMaterial=this.overrideMaterial),this.clearColor&&(e.getClearColor(this._oldClearColor),i=e.getClearAlpha(),e.setClearColor(this.clearColor,this.clearAlpha)),this.clearDepth&&e.clearDepth(),e.setRenderTarget(this.renderToScreen?null:r),this.clear&&e.clear(e.autoClearColor,e.autoClearDepth,e.autoClearStencil),e.render(this.scene,this.camera),this.clearColor&&e.setClearColor(this._oldClearColor,i),void 0!==this.overrideMaterial&&(this.scene.overrideMaterial=s),e.autoClear=a}}const SAOShader={defines:{NUM_SAMPLES:7,NUM_RINGS:4,NORMAL_TEXTURE:0,DIFFUSE_TEXTURE:0,DEPTH_PACKING:1,PERSPECTIVE_CAMERA:1},uniforms:{tDepth:{value:null},tDiffuse:{value:null},tNormal:{value:null},size:{value:new THREE.Vector2(512,512)},cameraNear:{value:1},cameraFar:{value:100},cameraProjectionMatrix:{value:new THREE.Matrix4},cameraInverseProjectionMatrix:{value:new THREE.Matrix4},scale:{value:1},intensity:{value:.1},bias:{value:.5},minResolution:{value:0},kernelRadius:{value:100},randomSeed:{value:0}},vertexShader:"\n\nvarying vec2 vUv;\n\nvoid main() {\n vUv = uv;\n gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n }",fragmentShader:"\n#include <common>\n#define I int\n#define FL float\n#define V2 vec2\n#define V3 vec3\n#define V4 vec4\nvarying V2 vUv;\n#if DIFFUSE_TEXTURE==1\nuniform sampler2D tDiffuse;\n#endif\nuniform sampler2D tDepth;\n#if NORMAL_TEXTURE==1\nuniform sampler2D tNormal;\n#endif\nuniform FL cameraNear,cameraFar;uniform mat4 cameraProjectionMatrix,cameraInverseProjectionMatrix;uniform FL scale,intensity,bias,kernelRadius,minResolution;uniform V2 size;uniform FL randomSeed;\n#include <packing>\nV4 getDefaultColor(const V2 v){\n#if DIFFUSE_TEXTURE==1\nreturn texture2D(tDiffuse,vUv);\n#else\nreturn V4(1);\n#endif\n}FL getDepth(const V2 v){\n#if DEPTH_PACKING==1\nreturn unpackRGBAToDepth(texture2D(tDepth,v));\n#else\nreturn texture2D(tDepth,v).x;\n#endif\n}FL getViewZ(const FL v){\n#if PERSPECTIVE_CAMERA==1\nreturn perspectiveDepthToViewZ(v,cameraNear,cameraFar);\n#else\nreturn orthographicDepthToViewZ(v,cameraNear,cameraFar);\n#endif\n}V3 getViewPosition(const V2 v,const FL c,const FL f){FL g=cameraProjectionMatrix[2][3]*f+cameraProjectionMatrix[3][3];V4 r=V4((V3(v,c)-.5)*2.,1);r*=g;return(cameraInverseProjectionMatrix*r).xyz;}V3 getViewNormal(const V3 v,const V2 c){\n#if NORMAL_TEXTURE==1\nreturn unpackRGBToNormal(texture2D(tNormal,c).xyz);\n#else\nreturn normalize(cross(dFdx(v),dFdy(v)));\n#endif\n}FL scaleDividedByCameraFar,minResolutionMultipliedByCameraFar;FL getOcclusion(const V3 v,const V3 c,const V3 g){V3 t=g-v;FL r=length(t),N=scaleDividedByCameraFar*r;return max(0.,(dot(c,t)-minResolutionMultipliedByCameraFar)/N-bias)/(1.+pow2(N));}const FL ANGLE_STEP=PI2*FL(NUM_RINGS)/FL(NUM_SAMPLES),INV_NUM_SAMPLES=1./FL(NUM_SAMPLES);FL getAmbientOcclusion(const V3 v){scaleDividedByCameraFar=scale/cameraFar;minResolutionMultipliedByCameraFar=minResolution*cameraFar;V3 c=getViewNormal(v,vUv);FL f=rand(vUv+randomSeed)*PI2;V2 g=V2(kernelRadius*INV_NUM_SAMPLES)/size,r=g;FL s=0.,t=0.;for(I u=0;u<NUM_SAMPLES;u++){V2 N=vUv+V2(cos(f),sin(f))*g;g+=r;f+=ANGLE_STEP;FL S=getDepth(N);if(S>=1.-EPSILON)continue;FL m=getViewZ(S);V3 E=getViewPosition(N,S,m);s+=getOcclusion(v,c,E);t+=1.;}if(t==0.)discard;return s*(intensity/t);}void main(){FL v=getDepth(vUv);if(v>=1.-EPSILON)discard;FL c=getViewZ(v);V3 t=getViewPosition(vUv,v,c);FL g=getAmbientOcclusion(t);gl_FragColor=getDefaultColor(vUv);gl_FragColor.xyz*=1.-g;}\n"},DepthLimitedBlurShader={defines:{KERNEL_RADIUS:4,DEPTH_PACKING:1,PERSPECTIVE_CAMERA:1},uniforms:{tDiffuse:{value:null},size:{value:new THREE.Vector2(512,512)},sampleUvOffsets:{value:[new THREE.Vector2(0,0)]},sampleWeights:{value:[1]},tDepth:{value:null},cameraNear:{value:10},cameraFar:{value:1e3},depthCutoff:{value:10}},vertexShader:"\n#include <common>\nuniform vec2 size;varying vec2 vUv,vInvSize;void main(){vUv=uv;vInvSize=1./size;gl_Position=projectionMatrix*modelViewMatrix*vec4(position,1);}\n",fragmentShader:"#include <common>\n#include <packing>\nuniform sampler2D tDiffuse,tDepth;uniform float cameraNear,cameraFar,depthCutoff;uniform vec2 sampleUvOffsets[KERNEL_RADIUS+1];uniform float sampleWeights[KERNEL_RADIUS+1];varying vec2 vUv,vInvSize;float getDepth(const vec2 v){\n#if DEPTH_PACKING==1\nreturn unpackRGBAToDepth(texture2D(tDepth,v));\n#else\nreturn texture2D(tDepth,v).x;\n#endif\n}float getViewZ(const float v){\n#if PERSPECTIVE_CAMERA==1\nreturn perspectiveDepthToViewZ(v,cameraNear,cameraFar);\n#else\nreturn orthographicDepthToViewZ(v,cameraNear,cameraFar);\n#endif\n}void main(){float v=getDepth(vUv);if(v>=1.-EPSILON)discard;float f=-getViewZ(v);bool r=false,c=false;float e=sampleWeights[0];vec4 t=texture2D(tDiffuse,vUv)*e;for(int i=1;i<=KERNEL_RADIUS;i++){float s=sampleWeights[i];vec2 g=sampleUvOffsets[i]*vInvSize,u=vUv+g;float a=-getViewZ(getDepth(u));if(abs(a-f)>depthCutoff)r=true;if(!r)t+=texture2D(tDiffuse,u)*s,e+=s;u=vUv-g;a=-getViewZ(getDepth(u));if(abs(a-f)>depthCutoff)c=true;if(!c)t+=texture2D(tDiffuse,u)*s,e+=s;}gl_FragColor=t/e;}\n"},BlurShaderUtils={createSampleWeights:function(e,t){const r=[];for(let a=0;a<=e;a++)r.push(gaussian(a,t));return r},createSampleOffsets:function(e,t){const r=[];for(let a=0;a<=e;a++)r.push(t.clone().multiplyScalar(a));return r},configure:function(e,t,r,a){e.defines.KERNEL_RADIUS=t,e.uniforms.sampleUvOffsets.value=BlurShaderUtils.createSampleOffsets(t,a),e.uniforms.sampleWeights.value=BlurShaderUtils.createSampleWeights(t,r),e.needsUpdate=!0}};function gaussian(e,t){return Math.exp(-e*e/(t*t*2))/(Math.sqrt(2*Math.PI)*t)}const UnpackDepthRGBAShader={uniforms:{tDiffuse:{value:null},opacity:{value:1}},vertexShader:"varying vec2 vUv;void main(){vUv=uv;gl_Position=projectionMatrix*modelViewMatrix*vec4(position,1);}",fragmentShader:"uniform float opacity;uniform sampler2D tDiffuse;varying vec2 vUv;\n#include <packing>\nvoid main(){float v=1.-unpackRGBAToDepth(texture2D(tDiffuse,vUv));gl_FragColor=vec4(vec3(v),opacity);}"};class SAOPass extends Pass{constructor(e,t,r=!1,a=!1,i=new THREE.Vector2(256,256)){let s;super(),this.scene=e,this.camera=t,this.clear=!0,this.needsSwap=!1,this.supportsDepthTextureExtension=r,this.supportsNormalTexture=a,this.originalClearColor=new THREE.Color,this._oldClearColor=new THREE.Color,this.oldClearAlpha=1,this.params={output:0,saoBias:.5,saoIntensity:.18,saoScale:1,saoKernelRadius:100,saoMinResolution:0,saoBlur:!0,saoBlurRadius:8,saoBlurStdDev:4,saoBlurDepthCutoff:.01},this.resolution=new THREE.Vector2(i.x,i.y),this.saoRenderTarget=new THREE.WebGLRenderTarget(this.resolution.x,this.resolution.y),this.blurIntermediateRenderTarget=this.saoRenderTarget.clone(),this.beautyRenderTarget=this.saoRenderTarget.clone(),this.normalRenderTarget=new THREE.WebGLRenderTarget(this.resolution.x,this.resolution.y,{minFilter:THREE.NearestFilter,magFilter:THREE.NearestFilter}),this.depthRenderTarget=this.normalRenderTarget.clone(),this.supportsDepthTextureExtension&&(s=new THREE.DepthTexture,s.type=THREE.UnsignedShortType,this.beautyRenderTarget.depthTexture=s,this.beautyRenderTarget.depthBuffer=!0),this.depthMaterial=new THREE.MeshDepthMaterial,this.depthMaterial.depthPacking=THREE.RGBADepthPacking,this.depthMaterial.blending=THREE.NoBlending,this.normalMaterial=new THREE.MeshNormalMaterial,this.normalMaterial.blending=THREE.NoBlending,void 0===SAOShader&&console.error("THREE.SAOPass relies on THREE.SAOShader"),this.saoMaterial=new THREE.ShaderMaterial({defines:Object.assign({},SAOShader.defines),fragmentShader:SAOShader.fragmentShader,vertexShader:SAOShader.vertexShader,uniforms:THREE.UniformsUtils.clone(SAOShader.uniforms)}),this.saoMaterial.extensions.derivatives=!0,this.saoMaterial.defines.DEPTH_PACKING=this.supportsDepthTextureExtension?0:1,this.saoMaterial.defines.NORMAL_TEXTURE=this.supportsNormalTexture?1:0,this.saoMaterial.defines.PERSPECTIVE_CAMERA=this.camera.isPerspectiveCamera?1:0,this.saoMaterial.uniforms.tDepth.value=this.supportsDepthTextureExtension?s:this.depthRenderTarget.texture,this.saoMaterial.uniforms.tNormal.value=this.normalRenderTarget.texture,this.saoMaterial.uniforms.size.value.set(this.resolution.x,this.resolution.y),this.saoMaterial.uniforms.cameraInverseProjectionMatrix.value.copy(this.camera.projectionMatrixInverse),this.saoMaterial.uniforms.cameraProjectionMatrix.value=this.camera.projectionMatrix,this.saoMaterial.blending=THREE.NoBlending,void 0===DepthLimitedBlurShader&&console.error("THREE.SAOPass relies on THREE.DepthLimitedBlurShader"),this.vBlurMaterial=new THREE.ShaderMaterial({uniforms:THREE.UniformsUtils.clone(DepthLimitedBlurShader.uniforms),defines:Object.assign({},DepthLimitedBlurShader.defines),vertexShader:DepthLimitedBlurShader.vertexShader,fragmentShader:DepthLimitedBlurShader.fragmentShader}),this.vBlurMaterial.defines.DEPTH_PACKING=this.supportsDepthTextureExtension?0:1,this.vBlurMaterial.defines.PERSPECTIVE_CAMERA=this.camera.isPerspectiveCamera?1:0,this.vBlurMaterial.uniforms.tDiffuse.value=this.saoRenderTarget.texture,this.vBlurMaterial.uniforms.tDepth.value=this.supportsDepthTextureExtension?s:this.depthRenderTarget.texture,this.vBlurMaterial.uniforms.size.value.set(this.resolution.x,this.resolution.y),this.vBlurMaterial.blending=THREE.NoBlending,this.hBlurMaterial=new THREE.ShaderMaterial({uniforms:THREE.UniformsUtils.clone(DepthLimitedBlurShader.uniforms),defines:Object.assign({},DepthLimitedBlurShader.defines),vertexShader:DepthLimitedBlurShader.vertexShader,fragmentShader:DepthLimitedBlurShader.fragmentShader}),this.hBlurMaterial.defines.DEPTH_PACKING=this.supportsDepthTextureExtension?0:1,this.hBlurMaterial.defines.PERSPECTIVE_CAMERA=this.camera.isPerspectiveCamera?1:0,this.hBlurMaterial.uniforms.tDiffuse.value=this.blurIntermediateRenderTarget.texture,this.hBlurMaterial.uniforms.tDepth.value=this.supportsDepthTextureExtension?s:this.depthRenderTarget.texture,this.hBlurMaterial.uniforms.size.value.set(this.resolution.x,this.resolution.y),this.hBlurMaterial.blending=THREE.NoBlending,void 0===CopyShader&&console.error("THREE.SAOPass relies on CopyShader"),this.materialCopy=new THREE.ShaderMaterial({uniforms:THREE.UniformsUtils.clone(CopyShader.uniforms),vertexShader:CopyShader.vertexShader,fragmentShader:CopyShader.fragmentShader,blending:THREE.NoBlending}),this.materialCopy.transparent=!0,this.materialCopy.depthTest=!1,this.materialCopy.depthWrite=!1,this.materialCopy.blending=THREE.CustomBlending,this.materialCopy.blendSrc=THREE.DstColorFactor,this.materialCopy.blendDst=THREE.ZeroFactor,this.materialCopy.blendEquation=THREE.AddEquation,this.materialCopy.blendSrcAlpha=THREE.DstAlphaFactor,this.materialCopy.blendDstAlpha=THREE.ZeroFactor,this.materialCopy.blendEquationAlpha=THREE.AddEquation,void 0===UnpackDepthRGBAShader&&console.error("THREE.SAOPass relies on THREE.UnpackDepthRGBAShader"),this.depthCopy=new THREE.ShaderMaterial({uniforms:THREE.UniformsUtils.clone(UnpackDepthRGBAShader.uniforms),vertexShader:UnpackDepthRGBAShader.vertexShader,fragmentShader:UnpackDepthRGBAShader.fragmentShader,blending:THREE.NoBlending}),this.fsQuad=new FullScreenQuad(null)}render(e,t,r){if(this.renderToScreen&&(this.materialCopy.blending=THREE.NoBlending,this.materialCopy.uniforms.tDiffuse.value=r.texture,this.materialCopy.needsUpdate=!0,this.renderPass(e,this.materialCopy,null)),1===this.params.output)return;e.getClearColor(this._oldClearColor),this.oldClearAlpha=e.getClearAlpha();const a=e.autoClear;e.autoClear=!1,e.setRenderTarget(this.depthRenderTarget),e.clear(),this.saoMaterial.uniforms.bias.value=this.params.saoBias,this.saoMaterial.uniforms.intensity.value=this.params.saoIntensity,this.saoMaterial.uniforms.scale.value=this.params.saoScale,this.saoMaterial.uniforms.kernelRadius.value=this.params.saoKernelRadius,this.saoMaterial.uniforms.minResolution.value=this.params.saoMinResolution,this.saoMaterial.uniforms.cameraNear.value=this.camera.near,this.saoMaterial.uniforms.cameraFar.value=this.camera.far;const i=this.params.saoBlurDepthCutoff*(this.camera.far-this.camera.near);this.vBlurMaterial.uniforms.depthCutoff.value=i,this.hBlurMaterial.uniforms.depthCutoff.value=i,this.vBlurMaterial.uniforms.cameraNear.value=this.camera.near,this.vBlurMaterial.uniforms.cameraFar.value=this.camera.far,this.hBlurMaterial.uniforms.cameraNear.value=this.camera.near,this.hBlurMaterial.uniforms.cameraFar.value=this.camera.far,this.params.saoBlurRadius=Math.floor(this.params.saoBlurRadius),this.prevStdDev===this.params.saoBlurStdDev&&this.prevNumSamples===this.params.saoBlurRadius||(BlurShaderUtils.configure(this.vBlurMaterial,this.params.saoBlurRadius,this.params.saoBlurStdDev,new THREE.Vector2(0,1)),BlurShaderUtils.configure(this.hBlurMaterial,this.params.saoBlurRadius,this.params.saoBlurStdDev,new THREE.Vector2(1,0)),this.prevStdDev=this.params.saoBlurStdDev,this.prevNumSamples=this.params.saoBlurRadius),e.setClearColor(0),e.setRenderTarget(this.beautyRenderTarget),e.clear(),e.render(this.scene,this.camera),this.supportsDepthTextureExtension||this.renderOverride(e,this.depthMaterial,this.depthRenderTarget,0,1),this.supportsNormalTexture&&this.renderOverride(e,this.normalMaterial,this.normalRenderTarget,7829503,1),this.renderPass(e,this.saoMaterial,this.saoRenderTarget,16777215,1),this.params.saoBlur&&(this.renderPass(e,this.vBlurMaterial,this.blurIntermediateRenderTarget,16777215,1),this.renderPass(e,this.hBlurMaterial,this.saoRenderTarget,16777215,1));let s=this.materialCopy;3===this.params.output?this.supportsDepthTextureExtension?(this.materialCopy.uniforms.tDiffuse.value=this.beautyRenderTarget.depthTexture,this.materialCopy.needsUpdate=!0):(this.depthCopy.uniforms.tDiffuse.value=this.depthRenderTarget.texture,this.depthCopy.needsUpdate=!0,s=this.depthCopy):4===this.params.output?(this.materialCopy.uniforms.tDiffuse.value=this.normalRenderTarget.texture,this.materialCopy.needsUpdate=!0):(this.materialCopy.uniforms.tDiffuse.value=this.saoRenderTarget.texture,this.materialCopy.needsUpdate=!0),0===this.params.output?s.blending=THREE.CustomBlending:s.blending=THREE.NoBlending,this.renderPass(e,s,this.renderToScreen?null:r),e.setClearColor(this._oldClearColor,this.oldClearAlpha),e.autoClear=a}renderPas
***Laterals*** began with a simple premise: to evoke a sense of deliberate structure despite the purely aleatoric nature of the underlying algorithm. The title refers to the various rotations given to the cuboids that conform to the scenes.
h>0.) { n=m.origin+m.dir*l; vec3 R=gNorm(n); p=tint(n); p=hsvA(p,uHSV.x,uHSV.yz); p*=gLight(n,m,R,d,t); float e=cAO(n,R,uAO.x,uAO.y),U=clamp(curve(n,uCurve.x)*.5+.5,0.,1.); U=U*uCurve.y+uCurve.z; float w=U*e; p*=w; T=p; } float e=1.-step(0.,h*2.-1.); p*=1.-e; ${l} float R=smoothstep(uFog.x,uFog.y,l*h); ${p} p=mix(p,vec3(0.),R); p+=d*T*mix(1.25,.15,R); ${u} p=aces(p); const float w=2.2; p=pow(p,vec3(1./w)); gl_FragColor=vec4(p,1.); }\n`})}function injectBlur(e){let t="";return"Asteroids"!=e&&"Exoplanet"!=e||(t="vec4 blurred = blur9(sInput, v, uResolution, vec2(1.0));\n float blurMask = smoothstep(0.0, 1.0, w - 0.1);\n r = mix(r, blurred, blurMask);"),t}function getPostShader(e,t){const c=injectBlur(t);return new THREE.ShaderMaterial({uniforms:uniformsPost,vertexShader:"varying vec2 vUv; void main(){vUv=uv;gl_Position=vec4(position,1.);}",fragmentShader:`varying vec2 vUv; uniform vec2 uResolution; uniform sampler2D sInput; uniform float uStep, uMask;\n#define FXAA_REDUCE_MIN (1./128.)\n#define FXAA_REDUCE_MUL (1./8.)\n#define FXAA_SPAN_MAX 8.\nvec4 fxaa(sampler2D s,vec2 v,vec2 u,vec2 m,vec2 z,vec2 y,vec2 F,vec2 f){ vec4 r; mediump vec2 x=vec2(1./u.x,1./u.y); vec3 t=texture2D(s,m).xyz,a=texture2D(s,z).xyz,X=texture2D(s,y).xyz,p=texture2D(s,F).xyz; vec4 d=texture2D(s,f); vec3 b=d.xyz,w=vec3(.299,.587,.114); float l=dot(t,w),N=dot(a,w),e=dot(X,w),L=dot(p,w),c=dot(b,w),A=min(c,min(min(l,N),min(e,L))),o=max(c,max(max(l,N),max(e,L))); mediump vec2 i; i.x=-(l+N-(e+L)); i.y=l+e-(N+L); float D=max((l+N+e+L)*(.25*FXAA_REDUCE_MUL),FXAA_REDUCE_MIN),n=1./(min(abs(i.x),abs(i.y))+D); i=min(vec2(FXAA_SPAN_MAX,FXAA_SPAN_MAX),max(vec2(-FXAA_SPAN_MAX,-FXAA_SPAN_MAX),i*n))*x; vec3 T=.5*(texture2D(s,v*x+i*(1./3.-.5)).xyz+texture2D(s,v*x+i*(2./3.-.5)).xyz),R=T*.5+.25*(texture2D(s,v*x+i*-.5).xyz+texture2D(s,v*x+i*.5).xyz); float M=dot(R,w); if(M<A||M>o) r=vec4(T,d.w); else r=vec4(R,d.w); return r; } vec4 blur9(sampler2D s,vec2 v,vec2 z,vec2 x){ vec4 r=vec4(0.); vec2 i=vec2(1.38462)*x,w=vec2(3.23077)*x; r+=texture2D(s,v)*.227027; r+=texture2D(s,v+i/z)*.316216; r+=texture2D(s,v-i/z)*.316216; r+=texture2D(s,v+w/z)*.0702703; r+=texture2D(s,v-w/z)*.0702703; return r; } void main() { vec2 v=vUv,s=v*2.-1.; s.x*=uResolution.x/uResolution.y; float w=length(s); vec4 r; vec2 i=1./uResolution*uStep,m=v+vec2(-i.x,i.y),z=v+i,x=v-i,u=v+vec2(i.x,-i.y),L=v; r=fxaa(sInput,v*uResolution,uResolution,m,z,x,u,L); ${c} float t=1.-smoothstep(.1,uMask,w); r*=t; gl_FragColor=r; }`})}function print(e){console.log(e)}const PROB_FOV=.03,PROB_SPEED=.2,PROB_SPEED_ULTRA=.03,PROB_BEAM=.15;function remap(e,t,c,r,s){return r+(s-r)*(e-t)/(c-t)}function randomFromArray(e,t){const c=t.length;return t[Math.min(parseInt(e*c),c-1)%c]}function selectTerrain(e,t,c,r){let s;s=e<.34?["Exoplanet"]:e<.62?["Tunnel"]:e<.96?["Carved","Helicoidal"]:["Asteroids"],0==r&&(s=["Exoplanet"]);let n=randomFromArray(t,s);return null!=c&&(n=c),{data:terrains[n],name:n}}function selectPath(e,t){const c=e.Paths;return c[randomFromArray(t,Object.keys(c))]}function selectFogFar(e,t){const c=randomFromArray(t,Object.keys(e.Visibility));return{name:c,val:e.Visibility[c]}}function selectHeightFog(e,t){return{active:e.HeightFog,pars:e.HeightFogOptions,attenuate:e.HeightFogAttenuate}}function selectDeformation(e,t){const c=randomFromArray(t[0],Object.keys(e.Deformations)),r=e.DeformationWeights[c],s=remap(t[1],0,1,r[0],r[1]),n=e.DeformationStrengths[c],i=remap(t[2],0,1,n[0],n[1]);return{name:c,val:e.Deformations[c],weight:s,strength:i}}function selectHorizon(e,t){const c=e.Horizon,r=randomFromArray(t,Object.keys(e.HorizonOptions));return{active:c,name:r,far:e.HorizonOptions[r]}}function selectBackground(e,t){let c=0;return t<e.BackgroundChance&&(c=1),c}function selectBackground(e,t){let c=0;return t<e.BackgroundChance&&(c=1),c}function selectPalette(e,t,c){let r=Object.keys(e.Palettes),s=r,n=randomFromArray(t[0],s),i=e.Palettes[n];if("smooth"==c.name){s=[];for(let t=0;t<r.length;t++){const c=r[t];e.Palettes[c].s&&s.push(c)}n=randomFromArray(t[0],s),(i=e.Palettes[n]).pS=remap(t[1],0,1,.03,.1),i.pSb=remap(t[2],0,1,.05,1)}return{name:n,vals:i}}function selectSpeed(e,t,c,r){let s="Normal";if(e<PROB_SPEED&&r.warp)if(t<=PROB_SPEED_ULTRA)s="Hyper";else{s=randomFromArray(c,["Fast","Hasty","Slow"])}return{name:s,val:{Slow:.33,Normal:.5,Fast:.75,Hasty:1,Hyper:2}[s]}}function selectFOV(e,t){let c=["Normal",127];return e<PROB_FOV&&("Tunnel"==t||"Helicoidal"==t)&&(c=["Warp",170]),{name:c[0],val:c[1]}}function selectBeam(e,t){const c={White:[1,1,1],Red:[1,0,0],Green:[0,1,0],Blue:[0,0,1]};let r="White";return e<PROB_BEAM&&(r=randomFromArray(t,Object.keys(c))),{name:r,val:c[r]}}function selectSmooth(e){let t;return{name:t=e?"Smooth":"Rough"}}function processConfig(e,t,c,r){let s={};return s.FOV=selectFOV(c[0],e),s.Speed=selectSpeed(c[1],c[2],c[3],t),s.Beam=selectBeam(c[4],c[5]),s.Surface=selectSmooth(r),s}function processTerrain(e,t,c,r){let s=0;if(0==r%100&&0!=r){e=selectTerrain(0,0,randomFromArray(c,["Helicoidal","Tunnel"]),r),t.val=0,e.data.HeightFog=0,s=1}return{terrain:e,smooth:s}}function selectRarities(e,t,c,r){const s=processTerrain(e,t,c[0],r),n=s.terrain,i=s.smooth,o=n.name,a=selectPath(n.data,c[1]);return{terrain:n,paths:a,config:processConfig(o,a,c.slice(2,8),i)}}class Random{constructor(){this.useA=!1;let e=function(e){let t=parseInt(e.substr(0,8),16),c=parseInt(e.substr(8,8),16),r=parseInt(e.substr(16,8),16),s=parseInt(e.substr(24,8),16);return function(){let e=((t|=0)+(c|=0)|0)+(s|=0)|0;return s=s+1|0,t=c^c>>>9,c=(r|=0)+(r<<3)|0,r=(r=r<<21|r>>>11)+e|0,(e>>>0)/4294967296}};this.prngA=new e(tokenData.hash.substr(2,32)),this.prngB=new e(tokenData.hash.substr(34,32));for(let e=0;e<1e6;e+=2)this.prngA(),this.prngB()}rand(){return this.useA=!this.useA,this.useA?this.prngA():this.prngB()}randBool(e){return this.rand()<e}getSeeds(){let e=[];for(let t=0;t<32;t++)e.push(this.rand());return e}}function createUniforms(e,t,c,r,s,n,i,o,a,v,l,p){const u=[n.p1x[0],n.p1x[1],n.p1y[0],n.p1y[1]],f=[n.p2x[0],n.p2x[1],n.p2y[0],n.p2y[1]],h=l.vals,g=p.Beam.val.concat([5]),y=[a.active,a.pars[0],a.pars[1],a.attenuate],m=[p.FOV.val,p.Speed.val],x=[v.weight,v.strength],S=[h.pSb,h.pS];uniforms={uTime:{value:0},uPath1:{value:u},uPath2:{value:f},uFog:{value:[0,o.val]},uColorA:{value:h.cA},uColorB:{value:h.cB},uColorC:{value:h.cC},uColorD:{value:h.cD},uColorE:{value:h.cE},uColorProps:{value:S},uHSV:{value:h.hsv},uBeamColor:{value:g},uLight1Color:{value:h.lg1},uStaticLight1:{value:n.l1},uResolution:{value:[e.x,e.y]},uSeed:{value:c},uTerrainOps:{value:x},uFog2Color:{value:h.f2},uHeightFog:{value:y},uHorizon:{value:i.far},uAO:{value:r.AO},uStaticLight2:{value:n.l2},uLight2Color:{value:h.lg2},uHSVHorz:{value:h.hsv2},uCurve:{value:r.Curve},uConfig:{value:m},uHSVStars:{value:h.hsv3}}}function createPostUniforms(e){uniformsPost={uResolution:{value:[e.x,e.y]},uTime:{value:0},uStep:{value:1},sInput:{value:null},uMask:{value:2.5}}}function getDimension(e){const t={Canvas:1.25,Adapt:window.innerHeight/window.innerWidth}[e];let c,r;return window.innerHeight>=t*window.innerWidth?(c=window.innerWidth,r=t*window.innerWidth):(r=window.innerHeight,c=window.innerHeight/t),{x:c,y:r}}function getRenderTarget(e,t){const c=new THREE.WebGLRenderTarget(t.x,t.y,{depthBuffer:!1,stencilBuffer:!1}),r=new THREE.OrthographicCamera(-1,1,1,-1,0,1),s=new THREE.Scene,n=new THREE.PlaneGeometry(2,2),i=new THREE.Mesh(n,e);return s.add(i),c.texture.wrapS=c.texture.wrapT=THREE.ClampToEdgeWrapping,{target:c,scene:s,camera:r}}function createScene(e){camera=new THREE.OrthographicCamera(-1,1,1,-1,0,1),scene=new THREE.Scene;const t=new THREE.PlaneGeometry(2,2),c=new THREE.Mesh(t,e);scene.add(c)}let camera,scene,renderer,main,uniforms,uniformsPost,aspect,fov,isAnimation=!0;function lowResCheck(){return window.matchMedia("only screen and (max-width: 760px)").matches}function init(){aspect="Canvas";let e=new Random,t=getDimension(aspect);const c=e.getSeeds();let r=Math.floor(parseInt(tokenData.tokenId)/1e6);const s=parseInt(tokenData.tokenId)%(1e6*r);let n=2*e.randBool(.5)-1;const i=c[1]*n,o=[i,3.141592*i*2],a=selectTerrain(c[2],c[3],null,s),v=selectDeformation(a.data,c.slice(4,7)),l=selectRarities(a,v,c.slice(7,17),s),p=l.config,u=l.terrain.data,f=l.terrain.name,h=l.paths,g=p.Surface,y=selectHorizon(u,c[17]),m=selectFogFar(u,c[18]),x=selectHeightFog(u,c[19]),S=selectBackground(u,c[20]),d=selectPalette(u,c.slice(21,24),g);renderer=new THREE.WebGL1Renderer({preserveDrawingBuffer:!0,depth:!1,antialias:!1,powerPreference:"high-performance"});const A=lowResCheck()?Math.min(2,window.devicePixelRatio):window.devicePixelRatio;renderer.setPixelRatio(A),renderer.setSize(t.x,t.y);renderer.autoClear=!1;const C=new THREE.Vector2;renderer.getDrawingBufferSize(C),createUniforms(t={x:C.width,y:C.height},s,o,u,f,h,y,m,x,v,d,p);const D=getShader(uniforms,v.val,f,S,x.active,y.active);main=getRenderTarget(D,t),createPostUniforms(t),uniformsPost.sInput.value=main.target.texture,createScene(getPostShader(uniformsPost,f));let E=document.createElement("div");document.body.appendChild(E),E.appendChild(renderer.domElement),onWindowResize(),window.addEventListener("resize",onWindowResize),document.addEventListener("keydown",onDocumentKeyDown,!1)}function updateFOV(e){uniforms.uConfig.value[0]=e}function updateSpeed(e){uniforms.uConfig.value[1]=e}function updateVignette(e){uniformsPost.uMask.value=e}function onDocumentKeyDown(e){var t=e.which;32==t?isAnimation=!isAnimation:49==t?updateSpeed(.33):50==t?updateSpeed(.5):51==t?updateSpeed(.74):52==t?updateSpeed(1):57==t?(aspect="Adapt",updateFOV(90),updateVignette(4),onWindowResize()):48==t&&(aspect="Canvas",updateFOV(127),updateVignette(2.5),onWindowResize())}function onWindowResize(){let e=getDimension(aspect);renderer.setSize(e.x,e.y);const t=new THREE.Vector2;renderer.getDrawingBufferSize(t),e={x:t.width,y:t.height},uniforms.uResolution={value:[e.x,e.y]},uniformsPost.uResolution={value:[e.x,e.y]},renderer.render(scene,camera),render()}function render(){renderer.setRenderTarget(main.target),renderer.render(main.scene,main.camera),renderer.setRenderTarget(null),renderer.render(scene,camera)}function animate(){requestAnimationFrame(animate);let e=performance.now()/1e3;isAnimation&&(uniforms.uTime.value=e,uniformsPost.uTime.value=e,render())}init(),render(),animate();
"use strict";const CopyShader={uniforms:{tDiffuse:{type:"t",value:null},opacity:{type:"f",value:1}},vertexShader:["varying vec2 vUv;","void main() {","vUv = uv;","gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );","}"].join("\n"),fragmentShader:["uniform float opacity;","uniform sampler2D tDiffuse;","varying vec2 vUv;","void main() {","vec4 texel = texture2D( tDiffuse, vUv );","gl_FragColor = opacity * texel;","}"].join("\n")};class EffectComposer{constructor(e,t){if(this.renderer=e,void 0===t){const r=e.getSize(new THREE.Vector2);this._pixelRatio=e.getPixelRatio(),this._width=r.width,this._height=r.height,(t=new THREE.WebGLRenderTarget(this._width*this._pixelRatio,this._height*this._pixelRatio)).texture.name="EffectComposer.rt1"}else this._pixelRatio=1,this._width=t.width,this._height=t.height;this.renderTarget1=t,this.renderTarget2=t.clone(),this.renderTarget2.texture.name="EffectComposer.rt2",this.writeBuffer=this.renderTarget1,this.readBuffer=this.renderTarget2,this.renderToScreen=!0,this.passes=[],this.copyPass=new ShaderPass(CopyShader),this.clock=new THREE.Clock}swapBuffers(){const e=this.readBuffer;this.readBuffer=this.writeBuffer,this.writeBuffer=e}addPass(e){this.passes.push(e),e.setSize(this._width*this._pixelRatio,this._height*this._pixelRatio)}insertPass(e,t){this.passes.splice(t,0,e),e.setSize(this._width*this._pixelRatio,this._height*this._pixelRatio)}removePass(e){const t=this.passes.indexOf(e);-1!==t&&this.passes.splice(t,1)}isLastEnabledPass(e){for(let t=e+1;t<this.passes.length;t++)if(this.passes[t].enabled)return!1;return!0}render(e){void 0===e&&(e=this.clock.getDelta());const t=this.renderer.getRenderTarget();let r=!1;for(let t=0,a=this.passes.length;t<a;t++){const a=this.passes[t];if(!1!==a.enabled){if(a.renderToScreen=this.renderToScreen&&this.isLastEnabledPass(t),a.render(this.renderer,this.writeBuffer,this.readBuffer,e,r),a.needsSwap){if(r){const t=this.renderer.getContext(),r=this.renderer.state.buffers.stencil;r.setFunc(t.NOTEQUAL,1,4294967295),this.copyPass.render(this.renderer,this.writeBuffer,this.readBuffer,e),r.setFunc(t.EQUAL,1,4294967295)}this.swapBuffers()}void 0!==THREE.MaskPass&&(a instanceof THREE.MaskPass?r=!0:a instanceof THREE.ClearMaskPass&&(r=!1))}}this.renderer.setRenderTarget(t)}reset(e){if(void 0===e){const t=this.renderer.getSize(new THREE.Vector2);this._pixelRatio=this.renderer.getPixelRatio(),this._width=t.width,this._height=t.height,(e=this.renderTarget1.clone()).setSize(this._width*this._pixelRatio,this._height*this._pixelRatio)}this.renderTarget1.dispose(),this.renderTarget2.dispose(),this.renderTarget1=e,this.renderTarget2=e.clone(),this.writeBuffer=this.renderTarget1,this.readBuffer=this.renderTarget2}setSize(e,t){this._width=e,this._height=t;const r=this._width*this._pixelRatio,a=this._height*this._pixelRatio;this.renderTarget1.setSize(r,a),this.renderTarget2.setSize(r,a);for(let e=0;e<this.passes.length;e++)this.passes[e].setSize(r,a)}setPixelRatio(e){this._pixelRatio=e,this.setSize(this._width,this._height)}}class Pass{constructor(){this.enabled=!0,this.needsSwap=!0,this.clear=!1,this.renderToScreen=!1}setSize(){}}const _camera=new THREE.OrthographicCamera(-1,1,1,-1,0,1),_geometry=new THREE.BufferGeometry;_geometry.setAttribute("position",new THREE.Float32BufferAttribute([-1,3,0,-1,-1,0,3,-1,0],3)),_geometry.setAttribute("uv",new THREE.Float32BufferAttribute([0,2,0,0,2,0],2));class FullScreenQuad{constructor(e){this._mesh=new THREE.Mesh(_geometry,e)}dispose(){this._mesh.geometry.dispose()}render(e){e.render(this._mesh,_camera)}get material(){return this._mesh.material}set material(e){this._mesh.material=e}}class ShaderPass extends Pass{constructor(e,t){super(),this.textureID=void 0!==t?t:"tDiffuse",e instanceof THREE.ShaderMaterial?(this.uniforms=e.uniforms,this.material=e):e&&(this.uniforms=THREE.UniformsUtils.clone(e.uniforms),this.material=new THREE.ShaderMaterial({defines:Object.assign({},e.defines),uniforms:this.uniforms,vertexShader:e.vertexShader,fragmentShader:e.fragmentShader})),this.fsQuad=new FullScreenQuad(this.material)}render(e,t,r){this.uniforms[this.textureID]&&(this.uniforms[this.textureID].value=r.texture),this.fsQuad.material=this.material,this.renderToScreen?(e.setRenderTarget(null),this.fsQuad.render(e)):(e.setRenderTarget(t),this.clear&&e.clear(e.autoClearColor,e.autoClearDepth,e.autoClearStencil),this.fsQuad.render(e))}}class RenderPass extends Pass{constructor(e,t,r,a,n){super(),this.scene=e,this.camera=t,this.overrideMaterial=r,this.clearColor=a,this.clearAlpha=void 0!==n?n:0,this.clear=!0,this.clearDepth=!1,this.needsSwap=!1,this._oldClearColor=new THREE.Color}render(e,t,r){const a=e.autoClear;let n,i;e.autoClear=!1,void 0!==this.overrideMaterial&&(i=this.scene.overrideMaterial,this.scene.overrideMaterial=this.overrideMaterial),this.clearColor&&(e.getClearColor(this._oldClearColor),n=e.getClearAlpha(),e.setClearColor(this.clearColor,this.clearAlpha)),this.clearDepth&&e.clearDepth(),e.setRenderTarget(this.renderToScreen?null:r),this.clear&&e.clear(e.autoClearColor,e.autoClearDepth,e.autoClearStencil),e.render(this.scene,this.camera),this.clearColor&&e.setClearColor(this._oldClearColor,n),void 0!==this.overrideMaterial&&(this.scene.overrideMaterial=i),e.autoClear=a}}class Random{constructor(){this.useA=!1;let e=function(e){let t=parseInt(e.substr(0,8),16),r=parseInt(e.substr(8,8),16),a=parseInt(e.substr(16,8),16),n=parseInt(e.substr(24,8),16);return function(){let e=((t|=0)+(r|=0)|0)+(n|=0)|0;return n=n+1|0,t=r^r>>>9,r=(a|=0)+(a<<3)|0,a=(a=a<<21|a>>>11)+e|0,(e>>>0)/4294967296}};this.prngA=new e(tokenData.hash.substr(2,32)),this.prngB=new e(tokenData.hash.substr(34,32));for(let e=0;e<1e6;e+=2)this.prngA(),this.prngB()}r(){return this.useA=!this.useA,this.useA?this.prngA():this.prngB()}rr(e,t){return e+(t-e)*this.r()}ri(e,t){return Math.floor(this.rr(e,t+1))}rb(e){return this.r()<e}rc(e){return e[this.ri(0,e.length-1)]}}let scene,renderer,camera,clock,mesh,composer,displacementPass,displacementShader,l1,l2,isMobile,animation=!1;const projectNumber=Math.floor(parseInt(tokenData.tokenId)/1e6),mintNumber=parseInt(tokenData.tokenId)%1e6;let R=new Random;const r=()=>R.r(),rr=(e,t)=>R.rr(e,t),ri=(e,t)=>R.ri(e,t),rb=e=>R.rb(e),rc=e=>R.rc(e),rs=()=>rb(.5)>0?1:-1,toRadians=e=>Math.PI/180*e,rMask=(e,t)=>rr(e-t,e+t),rMask2=(e,t)=>{const r=e[0]>0,a=e[1]>0;return[rMask(e[0],t)*r,rMask(e[1],t)*a]},repRand=(e,t)=>{const r=rr(e,t);return[r,r]},repRand3=(e,t)=>{const r=rr(e,t);return[r,r,r]};function wRand(e,t){const a=[];for(let e=0;e<t.length;e+=1)a[e]=t[e]+(a[e-1]||0);const n=a[a.length-1]*r();for(let t=0;t<e.length;t+=1)if(a[t]>=n)return e[t]}function shuffle(e){for(var t,a,n=e.length;n;)a=Math.floor(r()*n--),t=e[n],e[n]=e[a],e[a]=t;return e}function toRGB(e){return[((e=Math.floor(e))>>16&255)/255,(e>>8&255)/255,(255&e)/255]}function add(e){return e.reduce(((e,t)=>e+t),0)}function normSum(e){const t=add(e);return e.map((e=>e*(1/t)))}function evenProb(e){const t=e.length;return Array(t).fill(1/t)}function u(e){return{value:e}}function gShape(){return"sphere"}function gBuild(e){return"dcon"}function gVert(e,t){return{k:"skewed",v:0}}function gZCam(e){return rr(3.6,4.6)}function gMeshRot(e,t){const r=wRand([["zero",[0,0,0]],["xy",[45,45*(rb(.5)>0?1:-1),0]]],[.5,.5]);return{k:r[0],v:r[1]}}function gAngle(e,t){return 0}function gSRange(e,t,r,a){const n=normSum([1,1.2,4,4,.15,.15]);let i=wRand([[rr(.35,.4),8e3,"nano"],[rr(.5,.75),8e3,"micro"],[rr(.9,1.25),8e3,"small"],[rr(1.4,1.5),8e3,"medium"],[rr(2,3),1e3,"big"],[rr(3,4),500,"mega"]],n);return"SLICED"==a&&(i[2]="continuum"),{v:[i[0],i[0],i[0]],i:i[1],k:i[2]}}function gPRange(e,t){return[3,3,2.5]}function gLights(e,t,r){const a=[[[5,1,5,2],[-2,0,1,6]],[[2,2,5,5],[-1,-1,2,.5]],[[-3,2,2,1],[5,-2.5,5,4]]];return wRand(a,evenProb(a))}function gScale(e,t){return 1}function gDisp(e,t,r,a){const n=wRand(["ho","vo","c"],[.3,.3,.3]),i="vo"==n?[0,rr(.35,.65)]:"ho"==n?[rr(.35,.65),0]:[0,0],s=function(e,t){const r=t[0];let a;return a=r<=.75?[[.5,[.2,.2],3],[1,repRand(.1,.3),1]]:r<=1?[[rr(.75,1),repRand(.1,.15),1],[rr(.5,.75),repRand(.1,.25),2],[.5,repRand(.2,.34),2]]:[[.75,[.3,.3],1],[.5,[.25,.25],2]],wRand(a,evenProb(a))}(0,r);return{dir:n,midPoint:i,freq:s[0],weights:rMask2(s[1],0),octaves:s[2]}}function gWrap(e){return"repeat"}function gFinish(e){return wRand(["NORMAL","SLICED"],[.85,.15])}function gInverse(){return rb(.5)}function gMat(e){const t=wRand([["glossy",.2,0,.25],["rough",1,0,.7],["coated",.5,.35,.7]],[.05,.85,.1]);return{k:t[0],r:t[1],m:t[2],i:t[3]}}function gPalette(e){const t={0:[2120566,15130821,16291640,13845523,271427,.01,1.01,1.1],1:[4562234,16777215,6596594,4145473,1973791,0,1,1.2],2:[4470864,12303972,15397070,12633537,8225937,0,1.05,1.5],3:[13354938,15131351,2633011,3159101,4540754,.03,1,1],4:[15718862,14598385,12033261,9797615,7430639,0,1,1.05],5:[12442047,3031122,16762967,16777215,4268596,-.03,1,1.5],6:[16250866,12965997,2497557,15001283,15752483,0,1,1],7:[5871085,279433,16580427,16755973,8171460,-.04,1,1.2],8:[13762590,2589067,7179309,15508269,15425574,.01,1,1],9:[1529984,16708813,10072218,7631457,2766650,0,1,1.02],10:[9209514,8476059,8273807,14352253,11726747,0,1.04,1.1],11:[11907778,5930364,1
***Vahria*** is an inquiry into the breaking points between two and three dimensions. Using spheres I attempt to create a tension between flatness and depth. Regular bodies become distorted blobs and circles. Occasionally, triangles are revealed, which are fundamental units in computer graphics. The project is also a playful comment on constructivism and its dominance as a visual style in current generative art NFTs. In Vahria, I take the deconstructivist approach, favouring fragmented volumes, asymmetries and skewness, over linear forms, straight lines and right angles. It is strongly encouraged to see the pieces on **full screen**. Otherwise, details of the renders are missed. You can export high-resolution images of the mints to disk by clicking on the artwork and pressing one of the following keys: [1] : Full HD resolution (1440x1920) [2]: 4K resolution (2880x3840) [3]: 6k Resolution (4320x5760)
.y,128,r*t.x,a*t.y,230.4),"#3d3c3b","#777065"),n.fillRect(0,153.6,r,230.4)}let c=[];const l=[o,o,s,s,function(e){let t={x:.5,y:.5};var s=n.createRadialGradient(r*t.x,a*t.y,0,r*t.x,a*t.y,128);i(s,"white","#858ba0"),n.fillRect(0,89.6,r,51.2),t={x:.5,y:.1},i(s=n.createRadialGradient(r*t.x,a*t.y,102.4,r*t.x,a*t.y,204.8),"white","#777065"),n.fillRect(0,153.6,r,230.4)},function(e){i(n.createRadialGradient(128,128,51.2,128,128,192),"white","blue"),n.fillRect(0,89.6,r,64)}],d=[!0,!1,"000000","3f3d3c",1,1];for(let e=0;e<6;e++)n.fillStyle="#000000",n.fillRect(0,0,r,a),l[e](d[e]),c.push(t.toDataURL());const h=new THREE.PMREMGenerator(renderer),u=(new THREE.CubeTextureLoader).load(c,(()=>{e.envMap=h.fromCubemap(u).texture,h.dispose()}))}function lowResCheck(){return window.matchMedia("only screen and (max-width: 760px)").matches}function setPixelRatio(){isMobile=lowResCheck();const e=isMobile?2:Math.min(window.devicePixelRatio+1,3);renderer.setPixelRatio(e)}function init(){let e=getDim();scene=new THREE.Scene,renderer=new THREE.WebGLRenderer({antialias:!0,preserveDrawingBuffer:!0,powerPreference:"high-performance"}),setPixelRatio();let t=new THREE.Color(p.colors[4]);const r=p.palette;[2,5].includes(r)?t=new THREE.Color(16777215):[18].includes(r)&&(t=new THREE.Color(0)),renderer.setSize(e.x,e.y),renderer.setClearColor(t,.5),renderer.physicallyCorrectLights=!0,renderer.shadowMap.enabled=!0,renderer.shadowMap.type=THREE.PCFSoftShadowMap;const a=new THREE.Vector2;renderer.getDrawingBufferSize(a),e={x:a.width,y:a.height,aspect:a.width/a.height};createContainer();camera=new THREE.OrthographicCamera(-1*e.aspect,1*e.aspect,1,-1,.1,10),camera.position.set(0,0,p.camZ),camera.lookAt(new THREE.Vector3),camera.zoom=.5,l1=getDirLight(p.lights[0],16777215,!0),scene.add(l1),l2=getDirLight(p.lights[1],16777215,!0),scene.add(l2);const n=new THREE.AmbientLight(16777215,.1);scene.add(n);const i=new THREE.MeshStandardMaterial;i.envMapIntensity=p.envIntensity,i.roughness=p.roughness,i.metalness=p.metalness,i.opacity=.72,i.transparent=!0,generateCubeMap(i);const s=p.colors;createInstances(p.instances,i,s);const o=new THREE.WebGLMultisampleRenderTarget(e.x,e.y,{minFilter:THREE.LinearFilter,magFilter:THREE.LinearFilter,format:THREE.RGBAFormat});let c="mirror"==p.wrapMode?THREE.MirroredRepeatWrapping:THREE.RepeatWrapping;o.texture.wrapS=o.texture.wrapT=c,composer=new EffectComposer(renderer,o);const l=new RenderPass(scene,camera);composer.addPass(l);const d=p.octaves>1?`float c=0.; for(int d=0;d<${p.octaves};d++)c+=b*na(a*e,vec3(0.),0.),a*=2.,b*=f;return c;`:"float c = b*na(a*e,vec3(0.),0.); return c;";displacementShader={uniforms:{tDiffuse:u(null),ja:u([e.x,e.y]),u:u([p.seed,p.freq]),Y:u(p.weights),ka:u(p.midPoint),R:u(s.slice(5,8)),la:u(p.invert)},vertexShader:"varying vec2 vUv; void main() { gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.); vUv = uv; }",fragmentShader:`uniform sampler2D tDiffuse;varying vec2 vUv;uniform vec3 R;uniform vec2 ja,u,Y,ka;uniform float la;float ma(vec2 b){vec3 a=fract(vec3(b.xyx)*.1031);a+=dot(a,a.yzx+33.33);return fract((a.x+a.y)*a.z);} ${simplexNoise} float Q(vec3 e,float a,float b,float f){${d}}vec2 ha(vec2 b){vec2 a=b*u.y*4.;float c=Q(vec3(a,u.x),1.,1.,.5),d=Q(vec3(a+vec2(40.123,134.921),u.x),1.,1.,.5);vec2 e=vec2(c,d);return e;}vec3 ta(const vec3 a){return a*(2.51*a+.03)/(a*(2.43*a+.59)+.14);}mat4 ua(float a){return mat4(1,0,0,0,0,1,0,0,0,0,1,0,a,a,a,1);}mat4 va(float a){float b=(1.-a)/2.;return mat4(a,0,0,0,0,a,0,0,0,0,a,0,b,b,b,1);}mat4 wa(float c){vec3 a=vec3(.3086,.6094,.082);float b=1.-c;vec3 d=vec3(a.x*b);d+=vec3(c,0,0);vec3 e=vec3(a.y*b);e+=vec3(0,c,0);vec3 f=vec3(a.z*b);f+=vec3(0,0,c);return mat4(d,0,e,0,f,0,0,0,0,1);}float ia(vec3 a){return dot(a,vec3(.299,.587,.114));}void main(){vec2 b=vUv;b.x=la>0.?1.-b.x:b.x;vec2 c=b,d=ha(b),f=d*Y,g=d*.5+.5;c-=ka,c=mix(c,c+f,smoothstep(0.,1.,g));vec4 a=texture2D(tDiffuse,c);float e=ia(a.rgb),h=smoothstep(0.,.1,e);a.rgb*=h,a.rgb=ta(a.rgb),a.rgb=pow(a.rgb,vec3(.454545)),a=ua(R.x)*va(R.y)*wa(R.z)*a,a.rgb+=ma(b*ja)*.1,gl_FragColor=clamp(a,0.,1.);}`},displacementPass=new ShaderPass(displacementShader),displacementPass.enabled=!0,composer.addPass(displacementPass),window.addEventListener("resize",onWindowResize),document.addEventListener("keydown",onDocumentKeyDown,!1),clock=new THREE.Clock}function onDocumentKeyDown(e){const t=new THREE.Vector2(1440,1920);switch(e.which){case 49:saveAsImage(t);break;case 50:saveAsImage(t.multiplyScalar(2));break;case 51:saveAsImage(t.multiplyScalar(3))}}function updateResize(){const e=new THREE.Vector2;renderer.getDrawingBufferSize(e);const t={x:e.width,y:e.height,aspect:e.width/e.height};displacementShader.uniforms.uRes={value:[t.x,t.y]},camera.aspect=t.aspect,camera.updateProjectionMatrix()}function onWindowResize(){let e=getDim();renderer.setSize(e.x,e.y),setPixelRatio(),updateResize(),render()}function upScaleExport(e,t){renderer.setPixelRatio(1),renderer.setSize(e,t),updateResize(),render()}function saveAsImage(e){let t;upScaleExport(e.x,e.y);Date.now||(Date.now=function(){return(new Date).getTime()});let r=Math.floor(Date.now()/1e3);try{const e="image/png";t=renderer.domElement.toDataURL(e),saveFile(t.replace(e,"image/octet-stream"),`Vahria#${mintNumber}_${r}.png`)}catch(e){return void console.log(e)}onWindowResize()}const saveFile=function(e,t){const r=document.createElement("a");"string"==typeof r.download?(document.body.appendChild(r),r.download=t,r.href=e,r.click(),document.body.removeChild(r)):location.replace(uri)};function update(){camera.lookAt(new THREE.Vector3),camera.updateProjectionMatrix()}function render(){composer.render()}let frame=0;function animate(){time=clock.getElapsedTime(),window.requestAnimationFrame(animate),update(),animation?(render(),frame=0):frame<10&&(render(),frame+=1)}init(),animate();
4344183,2305075,10535377,0,1,1.1],12:[10289158,1659231,6661793,15566395,15354668,0,1,1],13:[13515281,469832,2384251,16707790,16288806,.01,1,1.15],14:[13553870,1644825,15814693,16777215,15132902,0,1,1.15],15:[1317406,15791103,4211788,3751743,2041382,0,1,1],16:[657672,2241339,15392981,13020303,6180927,0,1,1.9],17:[3368330,8829912,7704143,16166445,15885337,0,1,1.12],18:[16711422,16168524,15351084,3817281,6535886,0,1,1.1],19:[7289398,13139994,14797476,9608602,5534304,0,1,1.2],20:[13859385,13784116,7498570,15786420,15508823,0,1,1.1],21:[9831194,16427286,16515070,7169902,1776414,0,1,1.1],22:[42733,8370176,863316,16142621,16757760,0,1.02,1.1],23:[5777159,9907463,16730942,16757263,16770376,0,1.01,1.05],24:[15718311,3939072,8763312,15848851,16328960,0,1,1.26],25:[2390944,14869218,664675,16463424,6315870,0,1.06,1],26:[13751774,12039874,8615273,6648147,9087609,0,1.02,3],27:[6124414,16579836,135451,4145221,3156271,0,1,2],28:[9947562,13732155,15702825,3610381,13942932,0,1.05,1.2],29:[14303591,16044894,16177326,3031127,540023,0,1.02,1.1],30:[14155826,2829634,9279918,15594228,15672124,0,1,1],31:[6575426,8371106,16119484,15051558,12471335,0,1,1.15],32:[15125682,14530706,11569512,8344889,10249796,0,1.03,1.05],33:[157633,30148,15704075,14045448,5840650,0,1.04,1.02],34:[2994148,13099310,16120284,3223857,4036282,0,1.02,1.2],35:[2735890,11272015,572861,15866687,16750868,0,1.05,1.1],36:[402725,1332558,15194544,16034598,792857,.01,1.03,1.04],37:[4004864,8763055,15783315,16263680,15718568,0,1.03,1.04],38:[15971407,15193272,14338478,1844529,16400720,.01,1.04,1.3],39:[15379595,3494e3,7166330,11887990,15035247,.03,1.02,1.06],40:[14719784,15459775,2831168,1916524,5136224,0,1.03,1.07],41:[9667969,12965348,8283473,4612962,8951467,0,1.05,1.6],42:[1716574,10208227,15266296,3770568,15821646,0,1,1.15],43:[16697498,16758183,16569806,16313835,16374980,0,1.02,1.1],44:[16706750,16154427,16008999,2952226,16245696,0,1.01,1.02],45:[14342093,10727818,5800279,3824192,3427905,0,1.03,1.16],46:[15592937,14077122,16116704,14931402,14007727,0,1,1],47:[2508371,2792847,15320170,16032353,15167313,0,1,1.12],48:[6319160,2635288,16710368,14524766,12348453,0,1.03,1.1],49:[15260604,8761251,0,5308418,11494980,0,1,1]};let r=mintNumber%Object.keys(t).length;return{k:r,v:t[r]}}function gParams(){const e=gShape(),t=gBuild(e),r=gVert(e,t),a=gZCam(t),n=gMeshRot(e,t),i=gAngle(t,n.k),s=gLights(e,n.k,t),o=gFinish(e),c=gSRange(e,n.k,t,o),l=gPRange(e,n.k),d=gScale(t,e),h=gWrap(e),u=gDisp(t,e,c,n.k),f=gInverse(t),m=gMat(e),v=gPalette(e);return{seed:mintNumber,shape:e,build:t,vertices:r.k,vNoise:r.v,camZ:a,rotaName:n.k,rota:n.v,rotation:i,sRange:c.v,instances:c.i,sizeName:c.k,pRange:l,lights:s,scale:d,freq:u.freq,direction:u.dir,midPoint:u.midPoint,weights:u.weights,octaves:u.octaves,wrapMode:h,finish:o,invert:f,material:m.k,roughness:m.r,metalness:m.m,envIntensity:m.i,palette:v.k,colors:v.v}}const p=gParams();function getDim(){const e=window.innerHeight,t=.75*window.innerHeight;return{x:t,y:e,aspect:t/e}}function createContainer(){const e=document.createElement("div");return e.appendChild(renderer.domElement),document.body.appendChild(e),e}function getDirLight(e,t,r){const a=new THREE.DirectionalLight(t,e[3]);return a.position.set(e[0],e[1],e[2]),a.castShadow=r,a.shadow.camera.near=.5,a.shadow.camera.far=10,a.shadow.camera.left=-5,a.shadow.camera.right=5,a.shadow.camera.top=5,a.shadow.camera.bottom=-5,a.shadow.mapSize.set(6e3,6e3),a}let time,simplexNoise="\nvec4 v(vec4 a){vec4 b=mod(a,289.);return mod((b*34.+10.)*b,289.);}float na(vec3 f,vec3 o,float F){const mat3 G=mat3(0.,1.,1.,1.,0.,1.,1.,1.,0.),I=mat3(-.5,.5,.5,.5,-.5,.5,.5,.5,-.5);vec3 H;H=G*f;vec3 a=floor(H),J=fract(H),w=step(J.xyx,J.yzz),K=1.-w,L=vec3(K.z,w.xy),M=vec3(K.xy,w.z),Z=min(L,M),_=max(L,M),k=a+Z,l=a+_,m=a+vec3(1.),g,h,i,j;g=I*a,h=I*k,i=I*l,j=I*m;vec3 x=f-g,y=f-h,z=f-i,A=f-j;if(any(greaterThan(o,vec3(0.)))){vec4 p=vec4(g.x,h.x,i.x,j.x),q=vec4(g.y,h.y,i.y,j.y),r=vec4(g.z,h.z,i.z,j.z);p=o.x>0.?mod(p,o.x):p,q=o.y>0.?mod(q,o.y):q,r=o.z>0.?mod(r,o.z):r,a=floor(G*vec3(p.x,q.x,r.x)+.5),k=floor(G*vec3(p.y,q.y,r.y)+.5),l=floor(G*vec3(p.z,q.z,r.z)+.5),m=floor(G*vec3(p.w,q.w,r.w)+.5);}vec4 B=v(v(v(vec4(a.z,k.z,l.z,m.z))+vec4(a.y,k.y,l.y,m.y))+vec4(a.x,k.x,l.x,m.x)),N=B*3.883222,b=B*-.00692+.99654,O=B*.108706,s=cos(N),t=sin(N),C=sqrt(1.-b*b),c,d,e;if(F!=0.){vec4 S=s*C,T=t*C,oa=b,D=sin(O),E=cos(O),P=t*D-s*E,pa=mix(P*t,D,b),qa=mix(-P*s,E,b),ra=-(T*E+S*D),U=vec4(sin(F)),V=vec4(cos(F));c=V*S+U*pa,d=V*T+U*qa,e=V*oa+U*ra;}else c=s*C,d=t*C,e=b;vec3 aa=vec3(c.x,d.x,e.x),ba=vec3(c.y,d.y,e.y),ca=vec3(c.z,d.z,e.z),da=vec3(c.w,d.w,e.w);vec4 n=.5-vec4(dot(x,x),dot(y,y),dot(z,z),dot(A,A));n=max(n,0.);vec4 ea=n*n,fa=ea*n,ga=vec4(dot(aa,x),dot(ba,y),dot(ca,z),dot(da,A));float sa=dot(fa,ga);return 39.5*sa;}\n";function createInstances(e,t,a){let n=new THREE.SphereBufferGeometry(.25,25,25);const i=Math.ceil(Math.sqrt(e)),s={uSR:u(p.sRange),uNA:u(p.vNoise),uS:u(p.scale),uPR:u(p.pRange),uW:u(i),uR:u(p.rotation)},o=`#include <common> \n #define ${p.finish} \n vec3 toLinear(vec3 sRGB){bvec3 co = lessThan(sRGB, vec3(0.04045));vec3 h = pow((sRGB + vec3(0.055))/vec3(1.055), vec3(2.4));vec3 l = sRGB/vec3(12.92);return mix(h, l, co);}\n uniform int uW; uniform float uNA; uniform vec3 uSR; uniform float uS; uniform vec3 uPR; uniform float uR; attribute int aID; attribute vec3 aPos; attribute vec3 aScale; attribute float aThres; attribute vec3 aAxis; attribute vec3 aColor; attribute int aRota; varying vec4 vColor; ${simplexNoise} mat4 rotMat(vec3 ax, float a) { ax = normalize(ax); float s = sin(a); float c = cos(a); float oc = 1.0 - c; return mat4(oc * ax.x * ax.x + c, oc * ax.x * ax.y - ax.z * s, oc * ax.z * ax.x + ax.y * s, 0., oc * ax.x * ax.y + ax.z * s, oc * ax.y * ax.y + c, oc * ax.y * ax.z - ax.x * s, 0., oc * ax.z * ax.x - ax.y * s, oc * ax.y * ax.z + ax.x * s, oc * ax.z * ax.z + c, 0.,0., 0., 0., 1.0);} `,c=" int id = aID; int vid = gl_VertexID; ivec2 xy = ivec2(id % uW, id / uW); vec3 v = vec3(vid, vid+id, vid*id); float iW = float(uW); vec3 pos = vec3( (vec2(xy) - iW*.5) / iW, 0. ); pos += aPos; pos *= uPR; vec3 vN = vec3( na(v, vec3(0.), 0.), na(v + vec3(103.71, 94.13, 123.123), vec3(0.), 0.), na(v + vec3(237.88, 219.78, 712.313), vec3(0.), 0.) ); vec3 vPos = vN * uNA; mat4 rMat = rotMat(aAxis, radians(uR));",l=" vec3 P = transformed; vec3 s = aScale * uSR; vec4 newPos = vec4(P * s * uS, 1.); newPos = (aRota > 0) ? rMat * newPos : newPos; transformed = newPos.xyz + pos - vPos;";t.onBeforeCompile=e=>{for(const t in s)e.uniforms[t]=s[t];e.vertexShader=e.vertexShader.replace("#include <common>",o),e.vertexShader=e.vertexShader.replace("#include <beginnormal_vertex>",`#include <beginnormal_vertex>\n ${c} if(aRota > 0){ vec4 newNormal = rMat * vec4(objectNormal, 1); objectNormal = normalize(newNormal.xyz); }\n `),e.vertexShader=e.vertexShader.replace("#include <begin_vertex>",`#include <begin_vertex> ${l}\n #ifdef SLICED\n transformed.xyz -= (objectNormal * (vN.x*.5+.5));\n #endif\n vColor = vec4(toLinear(aColor), 1.) * vec4(.6, .6, .6, 1.);`),e.fragmentShader=e.fragmentShader.replace("#include <common>","#include <common> varying vec4 vColor;"),e.fragmentShader=e.fragmentShader.replace("vec4 diffuseColor = vec4( diffuse, opacity );","vec4 diffuseColor = vec4( vColor.rgb, opacity );")};const d=new THREE.MeshDepthMaterial({depthPacking:THREE.RGBADepthPacking});d.onBeforeCompile=e=>{for(const t in s)e.uniforms[t]=s[t];e.vertexShader=e.vertexShader.replace("#include <common>",o),e.vertexShader=e.vertexShader.replace("#include <begin_vertex>",`\n #include <begin_vertex>\n ${c}\n ${l}\n `)};const h=new THREE.InstancedMesh(n,t,e);h.rotation.set(toRadians(p.rota[0]),toRadians(p.rota[1]),toRadians(p.rota[2])),h.receiveShadow=!0,h.castShadow=!0,h.frustumCulled=!1,h.customDepthMaterial=d,h.needsUpdate=!0,scene.add(h);const f=(e,t,r)=>{e[t]=r[0],e[t+1]=r[1],e[t+2]=r[2]},m=e=>new Int32Array(e),v=e=>new Float32Array(3*e),g=new THREE.Object3D,x=m(e),R=m(e),w=v(e),b=v(e),y=v(e),E=v(e);for(let t=0,n=0,i=e;t<i;t++,n+=3){x[t]=t;const e=r();f(b,n,[e,e,e]),f(w,n,[rr(-1,1),rr(-1,1),rr(-1,1)]);const i=r();i<.25?(f(y,n,[0,1,0]),f(E,n,toRGB(a[0])),R[t]=1):i<.5?(f(y,n,[0,0,1]),f(E,n,toRGB(a[1])),R[t]=1):i<.75?(f(y,n,[-1,0,0]),f(E,n,toRGB(a[2])),R[t]=1):(f(y,n,[0,0,0]),f(E,n,toRGB(a[3])),R[t]=0),g.position.set(0,0,0),g.updateMatrix(),h.setMatrixAt(t,g.matrix)}const S=(e,t,r)=>{n.setAttribute(e,new THREE.InstancedBufferAttribute(t,r))};S("aID",x,1),S("aRota",R,1),S("aPos",w,3),S("aScale",b,3),S("aAxis",y,3),S("aColor",E,3)}function generateCubeMap(e){var t=document.createElement("canvas");const r=256,a=256;t.width=r,t.height=a;var n=t.getContext("2d");function i(e,t,r){e.addColorStop(0,t),e.addColorStop(1,r),n.fillStyle=e}function s(e){n.fillStyle=e,n.fillRect(0,0,r,a)}function o(e){let t={x:.65,y:.05};var s=n.createRadialGradient(r*t.x,a*t.y,51.2,r*t.x,a*t.y,204.8);i(s,"white","#777065");const o=e?[.15,1]:[0,.75];n.fillRect(r*o[0],38.4,r*o[1],102.4),e&&(t={x:.5,y:.5},i(s=n.createRadialGradient(r*t.x,a*t.y,51.2,r*t.x,a*t.y,153.6),"white","blue"),n.fillRect(38.4,89.6,179.2,51.2)),t={x:.5,y:.1},i(s=n.createRadialGradient(r*t.x,a*t
4344183,2305075,10535377,0,1,1.1],12:[10289158,1659231,6661793,15566395,15354668,0,1,1],13:[13515281,469832,2384251,16707790,16288806,.01,1,1.15],14:[13553870,1644825,15814693,16777215,15132902,0,1,1.15],15:[1317406,15791103,4211788,3751743,2041382,0,1,1],16:[657672,2241339,15392981,13020303,6180927,0,1,1.9],17:[3368330,8829912,7704143,16166445,15885337,0,1,1.12],18:[16711422,16168524,15351084,3817281,6535886,0,1,1.1],19:[7289398,13139994,14797476,9608602,5534304,0,1,1.2],20:[13859385,13784116,7498570,15786420,15508823,0,1,1.1],21:[9831194,16427286,16515070,7169902,1776414,0,1,1.1],22:[42733,8370176,863316,16142621,16757760,0,1.02,1.1],23:[5777159,9907463,16730942,16757263,16770376,0,1.01,1.05],24:[15718311,3939072,8763312,15848851,16328960,0,1,1.26],25:[2390944,14869218,664675,16463424,6315870,0,1.06,1],26:[13751774,12039874,8615273,6648147,9087609,0,1.02,3],27:[6124414,16579836,135451,4145221,3156271,0,1,2],28:[9947562,13732155,15702825,3610381,13942932,0,1.05,1.2],29:[14303591,16044894,16177326,3031127,540023,0,1.02,1.1],30:[14155826,2829634,9279918,15594228,15672124,0,1,1],31:[6575426,8371106,16119484,15051558,12471335,0,1,1.15],32:[15125682,14530706,11569512,8344889,10249796,0,1.03,1.05],33:[157633,30148,15704075,14045448,5840650,0,1.04,1.02],34:[2994148,13099310,16120284,3223857,4036282,0,1.02,1.2],35:[2735890,11272015,572861,15866687,16750868,0,1.05,1.1],36:[402725,1332558,15194544,16034598,792857,.01,1.03,1.04],37:[4004864,8763055,15783315,16263680,15718568,0,1.03,1.04],38:[15971407,15193272,14338478,1844529,16400720,.01,1.04,1.3],39:[15379595,3494e3,7166330,11887990,15035247,.03,1.02,1.06],40:[14719784,15459775,2831168,1916524,5136224,0,1.03,1.07],41:[9667969,12965348,8283473,4612962,8951467,0,1.05,1.6],42:[1716574,10208227,15266296,3770568,15821646,0,1,1.15],43:[16697498,16758183,16569806,16313835,16374980,0,1.02,1.1],44:[16706750,16154427,16008999,2952226,16245696,0,1.01,1.02],45:[14342093,10727818,5800279,3824192,3427905,0,1.03,1.16],46:[15592937,14077122,16116704,14931402,14007727,0,1,1],47:[2508371,2792847,15320170,16032353,15167313,0,1,1.12],48:[6319160,2635288,16710368,14524766,12348453,0,1.03,1.1],49:[15260604,8761251,0,5308418,11494980,0,1,1]};let r=mintNumber%Object.keys(t).length;return{k:r,v:t[r]}}function gParams(){const e=gShape(),t=gBuild(e),r=gVert(e,t),a=gZCam(t),n=gMeshRot(e,t),i=gAngle(t,n.k),s=gLights(e,n.k,t),o=gFinish(e),c=gSRange(e,n.k,t,o),l=gPRange(e,n.k),d=gScale(t,e),h=gWrap(e),u=gDisp(t,e,c,n.k),f=gInverse(t),m=gMat(e),v=gPalette(e);return{seed:mintNumber,shape:e,build:t,vertices:r.k,vNoise:r.v,camZ:a,rotaName:n.k,rota:n.v,rotation:i,sRange:c.v,instances:c.i,sizeName:c.k,pRange:l,lights:s,scale:d,freq:u.freq,direction:u.dir,midPoint:u.midPoint,weights:u.weights,octaves:u.octaves,wrapMode:h,finish:o,invert:f,material:m.k,roughness:m.r,metalness:m.m,envIntensity:m.i,palette:v.k,colors:v.v}}const p=gParams();function getDim(){const e=window.innerHeight,t=.75*window.innerHeight;return{x:t,y:e,aspect:t/e}}function createContainer(){const e=document.createElement("div");return e.appendChild(renderer.domElement),document.body.appendChild(e),e}function getDirLight(e,t,r){const a=new THREE.DirectionalLight(t,e[3]);return a.position.set(e[0],e[1],e[2]),a.castShadow=r,a.shadow.camera.near=.5,a.shadow.camera.far=10,a.shadow.camera.left=-5,a.shadow.camera.right=5,a.shadow.camera.top=5,a.shadow.camera.bottom=-5,a.shadow.mapSize.set(6e3,6e3),a}let time,simplexNoise="\nvec4 v(vec4 a){vec4 b=mod(a,289.);return mod((b*34.+10.)*b,289.);}float na(vec3 f,vec3 o,float F){const mat3 G=mat3(0.,1.,1.,1.,0.,1.,1.,1.,0.),I=mat3(-.5,.5,.5,.5,-.5,.5,.5,.5,-.5);vec3 H;H=G*f;vec3 a=floor(H),J=fract(H),w=step(J.xyx,J.yzz),K=1.-w,L=vec3(K.z,w.xy),M=vec3(K.xy,w.z),Z=min(L,M),_=max(L,M),k=a+Z,l=a+_,m=a+vec3(1.),g,h,i,j;g=I*a,h=I*k,i=I*l,j=I*m;vec3 x=f-g,y=f-h,z=f-i,A=f-j;if(any(greaterThan(o,vec3(0.)))){vec4 p=vec4(g.x,h.x,i.x,j.x),q=vec4(g.y,h.y,i.y,j.y),r=vec4(g.z,h.z,i.z,j.z);p=o.x>0.?mod(p,o.x):p,q=o.y>0.?mod(q,o.y):q,r=o.z>0.?mod(r,o.z):r,a=floor(G*vec3(p.x,q.x,r.x)+.5),k=floor(G*vec3(p.y,q.y,r.y)+.5),l=floor(G*vec3(p.z,q.z,r.z)+.5),m=floor(G*vec3(p.w,q.w,r.w)+.5);}vec4 B=v(v(v(vec4(a.z,k.z,l.z,m.z))+vec4(a.y,k.y,l.y,m.y))+vec4(a.x,k.x,l.x,m.x)),N=B*3.883222,b=B*-.00692+.99654,O=B*.108706,s=cos(N),t=sin(N),C=sqrt(1.-b*b),c,d,e;if(F!=0.){vec4 S=s*C,T=t*C,oa=b,D=sin(O),E=cos(O),P=t*D-s*E,pa=mix(P*t,D,b),qa=mix(-P*s,E,b),ra=-(T*E+S*D),U=vec4(sin(F)),V=vec4(cos(F));c=V*S+U*pa,d=V*T+U*qa,e=V*oa+U*ra;}else c=s*C,d=t*C,e=b;vec3 aa=vec3(c.x,d.x,e.x),ba=vec3(c.y,d.y,e.y),ca=vec3(c.z,d.z,e.z),da=vec3(c.w,d.w,e.w);vec4 n=.5-vec4(dot(x,x),dot(y,y),dot(z,z),dot(A,A));n=max(n,0.);vec4 ea=n*n,fa=ea*n,ga=vec4(dot(aa,x),dot(ba,y),dot(ca,z),dot(da,A));float sa=dot(fa,ga);return 39.5*sa;}\n";function createInstances(e,t,a){let n=new THREE.SphereBufferGeometry(.25,25,25);const i=Math.ceil(Math.sqrt(e)),s={uSR:u(p.sRange),uNA:u(p.vNoise),uS:u(p.scale),uPR:u(p.pRange),uW:u(i),uR:u(p.rotation)},o=`#include <common> \n #define ${p.finish} \n vec3 toLinear(vec3 sRGB){bvec3 co = lessThan(sRGB, vec3(0.04045));vec3 h = pow((sRGB + vec3(0.055))/vec3(1.055), vec3(2.4));vec3 l = sRGB/vec3(12.92);return mix(h, l, co);}\n uniform int uW; uniform float uNA; uniform vec3 uSR; uniform float uS; uniform vec3 uPR; uniform float uR; attribute int aID; attribute vec3 aPos; attribute vec3 aScale; attribute float aThres; attribute vec3 aAxis; attribute vec3 aColor; attribute int aRota; varying vec4 vColor; ${simplexNoise} mat4 rotMat(vec3 ax, float a) { ax = normalize(ax); float s = sin(a); float c = cos(a); float oc = 1.0 - c; return mat4(oc * ax.x * ax.x + c, oc * ax.x * ax.y - ax.z * s, oc * ax.z * ax.x + ax.y * s, 0., oc * ax.x * ax.y + ax.z * s, oc * ax.y * ax.y + c, oc * ax.y * ax.z - ax.x * s, 0., oc * ax.z * ax.x - ax.y * s, oc * ax.y * ax.z + ax.x * s, oc * ax.z * ax.z + c, 0.,0., 0., 0., 1.0);} `,c=" int id = aID; int vid = gl_VertexID; ivec2 xy = ivec2(id % uW, id / uW); vec3 v = vec3(vid, vid+id, vid*id); float iW = float(uW); vec3 pos = vec3( (vec2(xy) - iW*.5) / iW, 0. ); pos += aPos; pos *= uPR; vec3 vN = vec3( na(v, vec3(0.), 0.), na(v + vec3(103.71, 94.13, 123.123), vec3(0.), 0.), na(v + vec3(237.88, 219.78, 712.313), vec3(0.), 0.) ); vec3 vPos = vN * uNA; mat4 rMat = rotMat(aAxis, radians(uR));",l=" vec3 P = transformed; vec3 s = aScale * uSR; vec4 newPos = vec4(P * s * uS, 1.); newPos = (aRota > 0) ? rMat * newPos : newPos; transformed = newPos.xyz + pos - vPos;";t.onBeforeCompile=e=>{for(const t in s)e.uniforms[t]=s[t];e.vertexShader=e.vertexShader.replace("#include <common>",o),e.vertexShader=e.vertexShader.replace("#include <beginnormal_vertex>",`#include <beginnormal_vertex>\n ${c} if(aRota > 0){ vec4 newNormal = rMat * vec4(objectNormal, 1); objectNormal = normalize(newNormal.xyz); }\n `),e.vertexShader=e.vertexShader.replace("#include <begin_vertex>",`#include <begin_vertex> ${l}\n #ifdef SLICED\n transformed.xyz -= (objectNormal * (vN.x*.5+.5));\n #endif\n vColor = vec4(toLinear(aColor), 1.) * vec4(.6, .6, .6, 1.);`),e.fragmentShader=e.fragmentShader.replace("#include <common>","#include <common> varying vec4 vColor;"),e.fragmentShader=e.fragmentShader.replace("vec4 diffuseColor = vec4( diffuse, opacity );","vec4 diffuseColor = vec4( vColor.rgb, opacity );")};const d=new THREE.MeshDepthMaterial({depthPacking:THREE.RGBADepthPacking});d.onBeforeCompile=e=>{for(const t in s)e.uniforms[t]=s[t];e.vertexShader=e.vertexShader.replace("#include <common>",o),e.vertexShader=e.vertexShader.replace("#include <begin_vertex>",`\n #include <begin_vertex>\n ${c}\n ${l}\n `)};const h=new THREE.InstancedMesh(n,t,e);h.rotation.set(toRadians(p.rota[0]),toRadians(p.rota[1]),toRadians(p.rota[2])),h.receiveShadow=!0,h.castShadow=!0,h.frustumCulled=!1,h.customDepthMaterial=d,h.needsUpdate=!0,scene.add(h);const f=(e,t,r)=>{e[t]=r[0],e[t+1]=r[1],e[t+2]=r[2]},m=e=>new Int32Array(e),v=e=>new Float32Array(3*e),g=new THREE.Object3D,x=m(e),R=m(e),w=v(e),b=v(e),y=v(e),E=v(e);for(let t=0,n=0,i=e;t<i;t++,n+=3){x[t]=t;const e=r();f(b,n,[e,e,e]),f(w,n,[rr(-1,1),rr(-1,1),rr(-1,1)]);const i=r();i<.25?(f(y,n,[0,1,0]),f(E,n,toRGB(a[0])),R[t]=1):i<.5?(f(y,n,[0,0,1]),f(E,n,toRGB(a[1])),R[t]=1):i<.75?(f(y,n,[-1,0,0]),f(E,n,toRGB(a[2])),R[t]=1):(f(y,n,[0,0,0]),f(E,n,toRGB(a[3])),R[t]=0),g.position.set(0,0,0),g.updateMatrix(),h.setMatrixAt(t,g.matrix)}const S=(e,t,r)=>{n.setAttribute(e,new THREE.InstancedBufferAttribute(t,r))};S("aID",x,1),S("aRota",R,1),S("aPos",w,3),S("aScale",b,3),S("aAxis",y,3),S("aColor",E,3)}function generateCubeMap(e){var t=document.createElement("canvas");const r=256,a=256;t.width=r,t.height=a;var n=t.getContext("2d");function i(e,t,r){e.addColorStop(0,t),e.addColorStop(1,r),n.fillStyle=e}function s(e){n.fillStyle=e,n.fillRect(0,0,r,a)}function o(e){let t={x:.65,y:.05};var s=n.createRadialGradient(r*t.x,a*t.y,51.2,r*t.x,a*t.y,204.8);i(s,"white","#777065");const o=e?[.15,1]:[0,.75];n.fillRect(r*o[0],38.4,r*o[1],102.4),e&&(t={x:.5,y:.5},i(s=n.createRadialGradient(r*t.x,a*t.y,51.2,r*t.x,a*t.y,153.6),"white","blue"),n.fillRect(38.4,89.6,179.2,51.2)),t={x:.5,y:.1},i(s=n.createRadialGradient(r*t.x,a*t
"use strict";const CopyShader={uniforms:{tDiffuse:{type:"t",value:null},opacity:{type:"f",value:1}},vertexShader:["varying vec2 vUv;","void main() {","vUv = uv;","gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );","}"].join("\n"),fragmentShader:["uniform float opacity;","uniform sampler2D tDiffuse;","varying vec2 vUv;","void main() {","vec4 texel = texture2D( tDiffuse, vUv );","gl_FragColor = opacity * texel;","}"].join("\n")};class EffectComposer{constructor(e,t){if(this.renderer=e,void 0===t){const r=e.getSize(new THREE.Vector2);this._pixelRatio=e.getPixelRatio(),this._width=r.width,this._height=r.height,(t=new THREE.WebGLRenderTarget(this._width*this._pixelRatio,this._height*this._pixelRatio)).texture.name="EffectComposer.rt1"}else this._pixelRatio=1,this._width=t.width,this._height=t.height;this.renderTarget1=t,this.renderTarget2=t.clone(),this.renderTarget2.texture.name="EffectComposer.rt2",this.writeBuffer=this.renderTarget1,this.readBuffer=this.renderTarget2,this.renderToScreen=!0,this.passes=[],this.copyPass=new ShaderPass(CopyShader),this.clock=new THREE.Clock}swapBuffers(){const e=this.readBuffer;this.readBuffer=this.writeBuffer,this.writeBuffer=e}addPass(e){this.passes.push(e),e.setSize(this._width*this._pixelRatio,this._height*this._pixelRatio)}insertPass(e,t){this.passes.splice(t,0,e),e.setSize(this._width*this._pixelRatio,this._height*this._pixelRatio)}removePass(e){const t=this.passes.indexOf(e);-1!==t&&this.passes.splice(t,1)}isLastEnabledPass(e){for(let t=e+1;t<this.passes.length;t++)if(this.passes[t].enabled)return!1;return!0}render(e){void 0===e&&(e=this.clock.getDelta());const t=this.renderer.getRenderTarget();let r=!1;for(let t=0,a=this.passes.length;t<a;t++){const a=this.passes[t];if(!1!==a.enabled){if(a.renderToScreen=this.renderToScreen&&this.isLastEnabledPass(t),a.render(this.renderer,this.writeBuffer,this.readBuffer,e,r),a.needsSwap){if(r){const t=this.renderer.getContext(),r=this.renderer.state.buffers.stencil;r.setFunc(t.NOTEQUAL,1,4294967295),this.copyPass.render(this.renderer,this.writeBuffer,this.readBuffer,e),r.setFunc(t.EQUAL,1,4294967295)}this.swapBuffers()}void 0!==THREE.MaskPass&&(a instanceof THREE.MaskPass?r=!0:a instanceof THREE.ClearMaskPass&&(r=!1))}}this.renderer.setRenderTarget(t)}reset(e){if(void 0===e){const t=this.renderer.getSize(new THREE.Vector2);this._pixelRatio=this.renderer.getPixelRatio(),this._width=t.width,this._height=t.height,(e=this.renderTarget1.clone()).setSize(this._width*this._pixelRatio,this._height*this._pixelRatio)}this.renderTarget1.dispose(),this.renderTarget2.dispose(),this.renderTarget1=e,this.renderTarget2=e.clone(),this.writeBuffer=this.renderTarget1,this.readBuffer=this.renderTarget2}setSize(e,t){this._width=e,this._height=t;const r=this._width*this._pixelRatio,a=this._height*this._pixelRatio;this.renderTarget1.setSize(r,a),this.renderTarget2.setSize(r,a);for(let e=0;e<this.passes.length;e++)this.passes[e].setSize(r,a)}setPixelRatio(e){this._pixelRatio=e,this.setSize(this._width,this._height)}}class Pass{constructor(){this.enabled=!0,this.needsSwap=!0,this.clear=!1,this.renderToScreen=!1}setSize(){}}const _camera=new THREE.OrthographicCamera(-1,1,1,-1,0,1),_geometry=new THREE.BufferGeometry;_geometry.setAttribute("position",new THREE.Float32BufferAttribute([-1,3,0,-1,-1,0,3,-1,0],3)),_geometry.setAttribute("uv",new THREE.Float32BufferAttribute([0,2,0,0,2,0],2));class FullScreenQuad{constructor(e){this._mesh=new THREE.Mesh(_geometry,e)}dispose(){this._mesh.geometry.dispose()}render(e){e.render(this._mesh,_camera)}get material(){return this._mesh.material}set material(e){this._mesh.material=e}}class ShaderPass extends Pass{constructor(e,t){super(),this.textureID=void 0!==t?t:"tDiffuse",e instanceof THREE.ShaderMaterial?(this.uniforms=e.uniforms,this.material=e):e&&(this.uniforms=THREE.UniformsUtils.clone(e.uniforms),this.material=new THREE.ShaderMaterial({defines:Object.assign({},e.defines),uniforms:this.uniforms,vertexShader:e.vertexShader,fragmentShader:e.fragmentShader})),this.fsQuad=new FullScreenQuad(this.material)}render(e,t,r){this.uniforms[this.textureID]&&(this.uniforms[this.textureID].value=r.texture),this.fsQuad.material=this.material,this.renderToScreen?(e.setRenderTarget(null),this.fsQuad.render(e)):(e.setRenderTarget(t),this.clear&&e.clear(e.autoClearColor,e.autoClearDepth,e.autoClearStencil),this.fsQuad.render(e))}}class RenderPass extends Pass{constructor(e,t,r,a,n){super(),this.scene=e,this.camera=t,this.overrideMaterial=r,this.clearColor=a,this.clearAlpha=void 0!==n?n:0,this.clear=!0,this.clearDepth=!1,this.needsSwap=!1,this._oldClearColor=new THREE.Color}render(e,t,r){const a=e.autoClear;let n,i;e.autoClear=!1,void 0!==this.overrideMaterial&&(i=this.scene.overrideMaterial,this.scene.overrideMaterial=this.overrideMaterial),this.clearColor&&(e.getClearColor(this._oldClearColor),n=e.getClearAlpha(),e.setClearColor(this.clearColor,this.clearAlpha)),this.clearDepth&&e.clearDepth(),e.setRenderTarget(this.renderToScreen?null:r),this.clear&&e.clear(e.autoClearColor,e.autoClearDepth,e.autoClearStencil),e.render(this.scene,this.camera),this.clearColor&&e.setClearColor(this._oldClearColor,n),void 0!==this.overrideMaterial&&(this.scene.overrideMaterial=i),e.autoClear=a}}class Random{constructor(){this.useA=!1;let e=function(e){let t=parseInt(e.substr(0,8),16),r=parseInt(e.substr(8,8),16),a=parseInt(e.substr(16,8),16),n=parseInt(e.substr(24,8),16);return function(){let e=((t|=0)+(r|=0)|0)+(n|=0)|0;return n=n+1|0,t=r^r>>>9,r=(a|=0)+(a<<3)|0,a=(a=a<<21|a>>>11)+e|0,(e>>>0)/4294967296}};this.prngA=new e(tokenData.hash.substr(2,32)),this.prngB=new e(tokenData.hash.substr(34,32));for(let e=0;e<1e6;e+=2)this.prngA(),this.prngB()}r(){return this.useA=!this.useA,this.useA?this.prngA():this.prngB()}rr(e,t){return e+(t-e)*this.r()}ri(e,t){return Math.floor(this.rr(e,t+1))}rb(e){return this.r()<e}rc(e){return e[this.ri(0,e.length-1)]}}let scene,renderer,camera,clock,mesh,composer,displacementPass,displacementShader,l1,l2,isMobile,animation=!1;const projectNumber=Math.floor(parseInt(tokenData.tokenId)/1e6),mintNumber=parseInt(tokenData.tokenId)%1e6;let R=new Random;const r=()=>R.r(),rr=(e,t)=>R.rr(e,t),ri=(e,t)=>R.ri(e,t),rb=e=>R.rb(e),rc=e=>R.rc(e),rs=()=>rb(.5)>0?1:-1,toRadians=e=>Math.PI/180*e,rMask=(e,t)=>rr(e-t,e+t),rMask2=(e,t)=>{const r=e[0]>0,a=e[1]>0;return[rMask(e[0],t)*r,rMask(e[1],t)*a]},repRand=(e,t)=>{const r=rr(e,t);return[r,r]},repRand3=(e,t)=>{const r=rr(e,t);return[r,r,r]};function wRand(e,t){const a=[];for(let e=0;e<t.length;e+=1)a[e]=t[e]+(a[e-1]||0);const n=a[a.length-1]*r();for(let t=0;t<e.length;t+=1)if(a[t]>=n)return e[t]}function shuffle(e){for(var t,a,n=e.length;n;)a=Math.floor(r()*n--),t=e[n],e[n]=e[a],e[a]=t;return e}function toRGB(e){return[((e=Math.floor(e))>>16&255)/255,(e>>8&255)/255,(255&e)/255]}function add(e){return e.reduce(((e,t)=>e+t),0)}function normSum(e){const t=add(e);return e.map((e=>e*(1/t)))}function evenProb(e){const t=e.length;return Array(t).fill(1/t)}function u(e){return{value:e}}function gShape(){return"sphere"}function gBuild(e){return"dcon"}function gVert(e,t){return{k:"skewed",v:0}}function gZCam(e){return rr(3.6,4.6)}function gMeshRot(e,t){const r=wRand([["zero",[0,0,0]],["xy",[45,45*(rb(.5)>0?1:-1),0]]],[.5,.5]);return{k:r[0],v:r[1]}}function gAngle(e,t){return 0}function gSRange(e,t,r,a){const n=normSum([1,1.2,4,4,1.5,.5]);let i=wRand([[rr(.35,.4),8e3,"nano"],[rr(.5,.75),8e3,"micro"],[rr(.9,1.25),8e3,"small"],[rr(1.4,1.5),8e3,"medium"],[rr(2,3),1e3,"big"],[rr(3,4),500,"mega"]],n);return"SLICED"==a&&(i[2]="continuum"),{v:[i[0],i[0],i[0]],i:i[1],k:i[2]}}function gPRange(e,t){return[3,3,2.5]}function gLights(e,t,r){const a=[[[5,1,5,2],[-2,0,1,6]],[[2,2,5,5],[-1,-1,2,.5]],[[-3,2,2,1],[5,-2.5,5,4]]];return wRand(a,evenProb(a))}function gScale(e,t){return 1}function gDisp(e,t,r,a){const n=wRand(["ho","vo","c"],[.3,.3,.3]),i="vo"==n?[0,rr(.35,.65)]:"ho"==n?[rr(.35,.65),0]:[0,0],s=function(e,t){const r=t[0];let a;return a=r<=.75?[[.5,[.2,.2],3],[1,repRand(.1,.3),1]]:r<=1?[[rr(.75,1),repRand(.1,.15),1],[rr(.5,.75),repRand(.1,.25),2],[.5,repRand(.2,.34),2]]:[[.75,[.3,.3],1],[.5,[.25,.25],2]],wRand(a,evenProb(a))}(0,r);return{dir:n,midPoint:i,freq:s[0],weights:rMask2(s[1],0),octaves:s[2]}}function gWrap(e){return"repeat"}function gFinish(e){return wRand(["NORMAL","SLICED"],[.85,.15])}function gInverse(){return rb(.5)}function gMat(e){const t=wRand([["glossy",.2,0,.25],["rough",1,0,.7],["coated",.5,.35,.7]],[.05,.85,.1]);return{k:t[0],r:t[1],m:t[2],i:t[3]}}function gPalette(e){const t={0:[2120566,15130821,16291640,13845523,271427,.01,1.01,1.1],1:[4562234,16777215,6596594,4145473,1973791,0,1,1.2],2:[4470864,12303972,15397070,12633537,8225937,0,1.05,1.5],3:[13354938,15131351,2633011,3159101,4540754,.03,1,1],4:[15718862,14598385,12033261,9797615,7430639,0,1,1.05],5:[12442047,3031122,16762967,16777215,4268596,-.03,1,1.5],6:[16250866,12965997,2497557,15001283,15752483,0,1,1],7:[5871085,279433,16580427,16755973,8171460,-.04,1,1.2],8:[13762590,2589067,7179309,15508269,15425574,.01,1,1],9:[1529984,16708813,10072218,7631457,2766650,0,1,1.02],10:[9209514,8476059,8273807,14352253,11726747,0,1.04,1.1],11:[11907778,5930364,1
***Vahria*** is an inquiry into the breaking points between two and three dimensions. Using spheres I attempt to create a tension between flatness and depth. Regular bodies become distorted blobs and circles. Occasionally, triangles are revealed, which are fundamental units in computer graphics. The project is also a playful comment on constructivism and its dominance as a visual style in current generative art NFTs. In Vahria, I take the deconstructivist approach, favouring fragmented volumes, asymmetries and skewness, over linear forms, straight lines and right angles. By altering and distorting geometries on different levels, I intend to subvert the harmony and form sought-after with the constructivist approach, in favour of something uncontrolled, chaotic, and expressive. It is strongly encouraged to see the pieces on **full screen**. Otherwise, details of the renders are missed. You can export high-resolution images of the mints to disk by clicking on the artwork and pressing one of the following keys: [1] : Full HD resolution (1440x1920) [2]: 4K resolution (2880x3840) [3]: 6k Resolution (4320x5760)