VectorW commited on
Commit
db418f4
·
verified ·
1 Parent(s): 352b7b4

Pixel over a splat: no ink lines, brighter robot and objects; ?style= in the URL

Browse files
README.md CHANGED
@@ -40,7 +40,8 @@ The robot model, its inverse kinematics and keyboard map, and the 3D Gaussian sp
40
  materials and procedural textures); 3DGS (the scene's splat; the robot is lit by light captured from
41
  the splat, and its shadows fall on the splat's floor, counters and walls); Pixel (pixel art of the
42
  splat, or of the Toon scene where there is none: about 240 rows of whole pixels, 32 colours chosen
43
- from what the view shows, ordered dithering, and an ink line around the robot and the objects).
 
44
  - **Watch the robot's cameras**: head and both wrists.
45
  - **Run skills**: go to an object, pick it (scripted grasp), place it in or on another object. A held
46
  object stays put: while a gripper squeezes something, MuJoCo's noslip solver keeps it from creeping out
 
40
  materials and procedural textures); 3DGS (the scene's splat; the robot is lit by light captured from
41
  the splat, and its shadows fall on the splat's floor, counters and walls); Pixel (pixel art of the
42
  splat, or of the Toon scene where there is none: about 240 rows of whole pixels, 32 colours chosen
43
+ from what the view shows, and ordered dithering; the modelled scenes keep Toon's ink lines).
44
+ `?env=tabletop&style=pixel` in the URL opens a scene in a renderer.
45
  - **Watch the robot's cameras**: head and both wrists.
46
  - **Run skills**: go to an object, pick it (scripted grasp), place it in or on another object. A held
47
  object stays put: while a gripper squeezes something, MuJoCo's noslip solver keeps it from creeping out
dist/assets/{__vite-browser-external-C_NOlca-.js → __vite-browser-external-DNTH3GAz.js} RENAMED
@@ -1 +1 @@
1
- import{Y as e}from"./index-BGZ4TK1u.js";var t=e(((e,t)=>{t.exports={}}));export default t();
 
1
+ import{Y as e}from"./index-ChiBGwOm.js";var t=e(((e,t)=>{t.exports={}}));export default t();
dist/assets/{index-BGZ4TK1u.js → index-ChiBGwOm.js} RENAMED
The diff for this file is too large to render. See raw diff
 
dist/assets/{ort.wasm.bundle.min-U3rC08vl.js → ort.wasm.bundle.min-CvEVwqBW.js} RENAMED
The diff for this file is too large to render. See raw diff
 
dist/assets/{spark.module-DyJfYrxI.js → spark.module-BNpXZFS8.js} RENAMED
@@ -1,4 +1,4 @@
1
- import{A as e,B as t,C as n,D as r,E as i,F as a,G as o,H as s,I as c,J as l,K as u,L as d,M as f,N as p,O as m,P as h,R as g,S as _,T as v,U as y,V as b,W as x,_ as ee,a as te,b as ne,c as S,d as C,f as w,g as re,h as ie,i as ae,j as oe,k as se,l as ce,m as le,n as T,o as ue,p as de,q as fe,r as pe,s as me,t as he,u as ge,v as _e,w as ve,x as ye,y as be,z as xe}from"./index-BGZ4TK1u.js";var Se=new e(-1,1,1,-1,0,1),Ce=new class extends ue{constructor(){super(),this.setAttribute(`position`,new ie([-1,3,0,-1,-1,0,3,-1,0],3)),this.setAttribute(`uv`,new ie([0,2,0,0,2,0],2))}},we=class{constructor(e){this._mesh=new i(Ce,e)}dispose(){this._mesh.geometry.dispose()}render(e){e.render(this._mesh,Se)}get material(){return this._mesh.material}set material(e){this._mesh.material=e}},E=Uint8Array,Te=Uint16Array,Ee=Int32Array,De=new E([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),Oe=new E([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),ke=new E([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Ae=function(e,t){for(var n=new Te(31),r=0;r<31;++r)n[r]=t+=1<<e[r-1];for(var i=new Ee(n[30]),r=1;r<30;++r)for(var a=n[r];a<n[r+1];++a)i[a]=a-n[r]<<5|r;return{b:n,r:i}},je=Ae(De,2),Me=je.b,Ne=je.r;Me[28]=258,Ne[258]=28;var Pe=Ae(Oe,0),Fe=Pe.b;Pe.r;for(var Ie=new Te(32768),D=0;D<32768;++D){var Le=(D&43690)>>1|(D&21845)<<1;Le=(Le&52428)>>2|(Le&13107)<<2,Le=(Le&61680)>>4|(Le&3855)<<4,Ie[D]=((Le&65280)>>8|(Le&255)<<8)>>1}for(var Re=(function(e,t,n){for(var r=e.length,i=0,a=new Te(t);i<r;++i)e[i]&&++a[e[i]-1];var o=new Te(t);for(i=1;i<t;++i)o[i]=o[i-1]+a[i-1]<<1;var s;if(n){s=new Te(1<<t);var c=15-t;for(i=0;i<r;++i)if(e[i])for(var l=i<<4|e[i],u=t-e[i],d=o[e[i]-1]++<<u,f=d|(1<<u)-1;d<=f;++d)s[Ie[d]>>c]=l}else for(s=new Te(r),i=0;i<r;++i)e[i]&&(s[i]=Ie[o[e[i]-1]++]>>15-e[i]);return s}),ze=new E(288),D=0;D<144;++D)ze[D]=8;for(var D=144;D<256;++D)ze[D]=9;for(var D=256;D<280;++D)ze[D]=7;for(var D=280;D<288;++D)ze[D]=8;for(var Be=new E(32),D=0;D<32;++D)Be[D]=5;var Ve=Re(ze,9,1),He=Re(Be,5,1),Ue=function(e){for(var t=e[0],n=1;n<e.length;++n)e[n]>t&&(t=e[n]);return t},O=function(e,t,n){var r=t/8|0;return(e[r]|e[r+1]<<8)>>(t&7)&n},We=function(e,t){var n=t/8|0;return(e[n]|e[n+1]<<8|e[n+2]<<16)>>(t&7)},Ge=function(e){return(e+7)/8|0},Ke=function(e,t,n){return(t==null||t<0)&&(t=0),(n==null||n>e.length)&&(n=e.length),new E(e.subarray(t,n))},qe=[`unexpected EOF`,`invalid block type`,`invalid length/literal`,`invalid distance`,`stream finished`,`no stream handler`,,`no callback`,`invalid UTF-8 data`,`extra field too long`,`date not in range 1980-2099`,`filename too long`,`stream finishing`,`invalid zip data`],k=function(e,t,n){var r=Error(t||qe[e]);if(r.code=e,Error.captureStackTrace&&Error.captureStackTrace(r,k),!n)throw r;return r},Je=function(e,t,n,r){var i=e.length,a=r?r.length:0;if(!i||t.f&&!t.l)return n||new E(0);var o=!n,s=o||t.i!=2,c=t.i;o&&(n=new E(i*3));var l=function(e){var t=n.length;if(e>t){var r=new E(Math.max(t*2,e));r.set(n),n=r}},u=t.f||0,d=t.p||0,f=t.b||0,p=t.l,m=t.d,h=t.m,g=t.n,_=i*8;do{if(!p){u=O(e,d,1);var v=O(e,d+1,3);if(d+=3,!v){var y=Ge(d)+4,b=e[y-4]|e[y-3]<<8,x=y+b;if(x>i){c&&k(0);break}s&&l(f+b),n.set(e.subarray(y,x),f),t.b=f+=b,t.p=d=x*8,t.f=u;continue}if(v==1)p=Ve,m=He,h=9,g=5;else if(v==2){var ee=O(e,d,31)+257,te=O(e,d+10,15)+4,ne=ee+O(e,d+5,31)+1;d+=14;for(var S=new E(ne),C=new E(19),w=0;w<te;++w)C[ke[w]]=O(e,d+w*3,7);d+=te*3;for(var re=Ue(C),ie=(1<<re)-1,ae=Re(C,re,1),w=0;w<ne;){var oe=ae[O(e,d,ie)];d+=oe&15;var y=oe>>4;if(y<16)S[w++]=y;else{var se=0,ce=0;for(y==16?(ce=3+O(e,d,3),d+=2,se=S[w-1]):y==17?(ce=3+O(e,d,7),d+=3):y==18&&(ce=11+O(e,d,127),d+=7);ce--;)S[w++]=se}}var le=S.subarray(0,ee),T=S.subarray(ee);h=Ue(le),g=Ue(T),p=Re(le,h,1),m=Re(T,g,1)}else k(1);if(d>_){c&&k(0);break}}s&&l(f+131072);for(var ue=(1<<h)-1,de=(1<<g)-1,fe=d;;fe=d){var se=p[We(e,d)&ue],pe=se>>4;if(d+=se&15,d>_){c&&k(0);break}if(se||k(2),pe<256)n[f++]=pe;else if(pe==256){fe=d,p=null;break}else{var me=pe-254;if(pe>264){var w=pe-257,he=De[w];me=O(e,d,(1<<he)-1)+Me[w],d+=he}var ge=m[We(e,d)&de],_e=ge>>4;ge||k(3),d+=ge&15;var T=Fe[_e];if(_e>3){var he=Oe[_e];T+=We(e,d)&(1<<he)-1,d+=he}if(d>_){c&&k(0);break}s&&l(f+131072);var ve=f+me;if(f<T){var ye=a-T,be=Math.min(T,ve);for(ye+f<0&&k(3);f<be;++f)n[f]=r[ye+f]}for(;f<ve;++f)n[f]=n[f-T]}}t.l=p,t.p=fe,t.b=f,t.f=u,p&&(u=1,t.m=h,t.d=m,t.n=g)}while(!u);return f!=n.length&&o?Ke(n,0,f):n.subarray(0,f)},Ye=new E(0),A=function(e,t){return e[t]|e[t+1]<<8},j=function(e,t){return(e[t]|e[t+1]<<8|e[t+2]<<16|e[t+3]<<24)>>>0},Xe=function(e,t){return j(e,t)+j(e,t+4)*4294967296},Ze=function(e){(e[0]!=31||e[1]!=139||e[2]!=8)&&k(6,`invalid gzip data`);var t=e[3],n=10;t&4&&(n+=(e[10]|e[11]<<8)+2);for(var r=(t>>3&1)+(t>>4&1);r>0;r-=!e[n++]);return n+(t&2)},Qe=function(){function e(e,t){typeof e==`function`&&(t=e,e={}),this.ondata=t;var n=e&&e.dictionary&&e.dictionary.subarray(-32768);this.s={i:0,b:n?n.length:0},this.o=new E(32768),this.p=new E(0),n&&this.o.set(n)}return e.prototype.e=function(e){if(this.ondata||k(5),this.d&&k(4),!this.p.length)this.p=e;else if(e.length){var t=new E(this.p.length+e.length);t.set(this.p),t.set(e,this.p.length),this.p=t}},e.prototype.c=function(e){this.s.i=+(this.d=e||!1);var t=this.s.b,n=Je(this.p,this.s,this.o);this.ondata(Ke(n,t,this.s.b),this.d),this.o=Ke(n,this.s.b-32768),this.s.b=this.o.length,this.p=Ke(this.p,this.s.p/8|0),this.s.p&=7},e.prototype.push=function(e,t){this.e(e),this.c(t)},e}();function $e(e,t){return Je(e,{i:2},t&&t.out,t&&t.dictionary)}var et=function(){function e(e,t){this.v=1,this.r=0,Qe.call(this,e,t)}return e.prototype.push=function(e,t){if(Qe.prototype.e.call(this,e),this.r+=e.length,this.v){var n=this.p.subarray(this.v-1),r=n.length>3?Ze(n):4;if(r>n.length){if(!t)return}else this.v>1&&this.onmember&&this.onmember(this.r-n.length);this.p=n.subarray(r),this.v=0}Qe.prototype.c.call(this,t),this.s.f&&!this.s.l&&!t&&(this.v=Ge(this.s.p)+9,this.s={i:0},this.o=new E(0),this.push(new E(0),t))},e}(),tt=typeof TextDecoder<`u`&&new TextDecoder;try{tt.decode(Ye,{stream:!0})}catch{}var nt=function(e){for(var t=``,n=0;;){var r=e[n++],i=(r>127)+(r>223)+(r>239);if(n+i>e.length)return{s:t,r:Ke(e,n-1)};i?i==3?(r=((r&15)<<18|(e[n++]&63)<<12|(e[n++]&63)<<6|e[n++]&63)-65536,t+=String.fromCharCode(55296|r>>10,56320|r&1023)):i&1?t+=String.fromCharCode((r&31)<<6|e[n++]&63):t+=String.fromCharCode((r&15)<<12|(e[n++]&63)<<6|e[n++]&63):t+=String.fromCharCode(r)}};function rt(e,t){if(t){for(var n=``,r=0;r<e.length;r+=16384)n+=String.fromCharCode.apply(null,e.subarray(r,r+16384));return n}if(tt)return tt.decode(e);var i=nt(e),a=i.s,n=i.r;return n.length&&k(8),a}var it=function(e,t){return t+30+A(e,t+26)+A(e,t+28)},at=function(e,t,n){var r=A(e,t+28),i=rt(e.subarray(t+46,t+46+r),!(A(e,t+8)&2048)),a=t+46+r,o=j(e,t+20),s=n&&o==4294967295?ot(e,a):[o,j(e,t+24),j(e,t+42)],c=s[0],l=s[1],u=s[2];return[A(e,t+10),c,l,i,a+A(e,t+30)+A(e,t+32),u]},ot=function(e,t){for(;A(e,t)!=1;t+=4+A(e,t+2));return[Xe(e,t+12),Xe(e,t+4),Xe(e,t+20)]};function st(e,t){for(var n={},r=e.length-22;j(e,r)!=101010256;--r)(!r||e.length-r>65558)&&k(13);var i=A(e,r+8);if(!i)return{};var a=j(e,r+16),o=a==4294967295||i==65535;if(o){var s=j(e,r-12);o=j(e,s)==101075792,o&&(i=j(e,s+32),a=j(e,s+48))}for(var c=t&&t.filter,l=0;l<i;++l){var u=at(e,a,o),d=u[0],f=u[1],p=u[2],m=u[3],h=u[4],g=u[5],_=it(e,g);a=h,(!c||c({name:m,size:f,originalSize:p,compression:d}))&&(d?d==8?n[m]=$e(e.subarray(_,_+f),{out:new E(p)}):k(14,`unknown compression type `+d):n[m]=Ke(e,_,_+f))}return n}var ct=Math.exp(-30),M=2048,N=2048,P=function(e){return e.PLY=`ply`,e.SPZ=`spz`,e.SPLAT=`splat`,e.KSPLAT=`ksplat`,e.PCSOGS=`pcsogs`,e.PCSOGSZIP=`pcsogszip`,e.RAD=`rad`,e}({}),lt={rgbMin:0,rgbMax:1,lnScaleMin:-12,lnScaleMax:9,sh1Max:1,sh2Max:1,sh3Max:1,lodOpacity:!1};function ut(e){return e===`int`||e===`ivec2`||e===`ivec3`||e===`ivec4`}function dt(e){return e===`uint`||e===`uvec2`||e===`uvec3`||e===`uvec4`}function ft(e){return e===`float`||e===`vec2`||e===`vec3`||e===`vec4`}function pt(e){return e===`mat2`||e===`mat2x2`||e===`mat2x3`||e===`mat2x4`||e===`mat3`||e===`mat3x2`||e===`mat3x3`||e===`mat3x4`||e===`mat4`||e===`mat4x2`||e===`mat4x3`||e===`mat4x4`}function mt(e){return ft(e)||pt(e)}function ht(e){return e===`mat2`||e===`mat2x2`}function gt(e){return e===`mat3`||e===`mat3x3`}function _t(e){return e===`mat4`||e===`mat4x4`}function F(e){return Math.trunc(e).toString()}function I(e){return`${Math.max(0,Math.trunc(e)).toString()}u`}function L(e){return e===1/0?`INFINITY`:e===-1/0?`-INFINITY`:Number.isInteger(e)?e.toFixed(1):e.toString()}function vt(e){return e instanceof yt?e.type:e.dynoOut().type}var yt=class{constructor(e){this.__isDynoValue=!0,this.type=e}},R=class extends yt{constructor(e,t){super(e.outTypes[t]),this.dyno=e,this.key=t}},bt=class extends yt{constructor(e,t){super(e),this.literal=t}getLiteral(){return this.literal}},xt=class extends bt{constructor(e,t){super(e,``),this.value=t}getLiteral(){let{type:e,value:t}=this;switch(e){case`bool`:return t?`true`:`false`;case`uint`:return I(t);case`int`:return F(t);case`float`:return L(t);case`bvec2`:{let e=t;return`bvec2(${e[0]}, ${e[1]})`}case`uvec2`:{if(t instanceof x)return`uvec2(${I(t.x)}, ${I(t.y)})`;let e=t;return`uvec2(${I(e[0])}, ${I(e[1])})`}case`ivec2`:{if(t instanceof x)return`ivec2(${F(t.x)}, ${F(t.y)})`;let e=t;return`ivec2(${F(e[0])}, ${F(e[1])})`}case`vec2`:{if(t instanceof x)return`vec2(${L(t.x)}, ${L(t.y)})`;let e=t;return`vec2(${L(e[0])}, ${L(e[1])})`}case`bvec3`:{let e=t;return`bvec3(${e[0]}, ${e[1]}, ${e[2]})`}case`uvec3`:{if(t instanceof o)return`uvec3(${I(t.x)}, ${I(t.y)}, ${I(t.z)})`;let e=t;return`uvec3(${I(e[0])}, ${I(e[1])}, ${I(e[2])})`}case`ivec3`:{if(t instanceof o)return`ivec3(${F(t.x)}, ${F(t.y)}, ${F(t.z)})`;let e=t;return`ivec3(${F(e[0])}, ${F(e[1])}, ${F(e[2])})`}case`vec3`:{if(t instanceof o)return`vec3(${L(t.x)}, ${L(t.y)}, ${L(t.z)})`;let e=t;return`vec3(${L(e[0])}, ${L(e[1])}, ${L(e[2])})`}case`bvec4`:{let e=t;return`bvec4(${e[0]}, ${e[1]}, ${e[2]}, ${e[3]})`}case`uvec4`:{if(t instanceof u)return`uvec4(${I(t.x)}, ${I(t.y)}, ${I(t.z)}, ${I(t.w)})`;let e=t;return`uvec4(${I(e[0])}, ${I(e[1])}, ${I(e[2])}, ${I(e[3])})`}case`ivec4`:{if(t instanceof u)return`ivec4(${F(t.x)}, ${F(t.y)}, ${F(t.z)}, ${F(t.w)})`;let e=t;return`ivec4(${F(e[0])}, ${F(e[1])}, ${F(e[2])}, ${F(e[3])})`}case`vec4`:{if(t instanceof u||t instanceof f)return`vec4(${L(t.x)}, ${L(t.y)}, ${L(t.z)}, ${L(t.w)})`;let e=t;return`vec4(${L(e[0])}, ${L(e[1])}, ${L(e[2])}, ${L(e[3])})`}case`mat2`:case`mat2x2`:{let r=t,i=r instanceof n?r.elements:t;return`${e}(${[,,,,].fill(0).map((e,t)=>L(i[t])).join(`, `)})`}case`mat2x3`:{let n=t;return`${e}(${[,,,,,,].fill(0).map((e,t)=>L(n[t])).join(`, `)})`}case`mat2x4`:{let n=t;return`${e}(${Array(8).fill(0).map((e,t)=>L(n[t])).join(`, `)})`}case`mat3`:case`mat3x3`:{let n=t,r=n instanceof ve?n.elements:t;return`${e}(${Array(9).fill(0).map((e,t)=>L(r[t])).join(`, `)})`}case`mat3x2`:{let n=t;return`${e}(${[,,,,,,].fill(0).map((e,t)=>L(n[t])).join(`, `)})`}case`mat3x4`:{let n=t;return`${e}(${Array(12).fill(0).map((e,t)=>L(n[t])).join(`, `)})`}case`mat4`:case`mat4x4`:{let n=t,r=n instanceof v?n.elements:t;return`${e}(${Array(16).fill(0).map((e,t)=>L(r[t])).join(`, `)})`}case`mat4x2`:{let n=t;return`${e}(${Array(8).fill(0).map((e,t)=>L(n[t])).join(`, `)})`}case`mat4x3`:{let n=t;return`${e}(${Array(12).fill(0).map((e,t)=>L(n[t])).join(`, `)})`}default:throw Error(`Type not implemented: ${String(e)}`)}}};function St(e,t){return new xt(e,t)}var Ct=` `,wt=class{constructor({indent:e}={}){this.globals=new Set,this.statements=[],this.uniforms={},this.declares=new Set,this.updaters=[],this.sequence=0,this.indent=Ct,this.indent=e??Ct}nextSequence(){return this.sequence++}},z=class{constructor({inTypes:e,outTypes:t,inputs:n,update:r,globals:i,statements:a,generate:o}){this.inTypes=e??{},this.outTypes=t??{},this.inputs=n??{},this.update=r,this.globals=i,this.statements=a,this.generate=o??(({inputs:e,outputs:t,compile:n})=>({globals:this.globals?.({inputs:e,outputs:t,compile:n}),statements:this.statements?.({inputs:e,outputs:t,compile:n})}))}get outputs(){let e={};for(let t in this.outTypes)e[t]=new R(this,t);return e}apply(e){return Object.assign(this.inputs,e),this.outputs}compile({inputs:e,outputs:t,compile:n}){let r=[`// ${this.constructor.name}(${Object.values(e).join(`, `)}) => (${Object.values(t).join(`, `)})`],i=[];for(let e in t){let r=t[e];r&&!n.declares.has(r)&&(n.declares.add(r),i.push(e))}let{globals:a,statements:o,uniforms:s}=this.generate({inputs:e,outputs:t,compile:n});for(let e of a??[])n.globals.add(e);for(let e in s)n.uniforms[e]=s[e];this.update&&n.updaters.push(this.update);for(let e of i){let i=t[e];i&&(n.uniforms[i]||r.push(`${Dt(i,this.outTypes[e])};`))}return o?.length&&(r.push(`{`),r.push(...o.map(e=>n.indent+e)),r.push(`}`)),r}},Tt=class extends z{constructor({inTypes:e,outTypes:t,inputs:n,update:r,globals:i,construct:a}){super({inTypes:e,outTypes:t,inputs:n,update:r,globals:i,generate:e=>this.generateBlock(e)}),this.construct=a}generateBlock({inputs:e,outputs:t,compile:n}){let r={},i={};for(let t in e)e[t]!=null&&(r[t]=new bt(this.inTypes[t],e[t]));for(let e in t)t[e]!=null&&(i[e]=new yt(this.outTypes[e]));let a={roots:[]},o=this.construct(r,i,a);for(let r of this.globals?.({inputs:e,outputs:t,compile:n})??[])n.globals.add(r);let s=[],c=new Map;function l(e,t,r){let i=c.get(e);if(!i){i={sequence:n.nextSequence(),outNames:new Map,newOuts:new Set},c.set(e,i);for(let t in e.inputs){let n=e.inputs[t];for(;n;){if(n instanceof yt){n instanceof R&&l(n.dyno,n.key);break}if(typeof n.dynoOut!=`function`)throw Error(`dynoOut is not a function for ${n.constructor.name}`);n=n.dynoOut()}}s.push(e)}t&&(r||i.newOuts.add(t),i.outNames.set(t,r??`${t}_${i.sequence}`))}for(let e of a.roots)l(e);for(let e in i){let n=o?.[e]??i[e];for(;n;){if(n instanceof yt){n instanceof R&&l(n.dyno,n.key,t[e]);break}n=n.dynoOut()}i[e]=n}let u=[];for(let e of s){let t={},r={};for(let n in e.inputs){let r=e.inputs[n];for(;r;){if(r instanceof yt){if(r instanceof bt)t[n]=r.getLiteral();else if(r instanceof R){let e=c.get(r.dyno)?.outNames.get(r.key);if(!e)throw Error(`Source not found for ${r.dyno.constructor.name}.${r.key}`);t[n]=e}break}r=r.dynoOut()}}let i=c.get(e)??{outNames:new Map};for(let[e,t]of i.outNames.entries())r[e]=t;let a=e.compile({inputs:t,outputs:r,compile:n});u.push(a)}let d=[];for(let e in t)i[e]instanceof bt&&d.push(`${t[e]} = ${i[e].getLiteral()};`);return d.length>0&&u.push(d),{statements:u.flatMap((e,t)=>t===0?e:[``,...e])}}};function B(e,t,n,{update:r,globals:i}={}){return new Tt({inTypes:e,outTypes:t,construct:n,update:r,globals:i})}function Et({inTypes:e,outTypes:t,inputs:n,update:r,globals:i,statements:a,generate:o}){return new z({inTypes:e,outTypes:t,inputs:n,update:r,globals:i,statements:a,generate:o})}function Dt(e,t,n){let r=typeof t==`string`?t:t.type;if(!r)throw Error(`Invalid DynoType: ${String(t)}`);return`${r} ${e}${n==null?``:`[${n}]`}`}function V(e){let t=!1,n=e.split(`
2
  `).map(e=>{let n=e.trimEnd();return t?n:n.length>0?(t=!0,n):null}).filter(e=>e!=null);for(;n.length>0&&n[n.length-1].length===0;)n.pop();if(n.length===0)return[];let r=n[0].match(/^\s*/)?.[0];if(!r)return n;let i=RegExp(`^${r}`);return n.map(e=>e.replace(i,``))}function H(e){return V(e).join(`
3
  `)}var Ot=class extends z{constructor({a:e,outKey:t,outTypeFunc:n}){let r={a:vt(e)},i=n(vt(e));super({inTypes:r,outTypes:{[t]:i},inputs:{a:e}}),this.outKey=t}dynoOut(){return new R(this,this.outKey)}},kt=class extends z{constructor({a:e,b:t,outKey:n,outTypeFunc:r}){let i={a:vt(e),b:vt(t)},a=r(vt(e),vt(t));super({inTypes:i,outTypes:{[n]:a},inputs:{a:e,b:t}}),this.outKey=n}dynoOut(){return new R(this,this.outKey)}},At=Number.parseInt(`187`)>=179,jt=new Float32Array(1),Mt=new Uint32Array(jt.buffer),Nt=`Float16Array`in globalThis,Pt=Nt?new globalThis.Float16Array(1):null,Ft=new Uint16Array(Pt?.buffer);function It(e){return jt[0]=e,Mt[0]}function Lt(e){return Mt[0]=e,jt[0]}var U=Nt?Rt:zt,W=Nt?Bt:Vt;function Rt(e){return Pt[0]=e,Ft[0]}function zt(e){jt[0]=e;let t=Mt[0],n=t>>31&1,r=t>>23&255,i=t&8388607,a=n<<15;if(r===255)return i===0?a|31744:a|32767;let o=r-127+15;if(o>=31)return a|31744;if(o<=0)return o<-10?a:a|(i|8388608)>>1-o+13;let s=i>>13;return a|o<<10|s}function Bt(e){return Ft[0]=e,Pt[0]}function Vt(e){let t=e>>15&1,n=e>>10&31,r=e&1023,i;if(n===0){if(r===0)i=t<<31;else{let e=r,n=-14;for(;!(e&1024);)e<<=1,n--;e&=1023;let a=n+127,o=e<<13;i=t<<31|a<<23|o}}else if(n===31)i=r===0?t<<31|2139095040:t<<31|2143289344;else{let e=n-15+127,a=r<<13;i=t<<31|e<<23|a}return Mt[0]=i,jt[0]}function Ht(e){return Math.max(0,Math.min(255,Math.round(e*255)))}function Ut(e){let t=[],n=new Set;function r(e){e&&typeof e==`object`&&!n.has(e)&&(n.add(e),e instanceof ArrayBuffer?t.push(e):ArrayBuffer.isView(e)?t.push(e.buffer):Array.isArray(e)?e.forEach(r):Object.values(e).forEach(r))}return r(e),t}function Wt(e,t){return Array(e).fill(null).map((e,n)=>t(n))}function Gt(e,t){let n=0;for(let r of e)t(r)||(e[n++]=r);e.length=n}function Kt(e,t,n,r,i,a,o,s,c,l,u,d,f,p,m,h){let g=t*4,[_,v]=e;_[g]=It(n),_[g+1]=It(r),_[g+2]=It(i),_[g+3]=U(f),v[g]=U(p)|U(m)<<16,v[g+1]=U(h)|U(Math.log(a))<<16,v[g+2]=U(Math.log(o))|U(Math.log(s))<<16,v[g+3]=ln(c,l,u,d)}function qt(e,t){let n=Xt,r=t*4,[i,a]=e;return n.center.x=Lt(i[r]),n.center.y=Lt(i[r+1]),n.center.z=Lt(i[r+2]),n.opacity=W(i[r+3]&65535),n.color.r=W(a[r]&65535),n.color.g=W(a[r]>>>16),n.color.b=W(a[r+1]&65535),n.scales.x=Math.exp(W(a[r+1]>>>16)),n.scales.y=Math.exp(W(a[r+2]&65535)),n.scales.z=Math.exp(W(a[r+2]>>>16)),un(a[r+3],n.quaternion),n}function Jt(e,t,n,r,i,a,o,s,c,l,u,d,f,p,m,h,g){let _=g?.rgbMin??0,v=(g?.rgbMax??1)-_,y=Ht((p-_)/v),b=Ht((m-_)/v),x=Ht((h-_)/v),ee=Ht(g?.lodOpacity?.5*f:f),te=sn(Yt.set(c,l,u,d)),ne=te&255,S=te>>>8&255,C=te>>>16&255,w=g?.lnScaleMin??-12,re=254/((g?.lnScaleMax??9)-w),ie=a<ct?0:Math.min(255,Math.max(1,Math.round((Math.log(a)-w)*re)+1)),ae=o<ct?0:Math.min(255,Math.max(1,Math.round((Math.log(o)-w)*re)+1)),oe=s<ct?0:Math.min(255,Math.max(1,Math.round((Math.log(s)-w)*re)+1)),se=U(n),ce=U(r),le=U(i),T=t*4;e[T]=y|b<<8|x<<16|ee<<24,e[T+1]=se|ce<<16,e[T+2]=le|ne<<16|S<<24,e[T+3]=ie|ae<<8|oe<<16|C<<24}var Yt=new f,Xt={center:new o,scales:new o,quaternion:new f,color:new S,opacity:0};function Zt(e,t,n){let r=Xt,i=t*4,a=e[i],o=e[i+1],s=e[i+2],c=e[i+3],l=n?.rgbMin??0,u=(n?.rgbMax??1)-l;r.color.set(l+(a&255)/255*u,l+(a>>>8&255)/255*u,l+(a>>>16&255)/255*u),r.opacity=(a>>>24&255)/255,n?.lodOpacity&&(r.opacity=2*r.opacity),r.center.set(W(o&65535),W(o>>>16&65535),W(s&65535));let d=n?.lnScaleMin??-12,f=((n?.lnScaleMax??9)-d)/254,p=c&255;r.scales.x=p===0?0:Math.exp(d+(p-1)*f);let m=c>>>8&255;r.scales.y=m===0?0:Math.exp(d+(m-1)*f);let h=c>>>16&255;return r.scales.z=h===0?0:Math.exp(d+(h-1)*f),cn(s>>>16&65535|c>>>8&16711680,r.quaternion),r}function G(e){let t=M,n=Math.max(1,Math.min(N,Math.ceil(e/t))),r=Math.ceil(e/(t*n));return{width:t,height:n,depth:r,maxSplats:t*n*r}}function Qt(){return navigator.platform.toLowerCase().startsWith(`win`)?!1:navigator.maxTouchPoints>0||/Mobi|Android|iPhone|iPad|iPod|Opera Mini|IEMobile/.test(navigator.userAgent)}function $t(){return/Android/.test(navigator.userAgent)||/Tizen/.test(navigator.userAgent)}function en(){return!!navigator.xr&&/Oculus/.test(navigator.userAgent)}function tn(){return/iPhone|iPad/.test(navigator.userAgent)}function nn(){return!!navigator.xr&&tn()&&/Safari/.test(navigator.userAgent)&&Qt()}var rn=H(`
4
  precision highp float;
 
1
+ import{A as e,B as t,C as n,D as r,E as i,F as a,G as o,H as s,I as c,J as l,K as u,L as d,M as f,N as p,O as m,P as h,R as g,S as _,T as v,U as y,V as b,W as x,_ as ee,a as te,b as ne,c as S,d as C,f as w,g as re,h as ie,i as ae,j as oe,k as se,l as ce,m as le,n as T,o as ue,p as de,q as fe,r as pe,s as me,t as he,u as ge,v as _e,w as ve,x as ye,y as be,z as xe}from"./index-ChiBGwOm.js";var Se=new e(-1,1,1,-1,0,1),Ce=new class extends ue{constructor(){super(),this.setAttribute(`position`,new ie([-1,3,0,-1,-1,0,3,-1,0],3)),this.setAttribute(`uv`,new ie([0,2,0,0,2,0],2))}},we=class{constructor(e){this._mesh=new i(Ce,e)}dispose(){this._mesh.geometry.dispose()}render(e){e.render(this._mesh,Se)}get material(){return this._mesh.material}set material(e){this._mesh.material=e}},E=Uint8Array,Te=Uint16Array,Ee=Int32Array,De=new E([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),Oe=new E([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),ke=new E([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Ae=function(e,t){for(var n=new Te(31),r=0;r<31;++r)n[r]=t+=1<<e[r-1];for(var i=new Ee(n[30]),r=1;r<30;++r)for(var a=n[r];a<n[r+1];++a)i[a]=a-n[r]<<5|r;return{b:n,r:i}},je=Ae(De,2),Me=je.b,Ne=je.r;Me[28]=258,Ne[258]=28;var Pe=Ae(Oe,0),Fe=Pe.b;Pe.r;for(var Ie=new Te(32768),D=0;D<32768;++D){var Le=(D&43690)>>1|(D&21845)<<1;Le=(Le&52428)>>2|(Le&13107)<<2,Le=(Le&61680)>>4|(Le&3855)<<4,Ie[D]=((Le&65280)>>8|(Le&255)<<8)>>1}for(var Re=(function(e,t,n){for(var r=e.length,i=0,a=new Te(t);i<r;++i)e[i]&&++a[e[i]-1];var o=new Te(t);for(i=1;i<t;++i)o[i]=o[i-1]+a[i-1]<<1;var s;if(n){s=new Te(1<<t);var c=15-t;for(i=0;i<r;++i)if(e[i])for(var l=i<<4|e[i],u=t-e[i],d=o[e[i]-1]++<<u,f=d|(1<<u)-1;d<=f;++d)s[Ie[d]>>c]=l}else for(s=new Te(r),i=0;i<r;++i)e[i]&&(s[i]=Ie[o[e[i]-1]++]>>15-e[i]);return s}),ze=new E(288),D=0;D<144;++D)ze[D]=8;for(var D=144;D<256;++D)ze[D]=9;for(var D=256;D<280;++D)ze[D]=7;for(var D=280;D<288;++D)ze[D]=8;for(var Be=new E(32),D=0;D<32;++D)Be[D]=5;var Ve=Re(ze,9,1),He=Re(Be,5,1),Ue=function(e){for(var t=e[0],n=1;n<e.length;++n)e[n]>t&&(t=e[n]);return t},O=function(e,t,n){var r=t/8|0;return(e[r]|e[r+1]<<8)>>(t&7)&n},We=function(e,t){var n=t/8|0;return(e[n]|e[n+1]<<8|e[n+2]<<16)>>(t&7)},Ge=function(e){return(e+7)/8|0},Ke=function(e,t,n){return(t==null||t<0)&&(t=0),(n==null||n>e.length)&&(n=e.length),new E(e.subarray(t,n))},qe=[`unexpected EOF`,`invalid block type`,`invalid length/literal`,`invalid distance`,`stream finished`,`no stream handler`,,`no callback`,`invalid UTF-8 data`,`extra field too long`,`date not in range 1980-2099`,`filename too long`,`stream finishing`,`invalid zip data`],k=function(e,t,n){var r=Error(t||qe[e]);if(r.code=e,Error.captureStackTrace&&Error.captureStackTrace(r,k),!n)throw r;return r},Je=function(e,t,n,r){var i=e.length,a=r?r.length:0;if(!i||t.f&&!t.l)return n||new E(0);var o=!n,s=o||t.i!=2,c=t.i;o&&(n=new E(i*3));var l=function(e){var t=n.length;if(e>t){var r=new E(Math.max(t*2,e));r.set(n),n=r}},u=t.f||0,d=t.p||0,f=t.b||0,p=t.l,m=t.d,h=t.m,g=t.n,_=i*8;do{if(!p){u=O(e,d,1);var v=O(e,d+1,3);if(d+=3,!v){var y=Ge(d)+4,b=e[y-4]|e[y-3]<<8,x=y+b;if(x>i){c&&k(0);break}s&&l(f+b),n.set(e.subarray(y,x),f),t.b=f+=b,t.p=d=x*8,t.f=u;continue}if(v==1)p=Ve,m=He,h=9,g=5;else if(v==2){var ee=O(e,d,31)+257,te=O(e,d+10,15)+4,ne=ee+O(e,d+5,31)+1;d+=14;for(var S=new E(ne),C=new E(19),w=0;w<te;++w)C[ke[w]]=O(e,d+w*3,7);d+=te*3;for(var re=Ue(C),ie=(1<<re)-1,ae=Re(C,re,1),w=0;w<ne;){var oe=ae[O(e,d,ie)];d+=oe&15;var y=oe>>4;if(y<16)S[w++]=y;else{var se=0,ce=0;for(y==16?(ce=3+O(e,d,3),d+=2,se=S[w-1]):y==17?(ce=3+O(e,d,7),d+=3):y==18&&(ce=11+O(e,d,127),d+=7);ce--;)S[w++]=se}}var le=S.subarray(0,ee),T=S.subarray(ee);h=Ue(le),g=Ue(T),p=Re(le,h,1),m=Re(T,g,1)}else k(1);if(d>_){c&&k(0);break}}s&&l(f+131072);for(var ue=(1<<h)-1,de=(1<<g)-1,fe=d;;fe=d){var se=p[We(e,d)&ue],pe=se>>4;if(d+=se&15,d>_){c&&k(0);break}if(se||k(2),pe<256)n[f++]=pe;else if(pe==256){fe=d,p=null;break}else{var me=pe-254;if(pe>264){var w=pe-257,he=De[w];me=O(e,d,(1<<he)-1)+Me[w],d+=he}var ge=m[We(e,d)&de],_e=ge>>4;ge||k(3),d+=ge&15;var T=Fe[_e];if(_e>3){var he=Oe[_e];T+=We(e,d)&(1<<he)-1,d+=he}if(d>_){c&&k(0);break}s&&l(f+131072);var ve=f+me;if(f<T){var ye=a-T,be=Math.min(T,ve);for(ye+f<0&&k(3);f<be;++f)n[f]=r[ye+f]}for(;f<ve;++f)n[f]=n[f-T]}}t.l=p,t.p=fe,t.b=f,t.f=u,p&&(u=1,t.m=h,t.d=m,t.n=g)}while(!u);return f!=n.length&&o?Ke(n,0,f):n.subarray(0,f)},Ye=new E(0),A=function(e,t){return e[t]|e[t+1]<<8},j=function(e,t){return(e[t]|e[t+1]<<8|e[t+2]<<16|e[t+3]<<24)>>>0},Xe=function(e,t){return j(e,t)+j(e,t+4)*4294967296},Ze=function(e){(e[0]!=31||e[1]!=139||e[2]!=8)&&k(6,`invalid gzip data`);var t=e[3],n=10;t&4&&(n+=(e[10]|e[11]<<8)+2);for(var r=(t>>3&1)+(t>>4&1);r>0;r-=!e[n++]);return n+(t&2)},Qe=function(){function e(e,t){typeof e==`function`&&(t=e,e={}),this.ondata=t;var n=e&&e.dictionary&&e.dictionary.subarray(-32768);this.s={i:0,b:n?n.length:0},this.o=new E(32768),this.p=new E(0),n&&this.o.set(n)}return e.prototype.e=function(e){if(this.ondata||k(5),this.d&&k(4),!this.p.length)this.p=e;else if(e.length){var t=new E(this.p.length+e.length);t.set(this.p),t.set(e,this.p.length),this.p=t}},e.prototype.c=function(e){this.s.i=+(this.d=e||!1);var t=this.s.b,n=Je(this.p,this.s,this.o);this.ondata(Ke(n,t,this.s.b),this.d),this.o=Ke(n,this.s.b-32768),this.s.b=this.o.length,this.p=Ke(this.p,this.s.p/8|0),this.s.p&=7},e.prototype.push=function(e,t){this.e(e),this.c(t)},e}();function $e(e,t){return Je(e,{i:2},t&&t.out,t&&t.dictionary)}var et=function(){function e(e,t){this.v=1,this.r=0,Qe.call(this,e,t)}return e.prototype.push=function(e,t){if(Qe.prototype.e.call(this,e),this.r+=e.length,this.v){var n=this.p.subarray(this.v-1),r=n.length>3?Ze(n):4;if(r>n.length){if(!t)return}else this.v>1&&this.onmember&&this.onmember(this.r-n.length);this.p=n.subarray(r),this.v=0}Qe.prototype.c.call(this,t),this.s.f&&!this.s.l&&!t&&(this.v=Ge(this.s.p)+9,this.s={i:0},this.o=new E(0),this.push(new E(0),t))},e}(),tt=typeof TextDecoder<`u`&&new TextDecoder;try{tt.decode(Ye,{stream:!0})}catch{}var nt=function(e){for(var t=``,n=0;;){var r=e[n++],i=(r>127)+(r>223)+(r>239);if(n+i>e.length)return{s:t,r:Ke(e,n-1)};i?i==3?(r=((r&15)<<18|(e[n++]&63)<<12|(e[n++]&63)<<6|e[n++]&63)-65536,t+=String.fromCharCode(55296|r>>10,56320|r&1023)):i&1?t+=String.fromCharCode((r&31)<<6|e[n++]&63):t+=String.fromCharCode((r&15)<<12|(e[n++]&63)<<6|e[n++]&63):t+=String.fromCharCode(r)}};function rt(e,t){if(t){for(var n=``,r=0;r<e.length;r+=16384)n+=String.fromCharCode.apply(null,e.subarray(r,r+16384));return n}if(tt)return tt.decode(e);var i=nt(e),a=i.s,n=i.r;return n.length&&k(8),a}var it=function(e,t){return t+30+A(e,t+26)+A(e,t+28)},at=function(e,t,n){var r=A(e,t+28),i=rt(e.subarray(t+46,t+46+r),!(A(e,t+8)&2048)),a=t+46+r,o=j(e,t+20),s=n&&o==4294967295?ot(e,a):[o,j(e,t+24),j(e,t+42)],c=s[0],l=s[1],u=s[2];return[A(e,t+10),c,l,i,a+A(e,t+30)+A(e,t+32),u]},ot=function(e,t){for(;A(e,t)!=1;t+=4+A(e,t+2));return[Xe(e,t+12),Xe(e,t+4),Xe(e,t+20)]};function st(e,t){for(var n={},r=e.length-22;j(e,r)!=101010256;--r)(!r||e.length-r>65558)&&k(13);var i=A(e,r+8);if(!i)return{};var a=j(e,r+16),o=a==4294967295||i==65535;if(o){var s=j(e,r-12);o=j(e,s)==101075792,o&&(i=j(e,s+32),a=j(e,s+48))}for(var c=t&&t.filter,l=0;l<i;++l){var u=at(e,a,o),d=u[0],f=u[1],p=u[2],m=u[3],h=u[4],g=u[5],_=it(e,g);a=h,(!c||c({name:m,size:f,originalSize:p,compression:d}))&&(d?d==8?n[m]=$e(e.subarray(_,_+f),{out:new E(p)}):k(14,`unknown compression type `+d):n[m]=Ke(e,_,_+f))}return n}var ct=Math.exp(-30),M=2048,N=2048,P=function(e){return e.PLY=`ply`,e.SPZ=`spz`,e.SPLAT=`splat`,e.KSPLAT=`ksplat`,e.PCSOGS=`pcsogs`,e.PCSOGSZIP=`pcsogszip`,e.RAD=`rad`,e}({}),lt={rgbMin:0,rgbMax:1,lnScaleMin:-12,lnScaleMax:9,sh1Max:1,sh2Max:1,sh3Max:1,lodOpacity:!1};function ut(e){return e===`int`||e===`ivec2`||e===`ivec3`||e===`ivec4`}function dt(e){return e===`uint`||e===`uvec2`||e===`uvec3`||e===`uvec4`}function ft(e){return e===`float`||e===`vec2`||e===`vec3`||e===`vec4`}function pt(e){return e===`mat2`||e===`mat2x2`||e===`mat2x3`||e===`mat2x4`||e===`mat3`||e===`mat3x2`||e===`mat3x3`||e===`mat3x4`||e===`mat4`||e===`mat4x2`||e===`mat4x3`||e===`mat4x4`}function mt(e){return ft(e)||pt(e)}function ht(e){return e===`mat2`||e===`mat2x2`}function gt(e){return e===`mat3`||e===`mat3x3`}function _t(e){return e===`mat4`||e===`mat4x4`}function F(e){return Math.trunc(e).toString()}function I(e){return`${Math.max(0,Math.trunc(e)).toString()}u`}function L(e){return e===1/0?`INFINITY`:e===-1/0?`-INFINITY`:Number.isInteger(e)?e.toFixed(1):e.toString()}function vt(e){return e instanceof yt?e.type:e.dynoOut().type}var yt=class{constructor(e){this.__isDynoValue=!0,this.type=e}},R=class extends yt{constructor(e,t){super(e.outTypes[t]),this.dyno=e,this.key=t}},bt=class extends yt{constructor(e,t){super(e),this.literal=t}getLiteral(){return this.literal}},xt=class extends bt{constructor(e,t){super(e,``),this.value=t}getLiteral(){let{type:e,value:t}=this;switch(e){case`bool`:return t?`true`:`false`;case`uint`:return I(t);case`int`:return F(t);case`float`:return L(t);case`bvec2`:{let e=t;return`bvec2(${e[0]}, ${e[1]})`}case`uvec2`:{if(t instanceof x)return`uvec2(${I(t.x)}, ${I(t.y)})`;let e=t;return`uvec2(${I(e[0])}, ${I(e[1])})`}case`ivec2`:{if(t instanceof x)return`ivec2(${F(t.x)}, ${F(t.y)})`;let e=t;return`ivec2(${F(e[0])}, ${F(e[1])})`}case`vec2`:{if(t instanceof x)return`vec2(${L(t.x)}, ${L(t.y)})`;let e=t;return`vec2(${L(e[0])}, ${L(e[1])})`}case`bvec3`:{let e=t;return`bvec3(${e[0]}, ${e[1]}, ${e[2]})`}case`uvec3`:{if(t instanceof o)return`uvec3(${I(t.x)}, ${I(t.y)}, ${I(t.z)})`;let e=t;return`uvec3(${I(e[0])}, ${I(e[1])}, ${I(e[2])})`}case`ivec3`:{if(t instanceof o)return`ivec3(${F(t.x)}, ${F(t.y)}, ${F(t.z)})`;let e=t;return`ivec3(${F(e[0])}, ${F(e[1])}, ${F(e[2])})`}case`vec3`:{if(t instanceof o)return`vec3(${L(t.x)}, ${L(t.y)}, ${L(t.z)})`;let e=t;return`vec3(${L(e[0])}, ${L(e[1])}, ${L(e[2])})`}case`bvec4`:{let e=t;return`bvec4(${e[0]}, ${e[1]}, ${e[2]}, ${e[3]})`}case`uvec4`:{if(t instanceof u)return`uvec4(${I(t.x)}, ${I(t.y)}, ${I(t.z)}, ${I(t.w)})`;let e=t;return`uvec4(${I(e[0])}, ${I(e[1])}, ${I(e[2])}, ${I(e[3])})`}case`ivec4`:{if(t instanceof u)return`ivec4(${F(t.x)}, ${F(t.y)}, ${F(t.z)}, ${F(t.w)})`;let e=t;return`ivec4(${F(e[0])}, ${F(e[1])}, ${F(e[2])}, ${F(e[3])})`}case`vec4`:{if(t instanceof u||t instanceof f)return`vec4(${L(t.x)}, ${L(t.y)}, ${L(t.z)}, ${L(t.w)})`;let e=t;return`vec4(${L(e[0])}, ${L(e[1])}, ${L(e[2])}, ${L(e[3])})`}case`mat2`:case`mat2x2`:{let r=t,i=r instanceof n?r.elements:t;return`${e}(${[,,,,].fill(0).map((e,t)=>L(i[t])).join(`, `)})`}case`mat2x3`:{let n=t;return`${e}(${[,,,,,,].fill(0).map((e,t)=>L(n[t])).join(`, `)})`}case`mat2x4`:{let n=t;return`${e}(${Array(8).fill(0).map((e,t)=>L(n[t])).join(`, `)})`}case`mat3`:case`mat3x3`:{let n=t,r=n instanceof ve?n.elements:t;return`${e}(${Array(9).fill(0).map((e,t)=>L(r[t])).join(`, `)})`}case`mat3x2`:{let n=t;return`${e}(${[,,,,,,].fill(0).map((e,t)=>L(n[t])).join(`, `)})`}case`mat3x4`:{let n=t;return`${e}(${Array(12).fill(0).map((e,t)=>L(n[t])).join(`, `)})`}case`mat4`:case`mat4x4`:{let n=t,r=n instanceof v?n.elements:t;return`${e}(${Array(16).fill(0).map((e,t)=>L(r[t])).join(`, `)})`}case`mat4x2`:{let n=t;return`${e}(${Array(8).fill(0).map((e,t)=>L(n[t])).join(`, `)})`}case`mat4x3`:{let n=t;return`${e}(${Array(12).fill(0).map((e,t)=>L(n[t])).join(`, `)})`}default:throw Error(`Type not implemented: ${String(e)}`)}}};function St(e,t){return new xt(e,t)}var Ct=` `,wt=class{constructor({indent:e}={}){this.globals=new Set,this.statements=[],this.uniforms={},this.declares=new Set,this.updaters=[],this.sequence=0,this.indent=Ct,this.indent=e??Ct}nextSequence(){return this.sequence++}},z=class{constructor({inTypes:e,outTypes:t,inputs:n,update:r,globals:i,statements:a,generate:o}){this.inTypes=e??{},this.outTypes=t??{},this.inputs=n??{},this.update=r,this.globals=i,this.statements=a,this.generate=o??(({inputs:e,outputs:t,compile:n})=>({globals:this.globals?.({inputs:e,outputs:t,compile:n}),statements:this.statements?.({inputs:e,outputs:t,compile:n})}))}get outputs(){let e={};for(let t in this.outTypes)e[t]=new R(this,t);return e}apply(e){return Object.assign(this.inputs,e),this.outputs}compile({inputs:e,outputs:t,compile:n}){let r=[`// ${this.constructor.name}(${Object.values(e).join(`, `)}) => (${Object.values(t).join(`, `)})`],i=[];for(let e in t){let r=t[e];r&&!n.declares.has(r)&&(n.declares.add(r),i.push(e))}let{globals:a,statements:o,uniforms:s}=this.generate({inputs:e,outputs:t,compile:n});for(let e of a??[])n.globals.add(e);for(let e in s)n.uniforms[e]=s[e];this.update&&n.updaters.push(this.update);for(let e of i){let i=t[e];i&&(n.uniforms[i]||r.push(`${Dt(i,this.outTypes[e])};`))}return o?.length&&(r.push(`{`),r.push(...o.map(e=>n.indent+e)),r.push(`}`)),r}},Tt=class extends z{constructor({inTypes:e,outTypes:t,inputs:n,update:r,globals:i,construct:a}){super({inTypes:e,outTypes:t,inputs:n,update:r,globals:i,generate:e=>this.generateBlock(e)}),this.construct=a}generateBlock({inputs:e,outputs:t,compile:n}){let r={},i={};for(let t in e)e[t]!=null&&(r[t]=new bt(this.inTypes[t],e[t]));for(let e in t)t[e]!=null&&(i[e]=new yt(this.outTypes[e]));let a={roots:[]},o=this.construct(r,i,a);for(let r of this.globals?.({inputs:e,outputs:t,compile:n})??[])n.globals.add(r);let s=[],c=new Map;function l(e,t,r){let i=c.get(e);if(!i){i={sequence:n.nextSequence(),outNames:new Map,newOuts:new Set},c.set(e,i);for(let t in e.inputs){let n=e.inputs[t];for(;n;){if(n instanceof yt){n instanceof R&&l(n.dyno,n.key);break}if(typeof n.dynoOut!=`function`)throw Error(`dynoOut is not a function for ${n.constructor.name}`);n=n.dynoOut()}}s.push(e)}t&&(r||i.newOuts.add(t),i.outNames.set(t,r??`${t}_${i.sequence}`))}for(let e of a.roots)l(e);for(let e in i){let n=o?.[e]??i[e];for(;n;){if(n instanceof yt){n instanceof R&&l(n.dyno,n.key,t[e]);break}n=n.dynoOut()}i[e]=n}let u=[];for(let e of s){let t={},r={};for(let n in e.inputs){let r=e.inputs[n];for(;r;){if(r instanceof yt){if(r instanceof bt)t[n]=r.getLiteral();else if(r instanceof R){let e=c.get(r.dyno)?.outNames.get(r.key);if(!e)throw Error(`Source not found for ${r.dyno.constructor.name}.${r.key}`);t[n]=e}break}r=r.dynoOut()}}let i=c.get(e)??{outNames:new Map};for(let[e,t]of i.outNames.entries())r[e]=t;let a=e.compile({inputs:t,outputs:r,compile:n});u.push(a)}let d=[];for(let e in t)i[e]instanceof bt&&d.push(`${t[e]} = ${i[e].getLiteral()};`);return d.length>0&&u.push(d),{statements:u.flatMap((e,t)=>t===0?e:[``,...e])}}};function B(e,t,n,{update:r,globals:i}={}){return new Tt({inTypes:e,outTypes:t,construct:n,update:r,globals:i})}function Et({inTypes:e,outTypes:t,inputs:n,update:r,globals:i,statements:a,generate:o}){return new z({inTypes:e,outTypes:t,inputs:n,update:r,globals:i,statements:a,generate:o})}function Dt(e,t,n){let r=typeof t==`string`?t:t.type;if(!r)throw Error(`Invalid DynoType: ${String(t)}`);return`${r} ${e}${n==null?``:`[${n}]`}`}function V(e){let t=!1,n=e.split(`
2
  `).map(e=>{let n=e.trimEnd();return t?n:n.length>0?(t=!0,n):null}).filter(e=>e!=null);for(;n.length>0&&n[n.length-1].length===0;)n.pop();if(n.length===0)return[];let r=n[0].match(/^\s*/)?.[0];if(!r)return n;let i=RegExp(`^${r}`);return n.map(e=>e.replace(i,``))}function H(e){return V(e).join(`
3
  `)}var Ot=class extends z{constructor({a:e,outKey:t,outTypeFunc:n}){let r={a:vt(e)},i=n(vt(e));super({inTypes:r,outTypes:{[t]:i},inputs:{a:e}}),this.outKey=t}dynoOut(){return new R(this,this.outKey)}},kt=class extends z{constructor({a:e,b:t,outKey:n,outTypeFunc:r}){let i={a:vt(e),b:vt(t)},a=r(vt(e),vt(t));super({inTypes:i,outTypes:{[n]:a},inputs:{a:e,b:t}}),this.outKey=n}dynoOut(){return new R(this,this.outKey)}},At=Number.parseInt(`187`)>=179,jt=new Float32Array(1),Mt=new Uint32Array(jt.buffer),Nt=`Float16Array`in globalThis,Pt=Nt?new globalThis.Float16Array(1):null,Ft=new Uint16Array(Pt?.buffer);function It(e){return jt[0]=e,Mt[0]}function Lt(e){return Mt[0]=e,jt[0]}var U=Nt?Rt:zt,W=Nt?Bt:Vt;function Rt(e){return Pt[0]=e,Ft[0]}function zt(e){jt[0]=e;let t=Mt[0],n=t>>31&1,r=t>>23&255,i=t&8388607,a=n<<15;if(r===255)return i===0?a|31744:a|32767;let o=r-127+15;if(o>=31)return a|31744;if(o<=0)return o<-10?a:a|(i|8388608)>>1-o+13;let s=i>>13;return a|o<<10|s}function Bt(e){return Ft[0]=e,Pt[0]}function Vt(e){let t=e>>15&1,n=e>>10&31,r=e&1023,i;if(n===0){if(r===0)i=t<<31;else{let e=r,n=-14;for(;!(e&1024);)e<<=1,n--;e&=1023;let a=n+127,o=e<<13;i=t<<31|a<<23|o}}else if(n===31)i=r===0?t<<31|2139095040:t<<31|2143289344;else{let e=n-15+127,a=r<<13;i=t<<31|e<<23|a}return Mt[0]=i,jt[0]}function Ht(e){return Math.max(0,Math.min(255,Math.round(e*255)))}function Ut(e){let t=[],n=new Set;function r(e){e&&typeof e==`object`&&!n.has(e)&&(n.add(e),e instanceof ArrayBuffer?t.push(e):ArrayBuffer.isView(e)?t.push(e.buffer):Array.isArray(e)?e.forEach(r):Object.values(e).forEach(r))}return r(e),t}function Wt(e,t){return Array(e).fill(null).map((e,n)=>t(n))}function Gt(e,t){let n=0;for(let r of e)t(r)||(e[n++]=r);e.length=n}function Kt(e,t,n,r,i,a,o,s,c,l,u,d,f,p,m,h){let g=t*4,[_,v]=e;_[g]=It(n),_[g+1]=It(r),_[g+2]=It(i),_[g+3]=U(f),v[g]=U(p)|U(m)<<16,v[g+1]=U(h)|U(Math.log(a))<<16,v[g+2]=U(Math.log(o))|U(Math.log(s))<<16,v[g+3]=ln(c,l,u,d)}function qt(e,t){let n=Xt,r=t*4,[i,a]=e;return n.center.x=Lt(i[r]),n.center.y=Lt(i[r+1]),n.center.z=Lt(i[r+2]),n.opacity=W(i[r+3]&65535),n.color.r=W(a[r]&65535),n.color.g=W(a[r]>>>16),n.color.b=W(a[r+1]&65535),n.scales.x=Math.exp(W(a[r+1]>>>16)),n.scales.y=Math.exp(W(a[r+2]&65535)),n.scales.z=Math.exp(W(a[r+2]>>>16)),un(a[r+3],n.quaternion),n}function Jt(e,t,n,r,i,a,o,s,c,l,u,d,f,p,m,h,g){let _=g?.rgbMin??0,v=(g?.rgbMax??1)-_,y=Ht((p-_)/v),b=Ht((m-_)/v),x=Ht((h-_)/v),ee=Ht(g?.lodOpacity?.5*f:f),te=sn(Yt.set(c,l,u,d)),ne=te&255,S=te>>>8&255,C=te>>>16&255,w=g?.lnScaleMin??-12,re=254/((g?.lnScaleMax??9)-w),ie=a<ct?0:Math.min(255,Math.max(1,Math.round((Math.log(a)-w)*re)+1)),ae=o<ct?0:Math.min(255,Math.max(1,Math.round((Math.log(o)-w)*re)+1)),oe=s<ct?0:Math.min(255,Math.max(1,Math.round((Math.log(s)-w)*re)+1)),se=U(n),ce=U(r),le=U(i),T=t*4;e[T]=y|b<<8|x<<16|ee<<24,e[T+1]=se|ce<<16,e[T+2]=le|ne<<16|S<<24,e[T+3]=ie|ae<<8|oe<<16|C<<24}var Yt=new f,Xt={center:new o,scales:new o,quaternion:new f,color:new S,opacity:0};function Zt(e,t,n){let r=Xt,i=t*4,a=e[i],o=e[i+1],s=e[i+2],c=e[i+3],l=n?.rgbMin??0,u=(n?.rgbMax??1)-l;r.color.set(l+(a&255)/255*u,l+(a>>>8&255)/255*u,l+(a>>>16&255)/255*u),r.opacity=(a>>>24&255)/255,n?.lodOpacity&&(r.opacity=2*r.opacity),r.center.set(W(o&65535),W(o>>>16&65535),W(s&65535));let d=n?.lnScaleMin??-12,f=((n?.lnScaleMax??9)-d)/254,p=c&255;r.scales.x=p===0?0:Math.exp(d+(p-1)*f);let m=c>>>8&255;r.scales.y=m===0?0:Math.exp(d+(m-1)*f);let h=c>>>16&255;return r.scales.z=h===0?0:Math.exp(d+(h-1)*f),cn(s>>>16&65535|c>>>8&16711680,r.quaternion),r}function G(e){let t=M,n=Math.max(1,Math.min(N,Math.ceil(e/t))),r=Math.ceil(e/(t*n));return{width:t,height:n,depth:r,maxSplats:t*n*r}}function Qt(){return navigator.platform.toLowerCase().startsWith(`win`)?!1:navigator.maxTouchPoints>0||/Mobi|Android|iPhone|iPad|iPod|Opera Mini|IEMobile/.test(navigator.userAgent)}function $t(){return/Android/.test(navigator.userAgent)||/Tizen/.test(navigator.userAgent)}function en(){return!!navigator.xr&&/Oculus/.test(navigator.userAgent)}function tn(){return/iPhone|iPad/.test(navigator.userAgent)}function nn(){return!!navigator.xr&&tn()&&/Safari/.test(navigator.userAgent)&&Qt()}var rn=H(`
4
  precision highp float;
dist/index.html CHANGED
@@ -6,7 +6,7 @@
6
  <title>XLeRobot Sim</title>
7
  <link rel="icon" href="data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 64 64'%3E%3Crect width='64' height='64' rx='14' fill='%230071e3'/%3E%3Ctext x='32' y='42' font-size='28' font-weight='700' text-anchor='middle' fill='white' font-family='Arial'%3EXL%3C/text%3E%3C/svg%3E" />
8
  <meta name="description" content="XLeRobot in your browser: MuJoCo 4.0 physics, MuJoCo-GS-Web's robot and 3D Gaussian splat scenes, a kitchen, a learned policy and an LLM agent." />
9
- <script type="module" crossorigin src="./assets/index-BGZ4TK1u.js"></script>
10
  <link rel="stylesheet" crossorigin href="./assets/index-B0OqpDBS.css">
11
  </head>
12
  <body>
 
6
  <title>XLeRobot Sim</title>
7
  <link rel="icon" href="data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 64 64'%3E%3Crect width='64' height='64' rx='14' fill='%230071e3'/%3E%3Ctext x='32' y='42' font-size='28' font-weight='700' text-anchor='middle' fill='white' font-family='Arial'%3EXL%3C/text%3E%3C/svg%3E" />
8
  <meta name="description" content="XLeRobot in your browser: MuJoCo 4.0 physics, MuJoCo-GS-Web's robot and 3D Gaussian splat scenes, a kitchen, a learned policy and an LLM agent." />
9
+ <script type="module" crossorigin src="./assets/index-ChiBGwOm.js"></script>
10
  <link rel="stylesheet" crossorigin href="./assets/index-B0OqpDBS.css">
11
  </head>
12
  <body>
src/main.js CHANGED
@@ -166,6 +166,7 @@ function surfaceBelow(point, below = Infinity) {
166
  // Renderer, cameras, keys, sliders
167
 
168
  const styleButtons = [...document.querySelectorAll("[data-style]")];
 
169
  const pressStyle = (style) => {
170
  for (const b of styleButtons) b.setAttribute("aria-pressed", String(b.dataset.style === style));
171
  };
@@ -636,8 +637,10 @@ async function main() {
636
  objectInfo: (name) => objectInfo(app.sim, app.sim.id("body", name)),
637
  homeArms: () => app.skills.start("home", homeArm(app.robot, "left")),
638
  };
639
- // The saved renderer last: a 3DGS splat downloads while the scene already runs.
640
- await setStyle(store.get("style") ?? "lit");
 
 
641
  }
642
 
643
  main().catch(showError);
 
166
  // Renderer, cameras, keys, sliders
167
 
168
  const styleButtons = [...document.querySelectorAll("[data-style]")];
169
+ const STYLES = styleButtons.map((b) => b.dataset.style);
170
  const pressStyle = (style) => {
171
  for (const b of styleButtons) b.setAttribute("aria-pressed", String(b.dataset.style === style));
172
  };
 
637
  objectInfo: (name) => objectInfo(app.sim, app.sim.id("body", name)),
638
  homeArms: () => app.skills.start("home", homeArm(app.robot, "left")),
639
  };
640
+ // The renderer last: a 3DGS splat downloads while the scene already runs. A page that embeds this one
641
+ // names the renderer in the URL (?env=tabletop&style=pixel); otherwise the saved one.
642
+ const asked = new URL(location.href).searchParams.get("style");
643
+ await setStyle(STYLES.includes(asked) ? asked : (store.get("style") ?? "lit"));
644
  }
645
 
646
  main().catch(showError);
src/render/pixel.js CHANGED
@@ -1,8 +1,8 @@
1
  // The Pixel renderer: pixel art of whatever the scene shows, a 3D Gaussian splat included. Each view is
2
  // drawn small (about 240 pixels high), every pixel takes one of a few colours fitted to what that view
3
  // shows (palette.js), in-between colours become an ordered dither of the two nearest ones, and the result
4
- // is scaled up by a whole number of screen pixels. Robots and objects get an ink line around them: meshes
5
- // drawn this small need one to read against the splat.
6
  //
7
  // A view is first drawn with 2x2 samples per pixel, and each pixel then takes one of its four samples, never
8
  // a blend: the colours stay those of the scene, while a line thinner than a pixel is drawn whole or not at
@@ -10,7 +10,7 @@
10
  import * as THREE from "three";
11
  import { CHROMA, MAX_COLOURS, Palette } from "./palette.js";
12
 
13
- /** Layers of the meshes that get an ink line, and of those that only hide it (the splat's stand-in). */
14
  export const OUTLINED = 1;
15
  export const OCCLUDER = 2;
16
 
@@ -84,7 +84,7 @@ uniform vec3 matched[MAX_COLOURS];
84
  uniform vec3 colours[MAX_COLOURS];
85
  uniform int count;
86
  uniform float sharpness;
87
- uniform bool edges;
88
  uniform vec3 ink;
89
  varying vec2 vUv;
90
 
@@ -115,7 +115,7 @@ float inFront(vec2 d, float here) {
115
  void main() {
116
  vec3 colour = texture2D(tPicked, vUv).rgb;
117
  float line = 0.0;
118
- if (edges) {
119
  float here = nearness(vUv);
120
  vec2 dx = vec2(texel.x, 0.0);
121
  vec2 dy = vec2(0.0, texel.y);
@@ -200,7 +200,7 @@ export class PixelPass {
200
  colours: { value: null },
201
  count: { value: 0 },
202
  sharpness: { value: sharpness },
203
- edges: { value: false },
204
  ink: { value: new THREE.Color(ink) },
205
  },
206
  fragmentShader: QUANTISE,
@@ -277,7 +277,8 @@ export class PixelPass {
277
  * Draw `scene` from `camera` as pixel art into the canvas rectangle `rect` (CSS pixels from the top left;
278
  * null for the whole canvas), `scale` screen pixels to a pixel. `key` names the view, which keeps its
279
  * own render targets and palette. `draw` draws the scene in place of renderer.render (a view with its
280
- * own Spark state); `edges` asks for ink lines, {occluders} saying whether OCCLUDER meshes exist.
 
281
  */
282
  render(renderer, scene, camera, key, rect = null, { scale = this.scale(renderer), draw = null, edges = null } = {}) {
283
  const pr = renderer.getPixelRatio();
@@ -321,7 +322,7 @@ export class PixelPass {
321
  u.matched.value = t.palette.matched;
322
  u.colours.value = t.palette.colours;
323
  u.count.value = t.palette.count;
324
- u.edges.value = Boolean(edges);
325
  this.quad.material = this.quantise;
326
  renderer.setRenderTarget(t.pixels);
327
  renderer.render(this.screen, this.screenCamera);
@@ -336,7 +337,7 @@ export class PixelPass {
336
  renderer.setScissorTest(false);
337
  }
338
 
339
- /** Which samples show an outlined mesh, and the depth of those and of what hides them. */
340
  #drawMask(renderer, scene, camera, target, occluders) {
341
  const background = scene.background;
342
  const layers = camera.layers.mask;
 
1
  // The Pixel renderer: pixel art of whatever the scene shows, a 3D Gaussian splat included. Each view is
2
  // drawn small (about 240 pixels high), every pixel takes one of a few colours fitted to what that view
3
  // shows (palette.js), in-between colours become an ordered dither of the two nearest ones, and the result
4
+ // is scaled up by a whole number of screen pixels. A scene made of meshes gets ink lines around its shapes,
5
+ // as in Toon; a splat has no such lines, so the robot and the objects in it get none either.
6
  //
7
  // A view is first drawn with 2x2 samples per pixel, and each pixel then takes one of its four samples, never
8
  // a blend: the colours stay those of the scene, while a line thinner than a pixel is drawn whole or not at
 
10
  import * as THREE from "three";
11
  import { CHROMA, MAX_COLOURS, Palette } from "./palette.js";
12
 
13
+ /** Layers of the meshes a pixel can show, and of those that only hide them (the splat's stand-in). */
14
  export const OUTLINED = 1;
15
  export const OCCLUDER = 2;
16
 
 
84
  uniform vec3 colours[MAX_COLOURS];
85
  uniform int count;
86
  uniform float sharpness;
87
+ uniform bool lines;
88
  uniform vec3 ink;
89
  varying vec2 vUv;
90
 
 
115
  void main() {
116
  vec3 colour = texture2D(tPicked, vUv).rgb;
117
  float line = 0.0;
118
+ if (lines) {
119
  float here = nearness(vUv);
120
  vec2 dx = vec2(texel.x, 0.0);
121
  vec2 dy = vec2(0.0, texel.y);
 
200
  colours: { value: null },
201
  count: { value: 0 },
202
  sharpness: { value: sharpness },
203
+ lines: { value: false },
204
  ink: { value: new THREE.Color(ink) },
205
  },
206
  fragmentShader: QUANTISE,
 
277
  * Draw `scene` from `camera` as pixel art into the canvas rectangle `rect` (CSS pixels from the top left;
278
  * null for the whole canvas), `scale` screen pixels to a pixel. `key` names the view, which keeps its
279
  * own render targets and palette. `draw` draws the scene in place of renderer.render (a view with its
280
+ * own Spark state); `edges` tells the meshes apart, so that each pixel shows its nearest one: {occluders}
281
+ * says whether OCCLUDER meshes exist, {ink} asks for a line around the OUTLINED ones.
282
  */
283
  render(renderer, scene, camera, key, rect = null, { scale = this.scale(renderer), draw = null, edges = null } = {}) {
284
  const pr = renderer.getPixelRatio();
 
322
  u.matched.value = t.palette.matched;
323
  u.colours.value = t.palette.colours;
324
  u.count.value = t.palette.count;
325
+ u.lines.value = Boolean(edges?.ink);
326
  this.quad.material = this.quantise;
327
  renderer.setRenderTarget(t.pixels);
328
  renderer.render(this.screen, this.screenCamera);
 
337
  renderer.setScissorTest(false);
338
  }
339
 
340
+ /** Which samples show an OUTLINED mesh, and the depth of those and of what hides them. */
341
  #drawMask(renderer, scene, camera, target, occluders) {
342
  const background = scene.background;
343
  const layers = camera.layers.mask;
src/render/view.js CHANGED
@@ -26,6 +26,9 @@ const GEOM = { PLANE: 0, SPHERE: 2, CAPSULE: 3, ELLIPSOID: 4, CYLINDER: 5, BOX:
26
  const CREASE_ANGLE = Math.PI / 6;
27
  const STATIC = new Set(["floor", "proxy", "env", "decor"]);
28
  const BACKGROUND = { toon: 0xf1eee8, lit: 0xe3dfd8, splat: 0x202124, pixel: 0x0d1226 };
 
 
 
29
  // Where the key light sits relative to the camera target, unless the environment says (its "lighting").
30
  const KEY_OFFSET = [1.4, -1.1, 3.2];
31
 
@@ -479,7 +482,8 @@ export class SceneView {
479
  mesh.renderOrder = splat ? 1 : 0;
480
  mesh.castShadow = splat ? false : mesh.userData.casts;
481
  mesh.visible = true;
482
- // Pixel's ink lines go around what is drawn as a mesh; over a splat the decor only hides them.
 
483
  mesh.layers.enable(splat ? OCCLUDER : OUTLINED);
484
  continue;
485
  }
@@ -494,7 +498,9 @@ export class SceneView {
494
  // high-DPI screen the device ratio would multiply the work by up to four.
495
  // Pixel draws its few pixels whatever the screen, and scales them up on all of it.
496
  this.renderer.setPixelRatio(splat && !pixel ? 1 : Math.min(window.devicePixelRatio, 2));
497
- this.pixelEdges = { occluders: splat && decor };
 
 
498
  if (pixel) this.pixel.reset(); // new colours for the new look
499
  // Where the canvas is not a whole number of screen pixels (a 150% display), the browser stretches it.
500
  this.canvas.style.imageRendering = pixel ? "pixelated" : "";
@@ -504,7 +510,7 @@ export class SceneView {
504
  const lighting = this.env?.lighting ?? {};
505
  const key = { toon: [0xfff4e6, 1.7, 0.45], lit: [0xffffff, 2.4, 1], splat: [lighting.keyColor ?? 0xfff2e0, lighting.keyIntensity ?? 1.2, 1] }[look];
506
  this.key.color.set(key[0]);
507
- this.key.intensity = key[1];
508
  this.key.shadow.intensity = key[2];
509
  this.renderer.toneMapping = look === "lit" ? THREE.ACESFilmicToneMapping : THREE.NoToneMapping;
510
  // Lit's exposure: the modelled rooms are light-coloured, and brighter washes them out.
@@ -512,7 +518,7 @@ export class SceneView {
512
  // In 3DGS the splat's own light; RoomEnvironment (y-up) otherwise; Toon is lit by its sky.
513
  const splatLight = splat && this.splatLight?.url === this.splat.userData.url ? this.splatLight.texture : null;
514
  this.scene.environment = look === "toon" ? null : (splatLight ?? this.environment);
515
- this.scene.environmentIntensity = splatLight ? (lighting.ambient ?? 1) : 1;
516
  this.scene.environmentRotation.set(splatLight ? 0 : Math.PI / 2, 0, 0);
517
  this.scene.background = new THREE.Color(BACKGROUND[pixel ? "pixel" : look]);
518
  }
 
26
  const CREASE_ANGLE = Math.PI / 6;
27
  const STATIC = new Set(["floor", "proxy", "env", "decor"]);
28
  const BACKGROUND = { toon: 0xf1eee8, lit: 0xe3dfd8, splat: 0x202124, pixel: 0x0d1226 };
29
+ // Pixel over a splat lights the robot and the objects this much more: its palette deepens the mid greys,
30
+ // and they stand in a light scene without an ink line to set them off.
31
+ const PIXEL_GAIN = 1.2;
32
  // Where the key light sits relative to the camera target, unless the environment says (its "lighting").
33
  const KEY_OFFSET = [1.4, -1.1, 3.2];
34
 
 
482
  mesh.renderOrder = splat ? 1 : 0;
483
  mesh.castShadow = splat ? false : mesh.userData.casts;
484
  mesh.visible = true;
485
+ // Pixel (pixel.js) gives each pixel to its nearest mesh, and in the modelled scenes draws an ink
486
+ // line around it; over a splat the decor only stands for the splat's surfaces.
487
  mesh.layers.enable(splat ? OCCLUDER : OUTLINED);
488
  continue;
489
  }
 
498
  // high-DPI screen the device ratio would multiply the work by up to four.
499
  // Pixel draws its few pixels whatever the screen, and scales them up on all of it.
500
  this.renderer.setPixelRatio(splat && !pixel ? 1 : Math.min(window.devicePixelRatio, 2));
501
+ // Ink lines where the whole scene is modelled, as in Toon; a splat has none, so its robot has none.
502
+ this.pixelEdges = { occluders: splat && decor, ink: !splat };
503
+ const gain = pixel && splat ? PIXEL_GAIN : 1;
504
  if (pixel) this.pixel.reset(); // new colours for the new look
505
  // Where the canvas is not a whole number of screen pixels (a 150% display), the browser stretches it.
506
  this.canvas.style.imageRendering = pixel ? "pixelated" : "";
 
510
  const lighting = this.env?.lighting ?? {};
511
  const key = { toon: [0xfff4e6, 1.7, 0.45], lit: [0xffffff, 2.4, 1], splat: [lighting.keyColor ?? 0xfff2e0, lighting.keyIntensity ?? 1.2, 1] }[look];
512
  this.key.color.set(key[0]);
513
+ this.key.intensity = key[1] * gain;
514
  this.key.shadow.intensity = key[2];
515
  this.renderer.toneMapping = look === "lit" ? THREE.ACESFilmicToneMapping : THREE.NoToneMapping;
516
  // Lit's exposure: the modelled rooms are light-coloured, and brighter washes them out.
 
518
  // In 3DGS the splat's own light; RoomEnvironment (y-up) otherwise; Toon is lit by its sky.
519
  const splatLight = splat && this.splatLight?.url === this.splat.userData.url ? this.splatLight.texture : null;
520
  this.scene.environment = look === "toon" ? null : (splatLight ?? this.environment);
521
+ this.scene.environmentIntensity = (splatLight ? (lighting.ambient ?? 1) : 1) * gain;
522
  this.scene.environmentRotation.set(splatLight ? 0 : Math.PI / 2, 0, 0);
523
  this.scene.background = new THREE.Color(BACKGROUND[pixel ? "pixel" : look]);
524
  }