Deck.scene({ id:'lamp', title:'How far you can see', enterWith:'fade', post:{tone:'aces',exposure:1,bloom:.85,threshold:1,vignette:.12,grain:.021}, beats:[{dur:2.4,hold:4},{dur:6,hold:5},{dur:5.8,hold:5}], notes:[ 'Forget test scores. Intelligence is how far you can see. This is one person, with one lantern, in the dark. Everything inside the pool you can think about. Everything outside it is not there.', 'Now light the brightest lantern anyone ever carried. Einstein. Look at how much more of the field he lights. Almost nothing. Now everyone alive, all eight billion of us, together. It is beautiful. It is also still night.', 'So what does it look like when the sun comes up? All of this was always here. What we called the world was one small fold in it.' ], setup(d){ return { u:{uBright:0,uPull:0,uSpread:0,uDawn:0,uMouse:[0,0]}, pic:d.pass(` uniform float uBright,uPull,uSpread,uDawn; uniform vec2 uMouse; const vec3 ember=vec3(1.,.43,.12); float ink(float x){return 1.-smoothstep(-1.,1.2,x);} float segmentL(vec2 q,vec2 a,vec2 b){ vec2 v=b-a; return length(q-a-v*clamp(dot(q-a,v)/dot(v,v),0.,1.)); } vec3 closeField(vec2 screen){ vec2 q=vec2(1250.,540.)+(screen-vec2(1250.,540.))*(1.+2.9*uPull); vec2 floorQ=q-vec2(1320.,807.); float hill=exp(-dot(floorQ/vec2(485.,187.),floorQ/vec2(485.,187.))); float fall=exp(-dot(floorQ/vec2(288.+90.*uBright,104.+26.*uBright),floorQ/vec2(288.+90.*uBright,104.+26.*uBright))); float dirt=.65+.44*vnoise(q*vec2(.074,.14))+.12*hash12(floor(q)); vec3 c=vec3(.012,.017,.026)*(.76+.24*vnoise(q*.003)); c+=ember*(.038*hill+(.23+.19*uBright)*fall)*dirt; c+=vec3(.055,.026,.009)*exp(-length((q-vec2(1325.,480.))/vec2(168.,240.))); vec2 paper=vec2(q.x-1190.+.49*(q.y-823.),q.y-823.+.09*(q.x-1190.)); c=mix(c,vec3(.53,.34,.16)*(.82+.16*vnoise(q*.12)),ink(sdBox(paper,vec2(63.,25.)))*.93); c*=1.-.18*ink(abs(paper.y-.085*paper.x)-1.)*ink(abs(paper.x)-59.); for(int i=0;i<4;i++){ float j=float(i); vec2 b=vec2(1020.+j*191.,835.+33.*sin(j*2.7)); vec2 p=(q-b)/vec2(44.+8.*sin(j*4.),19.+6.*cos(j*2.)); float r=length(p)+.12*(vnoise(p*4.+j)-.5); vec3 rock=mix(vec3(.047,.027,.021),vec3(.29,.155,.066),sat(.46-.55*p.y+.38*p.x)); c=mix(c,rock*(.83+.19*vnoise(q*.2)),1.-smoothstep(.93,1.02,r)); } if(q.y>540.){ for(int i=0;i<5;i++){ float j=float(i), cell=18.+j*7.; float idx=floor((q.x+j*79.)/cell+.5); float rnd=hash12(vec2(idx,j+14.)); float root=idx*cell-j*79.+(rnd-.5)*cell*.3; float base=715.+j*82.+37.*sin(idx*1.74+j); float height=(43.+j*17.)*(.32+.95*rnd); float h=(base-q.y)/height; if(h>0. && h<1.04){ float lean=(rnd-.46)*36.+sin(uTime*1.25+idx*.73+j)*10.; float axis=root+lean*h*h; float blade=ink(abs(q.x-axis)-(1.9-.95*h)); float leaf=ink(abs(q.x-axis-14.*sin(h*4.9))-.75)*smoothstep(.1,.23,h)*(1.-smoothstep(.58,.77,h)); float tuft=ink(length(vec2((q.x-axis)*.53,(h-.96)*10.))-1.5); float lit=exp(-length((vec2(root,base)-vec2(1320.,806.))/vec2(255.,149.))); vec3 straw=vec3(.017,.015,.013)+vec3(.66,.35,.10)*lit*(.39+.61*rnd)*(1.+.35*uBright); c=mix(c,straw,max(max(blade,leaf*.78),tuft)); } } } float shadow=exp(-length(vec2((q.x-1502.)*.18,(q.y-812.)*.86))); c*=1.-.43*shadow; vec2 hook=q-vec2(1413.,353.); float pole=min(segmentL(q,vec2(1505.,808.),vec2(1505.,352.))-4.6, max(abs(length(hook/vec2(1.,.67))-92.)-4.3,hook.y)); pole=min(pole,segmentL(q,vec2(1321.,354.),vec2(1321.,377.))-3.3); c=mix(c,vec3(.028,.018,.013),ink(pole)); c+=vec3(.23,.11,.034)*ink(abs(pole+1.5)-.8)*exp(-abs(q.y-431.)*.004)*ink(1503.-q.x); vec2 a=q-vec2(1321.,453.); float sway=sin(uTime*1.11)*.016; a=rot2(sway)*a; float radius=length(a/vec2(1.,1.15)); float flick=.93+.075*sin(uTime*9.7)+.033*sin(uTime*16.8); c+=ember*(.23*exp(-radius*.018)+.073*exp(-radius*.006))*flick*(1.+.7*uBright); float glass=ink(max(abs(a.x)-(37.+.0018*a.y*a.y),abs(a.y)-49.)); vec3 pane=vec3(.09,.039,.016)+ember*(.45*exp(-length((a-vec2(0.,22.))/vec2(19.,32.)))+.11); pane+=vec3(.23,.105,.022)*ink(abs(a.x+28.+.0017*a.y*a.y)-1.4); c=mix(c,pane,glass*.90); float wick=ink(sdBox(a-vec2(0.,32.),vec2(4.,9.))); c=mix(c,vec3(.088,.037,.014),wick); vec2 f=a-vec2(0.,14.); f.x+=sin(f.y*.078+uTime*7.)*(.8+.10*max(0.,-f.y)); float flame=length(vec2(f.x*(1.+.023*max(-f.y,0.))/11.,(f.y+5.)/24.)); c+=ember*3.0*(1.-smoothstep(.84,1.13,flame))*flick*(1.+.4*uBright); c+=vec3(3.5,2.7,1.45)*(1.-smoothstep(.48,.84,flame))*flick; float cap=min(sdBox(a-vec2(0.,57.),vec2(52.,8.)),sdBox(a-vec2(0.,48.),vec2(44.,4.))); cap=min(cap,max(abs(a.x)-(44.+1.18*(a.y+55.)),abs(a.y+56.)-13.)); float rail=min(segmentL(a,vec2(-42.,-48.),vec2(-46.,52.)),segmentL(a,vec2(42.,-48.),vec2(46.,52.)))-3.1; float loopD=max(abs(length((a-vec2(0.,-67.))/vec2(1.,1.32))-10.)-2.4,a.y+65.); float metal=min(min(rail,cap),loopD); c=mix(c,vec3(.043,.025,.015)+ember*.16*ink(abs(metal+1.)-1.)*flick,ink(metal)); c+=ember*.27*ink(abs(a.y-50.)-.75)*ink(abs(a.x)-45.); for(int i=0;i<5;i++){ float j=float(i); vec2 m=vec2(sin(uTime*(1.5+j*.14)+j*5.)*(64.+j*11.),cos(uTime*(2.+j*.11)+j*7.)*(45.+j*6.)); vec2 w=rot2(sin(uTime*6.+j))*(a-m); c+=vec3(.66,.43,.20)*ink(length(w/vec2(1.8+.8*sin(uTime*32.+j),.86))-.95)*(.45+.55*exp(-length(m)*.013)); } return c; } vec3 lightPlain(vec2 q){ float y=(q.y-174.)/906.; float z=1./max(.17,y+.19); vec2 p=vec2((q.x-980.)*z*.077,310.*z)+vec2(uMouse.x*2.,-uMouse.y*3.); vec2 grid=vec2(p.x+p.y*.21,p.y*.77); vec2 id=floor(grid), cell=fract(grid)-.5; float rnd=hash12(id); cell-=vec2(hash12(id+13.),hash12(id+37.))*.64-.32; float river=abs(id.x-30.*sin(id.y*.033)-.27*id.y+43.); float river2=abs(id.x+54.*sin(id.y*.026+2.)-.53*id.y+108.); float banks=exp(-river*.068)+.68*exp(-river2*.06); float towns=pow(vnoise(id*.054),3.)*2.2; float wave=clamp(.18+.67*rnd+.14*sin(id.y*.037),.02,.95); float on=smoothstep(wave-.12,wave+.03,uSpread); float pop=step(rnd,clamp(.022+.41*banks+.37*towns,0.,.8)); float mist=smoothstep(.0,.25,y); float spark=exp(-dot(cell,cell)*(64.+90.*rnd)); float halo=exp(-dot(cell,cell)*11.); float ground=vnoise(grid*.032); vec3 c=vec3(.011,.016,.025)+vec3(.025,.019,.016)*mist*(.38+.62*ground); c+=ember*mist*(.065*banks+.035*towns)*uSpread; c+=ember*mist*pop*on*(spark*(.47+2.15*rnd)+halo*.14)*(.89+.11*sin(uTime*1.9+rnd*80.)); float lone=length((q-vec2(1335.,696.))/vec2(1.,.7)); c+=ember*(3.6*exp(-lone*lone*.09)+.39*exp(-lone*.081)+.08*exp(-lone*.023)); c*=1.-.54*(1.-smoothstep(216.,450.,q.y))*(1.-smoothstep(620.,1130.,q.x)); return c; } float archShape(vec2 p,vec2 sizeA){ return length(vec2(p.x/sizeA.x,min(0.,p.y)/sizeA.y))-1.; } vec3 rockGate(vec3 under,vec2 q,vec2 base,vec2 sizeA,float depth,float air){ vec2 p=q-base; p.x+=.11*p.y+sin(p.y*.011)*sizeA.x*.027; float g=vnoise(q*.028); float outer=archShape(p,sizeA); vec2 inside=p-vec2(sizeA.x*.045,5.); vec2 aperture=sizeA*vec2(.685,.815); float hole=archShape(inside,aperture); float rough=(g-.5)*.037+.011*sin(q.y*.069); float top=max(outer+rough,-hole+rough*.68); vec2 w=p-vec2(-depth,depth*.48); float back=max(archShape(w,sizeA)+rough,-archShape(w-vec2(sizeA.x*.045,5.),aperture)+rough*.68); float strat=(q.y+.08*p.x+g*12.+5.*sin(p.x*.009))*(.070+air*.023); float bands=.55+.27*sin(strat)+.14*sin(strat*2.41)+.12*sin(strat*5.13); float ledge=smoothstep(.70,.94,sin(strat*1.1+.6)); vec3 sandstone=mix(vec3(.22,.063,.038),vec3(.67,.252,.105),sat(bands)); float rim=exp(-abs(outer)*44.)*smoothstep(-.36,.55,p.x/sizeA.x); float recess=exp(-abs(hole)*12.); vec3 face=sandstone*(.64+.52*sat(.48+p.x/sizeA.x)+.14*g+.26*ledge)*(1.-.43*recess); face+=vec3(.52,.245,.11)*rim; vec3 sides=sandstone*(.40+.2*bands); vec3 haze=vec3(.34,.43,.50); under=mix(under,mix(sides,haze,air*.86),1.-smoothstep(-.003,.003,back)); under=mix(under,mix(face,haze,air*.77),1.-smoothstep(-.003,.003,top)); float fog=exp(-abs(q.y-(base.y-15.))/77.)*(.26+.23*air); return mix(under,haze,fog*(1.-smoothstep(-.006,.012,min(top,back)))); } vec3 dawnField(vec2 q){ vec2 sun=vec2(694.,581.-uDawn*163.); vec2 uv=(q-sun)/1080.; float dist=length(uv); float skyY=sat((557.-q.y)/557.); vec3 c=mix(vec3(.62,.54,.42),vec3(.092,.23,.39),pow(skyY,.60)); float clouds=vnoise(vec2(q.x*.0033+uTime*.011,q.y*.013)); c=mix(c,vec3(.75,.58,.43),smoothstep(.49,.83,clouds)*smoothstep(.09,.25,skyY)*.29); c+=vec3(.95,.60,.32)*.36*exp(-dist*5.); c+=vec3(1.,.86,.69)*.48*exp(-dist*20.); float angle=atan(uv.y,uv.x+1e-6); float shafts=pow(.5+.5*sin(angle*23.+.46*sin(angle*11.)),7.); c+=vec3(.66,.52,.36)*shafts*exp(-dist*3.9)*smoothstep(.025,.087,dist)*.4; c+=vec3(7.2,7.,6.6)*(1.-smoothstep(.026,.0275,dist)); float dy=q.y-550.; if(dy>0.){ float z=720./(dy+21.); float waves=vnoise(vec2(q.x*.029*z,z*4.+uTime*.27)); float swells=vnoise(vec2(q.x*.0056,z*1.8-uTime*.11)); vec3 water=mix(vec3(.059,.145,.218),vec3(.43,.48,.49),exp(-dy*.013)); water+=vec3(.063,.10,.127)*(waves*.7+swells*.3); float glitter=exp(-abs(q.x-sun.x)/(95.+dy*.48)); water+=vec3(.55,.34,.17)*glitter*(.12+.55*smoothstep(.49,.85,waves))*exp(-dy*.0025); c=mix(c,water,smoothstep(0.,10.,dy)); } vec2 stoneQ=q-vec2(42.,0.); c=rockGate(c,stoneQ,vec2(1452.,640.),vec2(120.,151.),11.,.76); c=rockGate(c,stoneQ,vec2(1433.,699.),vec2(208.,260.),21.,.56); c=rockGate(c,stoneQ,vec2(1394.,787.),vec2(321.,446.),39.,.32); c=rockGate(c,stoneQ,vec2(1350.,962.),vec2(489.,813.),66.,.06); for(int i=0;i<5;i++){ float j=float(i); vec2 b=q-vec2(1120.+j*62.+20.*sin(uTime*.17+j*.42),485.+16.*j+24.*sin(j*1.6+uTime*.1)); b=rot2(.12*sin(j*2.))*b; float span=9.+2.*sin(j*1.4); float wing=b.y+.36*abs(b.x)-.032*b.x*b.x+sin(uTime*3.7+j*.61)*abs(b.x)*.23; float shape=ink(abs(wing)-1.15)*ink(abs(b.x)-span); c=mix(c,vec3(.052,.067,.075),shape*.91); } float shade=smoothstep(706.,1000.,q.y)*(1.-smoothstep(690.,1630.,q.x)); return c*(1.-.46*shade); } void main(){ vec2 q=design(vUv); vec2 shot=q+uMouse*vec2(9.,5.)+vec2(2.7*sin(uTime*.21),1.4*cos(uTime*.19)); float pull=smoothstep(.14,.76,uPull); float dawn=smoothstep(0.,.88,uDawn); vec3 c=vec3(0.); if(dawn<.999){ if(pull<.999)c=closeField(shot); if(pull>.001)c=mix(c,lightPlain(shot),pull); } if(dawn>.001){ vec3 day=dawnField(q+uMouse*vec2(8.,4.)+vec2(2.*sin(uTime*.17),0.)); day*=mix(.37,1.,smoothstep(.05,.92,uDawn)); float lowerShade=smoothstep(795.,952.,q.y)*smoothstep(.50,.69,vUv.x); day=mix(day,vec3(.014,.030,.053),lowerShade*.85); c=mix(c,day,dawn); } o=vec4(c,1.); } `,'Lantern, human lights, and sandstone at dawn') }; }, draw(s,d,r){ const L=d.E.lin; const u=r.u; u.uBright=s.k(1,0,1.55); u.uPull=s.k(1,1.25,4.55); u.uSpread=s.k(1,2.55,6,L); u.uDawn=s.k(2,.15,5.8); u.uMouse[0]=s.mouse.x; u.uMouse[1]=s.mouse.y; r.pic.draw(u); const cream='#ffefd7'; d.text('Intelligence is\nhow far you can see.',{ x:142,y:194,size:86,font:'display',color:cream, show:s.k(0,.3,1.8,L),hide:s.k(1,0,.62,L) }); const label=s.k(0,1.35,2.4,L)*(1-s.k(1,0,.8,L)); d.rect(1396,451,31,1.6,'#dfad70',label*.75); d.text('You',{ x:1439,y:433,size:28,font:'mono',color:'#eacb9c', show:label,style:'fade' }); d.text('Everyone alive',{ x:142,y:190,size:110,font:'display',color:cream, show:s.k(1,.85,2.15,L),hide:s.k(2,0,.63,L) }); const rise=s.k(2,1,3.1); d.text('Superintelligence',{ x:139,y:853+88*(1-rise),size:90,font:'display',color:cream, show:rise,style:'fade' }); const crowd=s.k(1,3.3,5.45); const solar=s.k(2,1.65,4.8); const size=36+11*crowd+13*solar; const reading=solar>=.5?'1.6 × 10^34':crowd>=.5?'1.28 × 10^29':'1.6 × 10^19'; const x=d.view.x1-117, y=d.view.y1; const readIn=s.k(0,1.08,2.1,L); d.text(reading,{ x,y:y-86-size,size,font:'mono', color:cream,align:'right',style:'fade',show:readIn }); d.text('illustration',{ x,y:y-68,size:24,font:'mono',color:'#e2d7c8', align:'right',style:'fade',show:readIn }); } });