Skip to content

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.

feat(ui): bring avatar-result viewers up to the IRL/Forge cinematic lighting bar

nirholasd92aac4ebcb7
diff --git a/pages/create-prompt.html b/pages/create-prompt.html
index aa921a36b..1794f6eae 100644
--- a/pages/create-prompt.html
+++ b/pages/create-prompt.html
@@ -714,10 +714,11 @@
rotation-per-second="14deg"
interaction-prompt="none"
camera-controls
- shadow-intensity="0.7"
- shadow-softness="0.8"
+ shadow-intensity="1.0"
+ shadow-softness="0.9"
environment-image="neutral"
- exposure="0.95"
+ exposure="1.5"
+ tone-mapping="aces"
camera-orbit="0deg 80deg auto"
loading="eager"
alt="Your newly generated 3D avatar"
diff --git a/pages/create-selfie.html b/pages/create-selfie.html
index 98df95720..d3e56f649 100644
--- a/pages/create-selfie.html
+++ b/pages/create-selfie.html
@@ -1676,10 +1676,11 @@
rotation-per-second="10deg"
interaction-prompt="none"
camera-controls
- shadow-intensity="0.7"
- shadow-softness="0.8"
+ shadow-intensity="1.0"
+ shadow-softness="0.9"
environment-image="neutral"
- exposure="0.95"
+ exposure="1.5"
+ tone-mapping="aces"
camera-orbit="0deg 78deg auto"
loading="eager"
alt="Your new avatar"
diff --git a/pages/create/video.html b/pages/create/video.html
index a9b4785bc..0e293fe80 100644
--- a/pages/create/video.html
+++ b/pages/create/video.html
@@ -722,8 +722,10 @@
disable-zoom
disable-pan
camera-orbit="0deg 80deg auto"
- shadow-intensity="0.4"
- exposure="0.95"
+ shadow-intensity="1.0"
+ shadow-softness="0.9"
+ exposure="1.5"
+ tone-mapping="aces"
environment-image="neutral"
loading="eager"
></model-viewer>
diff --git a/pages/forge-spark.html b/pages/forge-spark.html
index e69a1107d..0be8b7dd9 100644
--- a/pages/forge-spark.html
+++ b/pages/forge-spark.html
@@ -433,8 +433,10 @@
viewer = document.createElement('model-viewer');
viewer.setAttribute('camera-controls', '');
viewer.setAttribute('auto-rotate', '');
- viewer.setAttribute('shadow-intensity', '1');
- viewer.setAttribute('exposure', '1');
+ viewer.setAttribute('shadow-intensity', '1.0');
+ viewer.setAttribute('shadow-softness', '0.9');
+ viewer.setAttribute('exposure', '1.5');
+ viewer.setAttribute('tone-mapping', 'aces');
viewer.setAttribute('environment-image', 'neutral');
viewer.setAttribute('ar', '');
viewer.setAttribute('alt', 'Generated 3D model');
diff --git a/src/create-agent.js b/src/create-agent.js
index 1436c0386..ca7ce64ab 100644
--- a/src/create-agent.js
+++ b/src/create-agent.js
@@ -684,8 +684,8 @@ function renderLibrary() {
);
const retry = document.createElement('button');
retry.type = 'button';
- retry.className = 'lib-load-more';
- retry.style = 'grid-column:1/-1;margin-top:6px;padding:6px 12px;font-size:0.75rem;opacity:0.6;cursor:pointer;background:transparent;border:1px solid rgba(255,255,255,0.2);border-radius:6px;color:inherit;transition:opacity 0.15s';
+ retry.className = 'btn btn--ghost';
+ retry.style = 'grid-column:1/-1;margin-top:6px;justify-self:start';
retry.textContent = 'Try again';
retry.addEventListener('click', () => {
libraryState = 'idle';
@@ -726,8 +726,8 @@ function renderLibrary() {
if (libraryHasMore) {
const more = document.createElement('button');
more.type = 'button';
- more.className = 'lib-load-more';
- more.style = 'grid-column:1/-1;margin-top:6px;padding:6px 12px;font-size:0.75rem;opacity:0.6;cursor:pointer;background:transparent;border:1px solid rgba(255,255,255,0.2);border-radius:6px;color:inherit;transition:opacity 0.15s';
+ more.className = 'btn btn--ghost';
+ more.style = 'grid-column:1/-1;margin-top:6px;justify-self:start';
more.textContent = 'Load more';
more.addEventListener('click', () => loadLibraryAvatars({ append: true }));
grid.appendChild(more);
@@ -900,8 +900,10 @@ function syncModelPreview() {
mv.setAttribute('rotation-per-second', '18deg');
mv.setAttribute('camera-controls', '');
mv.setAttribute('interaction-prompt', 'none');
- mv.setAttribute('shadow-intensity', '0.4');
- mv.setAttribute('exposure', '0.95');
+ mv.setAttribute('shadow-intensity', '1.0');
+ mv.setAttribute('shadow-softness', '0.9');
+ mv.setAttribute('exposure', '1.5');
+ mv.setAttribute('tone-mapping', 'aces');
mv.setAttribute('environment-image', 'neutral');
mv.setAttribute('camera-orbit', '15deg 80deg auto');
mv.setAttribute('loading', 'eager');
@@ -1324,8 +1326,10 @@ function succeed(agent) {
mv.setAttribute('rotation-per-second', '20deg');
mv.setAttribute('interaction-prompt', 'none');
mv.setAttribute('disable-zoom', '');
- mv.setAttribute('shadow-intensity', '0.4');
- mv.setAttribute('exposure', '0.95');
+ mv.setAttribute('shadow-intensity', '1.0');
+ mv.setAttribute('shadow-softness', '0.9');
+ mv.setAttribute('exposure', '1.5');
+ mv.setAttribute('tone-mapping', 'aces');
mv.setAttribute('environment-image', 'neutral');
mv.setAttribute('camera-orbit', '15deg 80deg auto');
box.appendChild(mv);
diff --git a/src/voice/talk-scene.js b/src/voice/talk-scene.js
index f8c014723..740e4d509 100644
--- a/src/voice/talk-scene.js
+++ b/src/voice/talk-scene.js
@@ -20,6 +20,7 @@ import {
WebGLRenderer,
SRGBColorSpace,
ACESFilmicToneMapping,
+ PCFSoftShadowMap,
Scene,
PMREMGenerator,
AmbientLight,
@@ -27,6 +28,9 @@ import {
PerspectiveCamera,
AnimationMixer,
Box3,
+ PlaneGeometry,
+ ShadowMaterial,
+ Mesh,
} from 'three';
import { GLTFLoader } from 'three/addons/loaders/GLTFLoader.js';
import { OrbitControls } from 'three/addons/controls/OrbitControls.js';
@@ -99,6 +103,13 @@ export class TalkScene {
this.renderer.outputColorSpace = SRGBColorSpace;
this.renderer.toneMapping = ACESFilmicToneMapping;
this.renderer.toneMappingExposure = 1.0;
+ // Soft ground-contact shadow, matching the IRL placement viewer's
+ // PCFSoftShadowMap upgrade — a ShadowMaterial catcher (added once the
+ // avatar loads, see _setupGroundShadow) renders invisible except where
+ // the key light casts a shadow, so it doesn't break this scene's
+ // transparent background.
+ this.renderer.shadowMap.enabled = true;
+ this.renderer.shadowMap.type = PCFSoftShadowMap;
const { width, height } = sizeOf(container);
this.renderer.setSize(width, height, false);
@@ -117,6 +128,15 @@ export class TalkScene {
this.scene.add(new AmbientLight(0xffffff, 0.4));
const key = new DirectionalLight(0xffffff, 1.4);
key.position.set(2, 4, 3);
+ key.castShadow = true;
+ key.shadow.mapSize.set(1024, 1024);
+ key.shadow.camera.near = 0.5;
+ key.shadow.camera.far = 10;
+ key.shadow.camera.left = -1.5;
+ key.shadow.camera.right = 1.5;
+ key.shadow.camera.top = 2.5;
+ key.shadow.camera.bottom = -1.5;
+ key.shadow.bias = -0.0015;
this.scene.add(key);
const rim = new DirectionalLight(0x90a0ff, 0.6);
rim.position.set(-3, 2, -2);
@@ -158,6 +178,10 @@ export class TalkScene {
this.gltf = gltf;
this.root = gltf.scene;
this.scene.add(this.root);
+ this.root.traverse((node) => {
+ if (node.isMesh) node.castShadow = true;
+ });
+ this._setupGroundShadow();
// Frame the avatar: aim the camera at its head (estimated as the top
// 15% of the bounding box) and back off proportional to its height.
@@ -267,6 +291,9 @@ export class TalkScene {
});
}
+ this._groundShadow?.geometry?.dispose?.();
+ this._groundShadow?.material?.dispose?.();
+ this._groundShadow = null;
this.scene?.environment?.dispose?.();
this.renderer?.dispose?.();
@@ -302,6 +329,27 @@ export class TalkScene {
return this._cameraPreset;
}
+ // A ShadowMaterial plane renders fully invisible except where a shadow
+ // falls on it, so it adds a soft ground-contact shadow at the avatar's
+ // feet without introducing a visible floor — this scene stays transparent
+ // (see `this.scene.background = null` in mount()). Sized/positioned from
+ // the loaded model's own bounding box, so it works for any avatar height.
+ _setupGroundShadow() {
+ if (!this.root) return;
+ const b = new Box3().setFromObject(this.root);
+ if (!Number.isFinite(b.min.y)) return; // empty/degenerate bounds — nothing to catch a shadow
+ const footprint = Math.max(b.max.x - b.min.x, b.max.z - b.min.z, 1);
+ const size = footprint * 6;
+ if (!this._groundShadow) {
+ this._groundShadow = new Mesh(new PlaneGeometry(1, 1), new ShadowMaterial({ opacity: 0.35 }));
+ this._groundShadow.rotation.x = -Math.PI / 2;
+ this._groundShadow.receiveShadow = true;
+ this.scene.add(this._groundShadow);
+ }
+ this._groundShadow.scale.set(size, size, 1);
+ this._groundShadow.position.set((b.min.x + b.max.x) / 2, b.min.y, (b.min.z + b.max.z) / 2);
+ }
+
_frameAvatar() {
if (!this.root || !this.camera || !this.controls) return;
const b = new Box3().setFromObject(this.root);