Open-source platform for 3D AI agents. Turn text or a photo into a rigged, animated GLB avatar, give it an LLM brain, memory and a wallet, and embed it anywhere with one web component. Remote MCP server, x402 payments, Three.js, browser-native.
JavaScript 3d-generationai-agentsanimationavatardigital-humangenerative-aiglbgltfimage-to-3dllmmcpmcp-servermodel-context-protocolsolanatext-to-3dthreejsweb-componentswebglwebxrx402
export const CRT_VERTEX_SHADER = "attribute vec2 aPos;\nvoid main(){ gl_Position = vec4(aPos,0.0,1.0); }";
export const CRT_FRAGMENT_SHADER = `precision highp float;
uniform sampler2D uTex;
uniform vec2 uRes;
uniform float uTime;
uniform float uMotion;
uniform vec2 uCurve;
uniform float uScan;
uniform float uScanDepth;
uniform float uTriad;
uniform float uGrille;
uniform float uChroma;
uniform float uBar;
uniform float uFlicker;
uniform float uGrain;
uniform float uNoise;
uniform float uVignette;
uniform float uMono;
uniform float uGain;
uniform float uHalo;
uniform vec3 uSheen;
uniform vec3 uRoom;
float hash(vec2 p){ p=fract(p*vec2(123.34,456.21)); p+=dot(p,p+45.32); return fract(p.x*p.y); }
vec2 curve(vec2 uv){
uv = uv*2.0-1.0;
vec2 o = uv.yx*uv.yx;
uv += uv * o * uCurve;
uv = uv*0.5+0.5;
return uv;
}
void main(){
vec2 fuv = gl_FragCoord.xy / uRes;
vec2 uv = curve(fuv);
float t = uTime;
/* analogue transport faults: per-row jitter, a rolling dropout band, and the
head-switching scramble along the bottom edge of the raster */
float band = 0.0;
if (uNoise > 0.001){
float row = floor(uv.y * 190.0);
float gate = step(0.905, hash(vec2(row, floor(t*15.0))));
uv.x += (hash(vec2(row*1.7, floor(t*15.0)+7.0)) - 0.5) * 0.052 * gate * uNoise;
float pos = fract(uv.y * 0.8 - t * 0.17);
band = smoothstep(0.075, 0.0, pos);
uv.x += band * (hash(vec2(floor(uv.y*260.0), floor(t*26.0))) - 0.5) * 0.030 * uNoise;
float head = smoothstep(0.030, 0.0, uv.y);
uv.x += head * (hash(vec2(floor(uv.y*520.0), floor(t*22.0))) - 0.32) * 0.075 * uNoise;
band = max(band, head);
}
vec2 inb = step(vec2(0.0), uv) * step(uv, vec2(1.0));
float inside = inb.x*inb.y;
vec2 ed = min(uv, 1.0-uv);
inside *= smoothstep(0.0,0.020, min(ed.x,ed.y));
vec2 dir = uv-0.5;
float d2 = dot(dir,dir);
vec2 ao = dir * (0.0010 + 0.0075*d2) * uChroma;
vec3 col;
col.r = texture2D(uTex, uv + ao).r;
col.g = texture2D(uTex, uv).g;
col.b = texture2D(uTex, uv - ao).b;
/* phosphor halation: a wide cheap tap ring so bright glyphs bloom into the
glass instead of relying on the text canvas alone */
if (uHalo > 0.001){
float s = 0.0038;
vec3 wide = texture2D(uTex, uv + vec2( s, 0.0)).rgb
+ texture2D(uTex, uv + vec2(-s, 0.0)).rgb
+ texture2D(uTex, uv + vec2(0.0, s)).rgb
+ texture2D(uTex, uv + vec2(0.0, -s)).rgb
+ texture2D(uTex, uv + vec2( s, s)*0.72).rgb
+ texture2D(uTex, uv + vec2(-s, -s)*0.72).rgb;
col += wide * (uHalo / 6.0);
}
float sl = sin(uv.y*3.14159265*uScan + t*4.0*uMotion);
col *= mix(1.0 - uScanDepth, 1.0, sl*sl);
float gx = gl_FragCoord.x * (6.2831853/max(uTriad, 1.0));
vec3 grille = (1.0-uGrille) + uGrille*cos(gx + vec3(0.0,2.094,4.188));
col *= mix(vec3(1.0), grille, step(0.001, uGrille));
col *= uGain;
float bar = fract(uv.y*0.5 - t*0.07*uMotion);
bar = smoothstep(0.0,0.05,bar)*smoothstep(0.18,0.05,bar);
col += bar*uBar*uMotion;
float sheen = smoothstep(0.55,0.0, distance(uv, vec2(0.50,0.15)));
col += sheen*0.030*uSheen;
float vig = smoothstep(0.98,0.30, length((uv-0.5)*vec2(1.05,1.0)));
col *= mix(1.0-uVignette, 1.0, vig);
col *= 1.0 - uFlicker*uMotion*sin(t*8.0);
if (uNoise > 0.001){
float st = hash(fuv*uRes*0.5 + vec2(floor(t*24.0), floor(t*24.0)*1.7));
col += (st-0.5)*0.135*uNoise;
col += band*0.085*uNoise;
}
col += (hash(fuv + fract(t*0.37)) - 0.5)*uGrain;
float luma = dot(col, vec3(0.2126,0.7152,0.0722));
col = mix(col, vec3(luma), uMono);
float spill = smoothstep(0.85,0.18, length(fuv-0.5))*0.05;
vec3 room = uRoom + uSheen*spill*0.42;
col = mix(room, col, inside);
col = max(col, uRoom*0.34);
gl_FragColor = vec4(col,1.0);
}`;