Agent skill for creative 3D visualization: turn an idea into a Three.js/Blender scene worth exploring. Claude Code + Codex plugin, 223 recipes, 440 knowledge records, 22 proved kits, 37 runnable studies.
import {THREE,mat,mesh,line,label} from '../scene-kit.js';
import {study,dynamicLine,TAU} from '../study-kit.js';
import {gaussianSamples,covarianceAxes,sampleCovariance} from './math-models.js';
export function createScene(){
const group=new THREE.Group(),state={rho:.65,n:1200,seed:23,sx:.85,sy:.62,sz:.42},dummy=new THREE.Object3D();let samples=[],cov;
const dots=new THREE.InstancedMesh(new THREE.IcosahedronGeometry(.022,1),mat('#bddfca',.32,.15,{emissive:'#285c51',emissiveIntensity:.25}),2400);group.add(dots);dots.frustumCulled=false;
const ellipse=new THREE.Group();group.add(ellipse);
mesh(new THREE.SphereGeometry(1,64,40),new THREE.MeshPhysicalMaterial({color:'#b1c5a2',roughness:.25,transparent:true,opacity:.09,depthWrite:false,side:THREE.DoubleSide}),[0,0,0],ellipse);
for(let j=0;j<3;j++){const pts=Array.from({length:161},(_,i)=>{const a=i/160*TAU,p=[Math.cos(a),Math.sin(a),0];return j===0?p:j===1?[p[0],0,p[1]]:[0,p[0],p[1]];});line(pts,'#dacfa0',ellipse,.8);}
for(let i=-4;i<=4;i++){line([[-2.4,-1.9,i*.5],[2.4,-1.9,i*.5]],'#608a85',group,.17);line([[i*.5,-1.9,-2.4],[i*.5,-1.9,2.4]],'#608a85',group,.17);}
const shadow=new THREE.InstancedMesh(new THREE.CircleGeometry(.014,6),new THREE.MeshBasicMaterial({color:'#87bcb0',transparent:true,opacity:.25,depthWrite:false}),2400);group.add(shadow);shadow.frustumCulled=false;
const mx=dynamicLine(160,'#dba18e',group),my=dynamicLine(160,'#d5c795',group);label('X MARGINAL',[0,-1.65,2.35],'#dba18e',.12,group);label('Z MARGINAL',[-2.45,-1.65,0],'#d5c795',.12,group);label('Y',[0,2.15,0],'#a8c5bf',.13,group);label('X',[2.5,0,0],'#a8c5bf',.13,group);label('Z',[0,0,2.4],'#a8c5bf',.13,group);label('2σ ELLIPSOID',[0,1.8,0],'#c6d5b4',.13,group);
function refresh(){samples=gaussianSamples(state.n,state.seed,state.sx,state.sy,state.sz,state.rho);cov=sampleCovariance(samples);dots.count=shadow.count=state.n;
samples.forEach((p,i)=>{dummy.position.set(...p);dummy.rotation.set(0,0,0);dummy.updateMatrix();dots.setMatrixAt(i,dummy.matrix);dummy.position.y=-1.894;dummy.rotation.x=-Math.PI/2;dummy.updateMatrix();shadow.setMatrixAt(i,dummy.matrix);});dots.instanceMatrix.needsUpdate=shadow.instanceMatrix.needsUpdate=true;
const axes=covarianceAxes(state.sx,state.sy,state.sz,state.rho);ellipse.matrixAutoUpdate=false;ellipse.matrix.makeBasis(...axes.map(a=>new THREE.Vector3(...a.v).multiplyScalar(a.l*2)));
const density=(x,s)=>Math.exp(-.5*(x/s)**2)/(s*Math.sqrt(2*Math.PI));mx.setPoints(Array.from({length:160},(_,i)=>{const x=-2.4+4.8*i/159;return[x,-1.88+.65*density(x,state.sx),2.05];}));my.setPoints(Array.from({length:160},(_,i)=>{const y=-2.4+4.8*i/159;return[-2.2,-1.88+.65*density(y,state.sz),y];}));
}
const set=key=>v=>{state[key]=v;refresh();};const reset=()=>{Object.assign(state,{rho:.65,n:1200,seed:23,sx:.85});ellipse.visible=true;refresh();};refresh();
return study(group,{reset,controls:[{id:'rho',label:'X–Y population correlation ρ',type:'range',min:-.95,max:.95,step:.01,get:()=>state.rho,set:set('rho')},{id:'n',label:'Number of observations',type:'range',min:200,max:2400,step:100,get:()=>state.n,set:set('n')},{id:'sigma',label:'Horizontal spread σx',type:'range',min:.3,max:1.2,step:.02,get:()=>state.sx,set:set('sx')},{id:'seed',label:'Draw another seeded sample',type:'button',set:()=>{state.seed++;refresh();}},{id:'shell',label:'Reveal / hide covariance ellipsoid',type:'button',set:()=>ellipse.visible=!ellipse.visible}],stats:()=>[{label:'Population ρ',value:state.rho.toFixed(2)},{label:'Sample correlation',value:(cov[0][1]/Math.sqrt(cov[0][0]*cov[1][1])).toFixed(3)},{label:'Seed',value:state.seed}],views:{overview:{position:[4.8,3.2,7.1],target:[0,-.35,0]},detail:{position:[2.8,1.5,4.2],target:[0,0,0]}},note:'Seeded Box–Muller samples are transformed by a Cholesky factor. The ellipsoid is the Mahalanobis-radius-2 surface; in three dimensions this is not a 95% probability boundary. Floor curves show the X and Z marginal densities (height uses one common display scale). Correlation applies to X and vertical Y; the floor shadow is an X–Z projection and does not show this controlled correlation. Sample generation occurs on parameter changes only; the resting view does not animate.',sources:[{title:'Stanford CS229 — Multivariate Gaussian Distribution',url:'https://cs229.stanford.edu/section/gaussians.pdf'}]});
}