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
<!doctype html>
<html lang="en">
<head>
<script>/* three.ws theme boot — no-flash; runtime in /theme-switcher.js */(function(){try{var m=localStorage.getItem('twx_theme');var l=m==='auto'?(window.matchMedia&&window.matchMedia('(prefers-color-scheme: light)').matches):m==='light';document.documentElement.setAttribute('data-theme',l?'light':'dark');}catch(e){document.documentElement.setAttribute('data-theme','dark');}})();</script>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title data-i18n="create_selfie.meta_title">Selfie to avatar · three.ws</title>
<link rel="icon" href="/favicon.ico" sizes="any" />
<link rel="icon" type="image/svg+xml" href="/favicon.svg" />
<link rel="icon" type="image/png" sizes="32x32" href="/favicon-32x32.png" />
<link rel="icon" type="image/png" sizes="16x16" href="/favicon-16x16.png" />
<link rel="apple-touch-icon" href="/apple-touch-icon.png" />
<link rel="manifest" href="/manifest.webmanifest" />
<meta
name="description"
content="One selfie. About a minute. A rigged 3D avatar that works everywhere."
data-i18n-attr="content:create_selfie.meta_description"/>
<meta name="robots" content="index, follow" />
<meta property="og:type" content="website" />
<meta property="og:site_name" content="three.ws" />
<meta property="og:url" content="https://three.ws/create/selfie" />
<meta property="og:title" content="Selfie to avatar · three.ws" data-i18n-attr="content:create_selfie.meta_og_title"/>
<meta
property="og:description"
content="One selfie. About a minute. A rigged 3D avatar that works everywhere."
data-i18n-attr="content:create_selfie.meta_og_description"/>
<meta property="og:image" content="https://three.ws/api/page-og?s=build&t=Selfie+to+Avatar&d=One+selfie.+About+a+minute.+A+rigged+3D+avatar+that+works+everywhere.&p=%2Fcreate%2Fselfie" />
<style>
:root {
color-scheme: dark;
--bg: #000000;
--panel: #0a0a0a;
--panel-elev: #111111;
--border: #1a1a1a;
--border-strong: #2a2a2a;
--text: #e8e8e8;
--muted: #888888;
--accent: #ffffff;
--accent-ink: #000000;
--danger: #f87171;
--danger-dim: #4a1a1a;
}
* {
box-sizing: border-box;
}
html,
body {
margin: 0;
padding: 0;
}
body {
font:
15px/1.55 -apple-system,
BlinkMacSystemFont,
'Segoe UI',
Roboto,
sans-serif;
color: var(--text);
background: var(--bg);
min-height: 100vh;
overflow-x: hidden;
}
body::before {
content: '';
position: fixed;
inset: 0;
z-index: -1;
pointer-events: none;
background:
radial-gradient(
800px 500px at 50% -100px,
rgba(255, 255, 255, 0.03) 0,
transparent 70%
),
radial-gradient(
600px 400px at 50% 110%,
rgba(255, 255, 255, 0.04) 0,
transparent 70%
),
#000000;
}
main.stage {
max-width: 720px;
margin: 0 auto;
padding: 32px 20px 96px;
}
.topbar {
display: flex;
align-items: center;
gap: 14px;
margin-bottom: 28px;
}
.topbar button.back {
background: var(--panel);
border: 1px solid var(--border);
color: var(--text);
width: 36px;
height: 36px;
border-radius: 9px;
font: inherit;
cursor: pointer;
display: inline-flex;
align-items: center;
justify-content: center;
}
.topbar button.back:hover {
border-color: var(--border-strong);
}
.topbar .label {
font-size: 12px;
letter-spacing: 0.06em;
text-transform: uppercase;
color: var(--muted);
}
.topbar .label strong {
color: var(--text);
font-weight: 600;
}
h1 {
font-size: 28px;
line-height: 1.25;
margin: 0 0 8px;
}
.sub {
color: var(--muted);
margin: 0 0 28px;
line-height: 1.55;
}
.alt-path {
color: var(--muted);
font-size: 0.88rem;
margin: -14px 0 28px;
line-height: 1.55;
}
.alt-path a {
color: var(--accent);
text-decoration: none;
font-weight: 500;
}
.alt-path a:hover,
.alt-path a:focus-visible {
text-decoration: underline;
}
.step {
display: none;
opacity: 0;
}
.step.active {
display: block;
animation: step-in 400ms ease forwards;
}
@keyframes step-in {
from {
opacity: 0;
transform: translateY(12px);
}
to {
opacity: 1;
transform: translateY(0);
}
}
.unsupported {
display: none;
padding: 12px 14px;
background: rgba(239, 77, 77, 0.08);
border: 1px solid var(--danger-dim);
border-radius: 9px;
color: #f4b5b5;
font-size: 13.5px;
margin: 0 0 20px;
}
.unsupported.show {
display: block;
}
.hero-slot-wrap {
margin: 8px 0 18px;
}
.hero-slot {
aspect-ratio: 1 / 1;
max-width: 360px;
margin: 0 auto;
background: var(--panel);
border: 1.5px dashed var(--border-strong);
border-radius: 16px;
position: relative;
overflow: hidden;
cursor: pointer;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
gap: 8px;
color: var(--muted);
transition:
border-color 120ms,
background 120ms;
}
.hero-slot:hover,
.hero-slot:focus-visible {
border-color: var(--accent);
color: var(--text);
outline: none;
}
.hero-slot.drag {
border-color: var(--accent);
background: rgba(255, 255, 255, 0.05);
cursor: copy;
}
.hero-slot.filled {
border-style: solid;
border-color: var(--border);
padding: 0;
cursor: default;
}
.hero-slot.error {
border-color: var(--danger);
}
.hero-slot .hero-icon {
font-size: 36px;
opacity: 0.7;
}
.hero-slot .hero-title {
font-size: 15.5px;
color: var(--text);
font-weight: 600;
}
.hero-slot .hero-sub {
font-size: 13px;
color: var(--muted);
max-width: 240px;
text-align: center;
line-height: 1.4;
}
.hero-slot img.preview {
width: 100%;
height: 100%;
object-fit: cover;
display: block;
}
.hero-slot .retake-btn {
position: absolute;
top: 12px;
right: 12px;
background: rgba(0, 0, 0, 0.65);
backdrop-filter: blur(8px);
-webkit-backdrop-filter: blur(8px);
border: 1px solid rgba(255, 255, 255, 0.15);
color: var(--text);
border-radius: 9px;
padding: 8px 12px;
font: 600 12px/1 inherit;
cursor: pointer;
display: inline-flex;
align-items: center;
gap: 6px;
transition: background 120ms;
z-index: 1;
}
.hero-slot .retake-btn:hover {
background: rgba(0, 0, 0, 0.85);
}
.hero-actions {
display: flex;
justify-content: center;
gap: 10px;
margin-top: 12px;
flex-wrap: wrap;
}
.hero-pill {
background: var(--panel);
border: 1px solid var(--border);
color: var(--muted);
border-radius: 999px;
padding: 7px 14px;
font: 500 12.5px/1 inherit;
cursor: pointer;
transition:
color 120ms,
border-color 120ms;
display: inline-flex;
align-items: center;
gap: 7px;
}
.hero-pill:hover {
color: var(--text);
border-color: var(--border-strong);
}
.hero-pill[hidden] {
display: none;
}
.hero-pill svg {
display: block;
}
.fidelity {
margin: 0 0 22px;
border: 1px solid var(--border);
background: var(--panel);
border-radius: 12px;
overflow: hidden;
}
.fidelity summary {
list-style: none;
padding: 14px 16px;
cursor: pointer;
display: flex;
align-items: center;
justify-content: space-between;
gap: 12px;
color: var(--text);
}
.fidelity summary::-webkit-details-marker {
display: none;
}
.fidelity .fid-label {
font-size: 14px;
font-weight: 600;
}
.fidelity .fid-note {
color: var(--muted);
font-size: 12.5px;
font-weight: 400;
}
.fidelity .fid-chev {
color: var(--muted);
transition: transform 200ms;
}
.fidelity[open] .fid-chev {
transform: rotate(180deg);
}
.fidelity .fid-body {
padding: 4px 16px 18px;
}
.slots {
display: grid;
grid-template-columns: 1fr 1fr;
gap: 12px;
}
.slot-frame {
aspect-ratio: 3 / 4;
background: var(--panel-elev);
border: 1.5px dashed var(--border-strong);
border-radius: 11px;
position: relative;
overflow: hidden;
cursor: pointer;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
gap: 6px;
color: var(--muted);
transition:
border-color 120ms,
background 120ms;
}
.slot-frame:hover,
.slot-frame:focus-visible {
border-color: var(--accent);
color: var(--text);
outline: none;
}
.slot-frame.drag {
border-color: var(--accent);
background: rgba(255, 255, 255, 0.05);
cursor: copy;
}
.slot-frame.filled {
border-style: solid;
border-color: var(--border);
padding: 0;
}
.slot-frame.error {
border-color: var(--danger);
}
.slot-frame .slot-label {
font-size: 11.5px;
letter-spacing: 0.06em;
text-transform: uppercase;
color: var(--muted);
}
.slot-frame .slot-hint {
font-size: 13px;
color: var(--text);
font-weight: 500;
}
.slot-frame img {
width: 100%;
height: 100%;
object-fit: cover;
display: block;
}
.slot-frame .retake-btn {
position: absolute;
top: 8px;
right: 8px;
background: rgba(0, 0, 0, 0.7);
border: 1px solid rgba(255, 255, 255, 0.2);
color: var(--text);
border-radius: 7px;
padding: 4px 9px;
font: 600 11px/1 inherit;
cursor: pointer;
}
.opts {
margin: 0 0 22px;
display: flex;
flex-direction: column;
gap: 18px;
}
.opt-group .opt-label {
font-size: 12px;
letter-spacing: 0.06em;
text-transform: uppercase;
color: var(--muted);
margin: 0 0 10px;
}
.toggle {
display: inline-flex;
background: var(--panel);
border: 1px solid var(--border);
border-radius: 9px;
padding: 3px;
gap: 2px;
}
.toggle button {
background: transparent;
border: none;
color: var(--muted);
font: 600 13px/1 inherit;
padding: 8px 14px;
border-radius: 7px;
cursor: pointer;
}
.toggle button[aria-pressed='true'] {
background: var(--panel-elev);
color: var(--text);
}
.toggle button:hover {
color: var(--text);
}
.opt-hint {
font-size: 12px;
color: var(--muted);
margin: 6px 0 0;
}
.style-grid {
display: grid;
grid-template-columns: 1fr 1fr;
gap: 10px;
}
/* Two columns leave ~70px for the description once the 44px swatch and
the padding are taken out on a 320px phone, which shreds "Likeness-
first. Closest to how you actually look." into a one-word-per-line
column. Stack the cards instead: the choice is read, not scanned. */
@media (max-width: 430px) {
.style-grid {
grid-template-columns: 1fr;
}
}
.style-card {
background: var(--panel);
border: 1.5px solid var(--border);
border-radius: 11px;
padding: 12px;
cursor: pointer;
text-align: left;
color: var(--text);
font: inherit;
display: flex;
gap: 12px;
align-items: center;
transition:
border-color 120ms,
transform 120ms;
}
.style-card:hover {
border-color: var(--border-strong);
transform: translateY(-1px);
}
.style-card[aria-pressed='true'] {
border-color: var(--accent);
background: rgba(255, 255, 255, 0.04);
}
.style-swatch {
width: 44px;
height: 44px;
border-radius: 8px;
flex-shrink: 0;
background-size: cover;
background-position: center;
border: 1px solid var(--border);
}
.style-swatch.photoreal {
background: radial-gradient(
circle at 35% 30%,
#f6c79b 0%,
#c98c61 45%,
#4a2e1d 95%
);
}
.style-swatch.stylized {
background: radial-gradient(
circle at 35% 30%,
#ffd5e8 0%,
#c4a3ff 45%,
#5a3aa3 95%
);
}
.style-card .style-title {
font-size: 14px;
font-weight: 600;
line-height: 1.2;
margin: 0 0 2px;
}
.style-card .style-desc {
font-size: 12px;
color: var(--muted);
line-height: 1.35;
}
/* ── Step 3: Building ─────────────────────────────────────────────── */
.build-progress {
display: flex;
flex-direction: column;
gap: 0;
margin: 0 0 28px;
}
.build-step {
display: flex;
align-items: flex-start;
gap: 12px;
padding: 10px 0;
position: relative;
}
.build-step:not(:last-child)::after {
content: '';
position: absolute;
left: 9px;
top: 30px;
bottom: -10px;
width: 2px;
background: var(--border);
}
.build-step.completed::after {
background: rgba(255, 255, 255, 0.3);
}
.bstep-dot {
width: 20px;
height: 20px;
border-radius: 50%;
border: 2px solid var(--border-strong);
background: var(--panel);
flex-shrink: 0;
margin-top: 1px;
position: relative;
z-index: 1;
}
.build-step.completed .bstep-dot {
background: var(--accent);
border-color: var(--accent);
}
.build-step.completed .bstep-dot::after {
content: '';
display: block;
width: 5px;
height: 9px;
border: 2px solid var(--accent-ink);
border-top: none;
border-left: none;
transform: rotate(45deg) translate(-1px, -1px);
position: absolute;
top: 2px;
left: 5px;
}
.build-step.active .bstep-dot {
border-color: var(--accent);
animation: bstep-pulse 1.4s ease-in-out infinite;
}
@keyframes bstep-pulse {
0%,
100% {
box-shadow: 0 0 0 0 rgba(255, 255, 255, 0.4);
}
50% {
box-shadow: 0 0 0 6px rgba(214, 255, 61, 0);
}
}
.bstep-label {
font-size: 14px;
color: var(--muted);
line-height: 1.4;
padding-top: 1px;
}
.build-step.active .bstep-label {
color: var(--text);
font-weight: 500;
}
.build-step.completed .bstep-label {
color: var(--muted);
}
.build-step.failed .bstep-dot {
background: var(--danger);
border-color: var(--danger);
animation: none;
}
.build-step.failed .bstep-dot::after {
content: '×';
display: block;
color: #fff;
font: 700 14px/1 sans-serif;
text-align: center;
position: absolute;
top: -1px;
left: 2px;
}
.build-step.failed .bstep-label {
color: var(--danger);
font-weight: 500;
}
.build-step.failed::after {
background: var(--danger-dim);
}
.build-viewer {
position: relative;
width: 100%;
max-width: 320px;
margin: 0 auto 24px;
aspect-ratio: 3 / 4;
border-radius: 16px;
overflow: hidden;
background: var(--panel);
border: 1px solid var(--border);
}
.build-viewer model-viewer {
width: 100%;
height: 100%;
--poster-color: transparent;
}
.build-preview {
position: absolute;
top: 18px;
left: 50%;
transform: translateX(-50%);
width: 110px;
height: 110px;
border-radius: 50%;
object-fit: cover;
border: 2px solid var(--accent);
box-shadow:
0 8px 24px -4px rgba(0, 0, 0, 0.6),
0 0 0 4px rgba(255, 255, 255, 0.12);
background: var(--panel);
opacity: 0;
transition: opacity 320ms ease;
animation: preview-breathe 2.4s ease-in-out infinite;
}
.build-preview.show {
opacity: 1;
}
@keyframes preview-breathe {
0%,
100% {
box-shadow:
0 8px 24px -4px rgba(0, 0, 0, 0.6),
0 0 0 4px rgba(255, 255, 255, 0.12);
}
50% {
box-shadow:
0 8px 24px -4px rgba(0, 0, 0, 0.6),
0 0 0 9px rgba(255, 255, 255, 0.06);
}
}
.build-veil {
position: absolute;
inset: 0;
display: flex;
align-items: flex-end;
justify-content: center;
padding-bottom: 18px;
background: linear-gradient(
to bottom,
rgba(5, 6, 10, 0.05),
rgba(5, 6, 10, 0.45) 65%
);
pointer-events: none;
}
.build-ring {
width: 36px;
height: 36px;
border-radius: 50%;
border: 2.5px solid rgba(255, 255, 255, 0.15);
border-top-color: var(--accent);
animation: build-spin 1s linear infinite;
}
@keyframes build-spin {
to {
transform: rotate(360deg);
}
}
.build-error {
display: none;
padding: 12px 14px;
background: rgba(239, 77, 77, 0.08);
border: 1px solid var(--danger-dim);
border-radius: 9px;
color: #f4b5b5;
font-size: 13.5px;
margin: 0 0 16px;
}
.build-error.show {
display: block;
}
.build-retry {
width: 100%;
max-width: 320px;
margin: 0 auto;
display: none;
padding: 12px 18px;
background: var(--panel);
border: 1px solid var(--border);
border-radius: 10px;
color: var(--text);
font: 600 14px/1 inherit;
cursor: pointer;
text-align: center;
}
.build-retry.show {
display: block;
}
.build-retry:hover {
border-color: var(--border-strong);
}
.build-step {
transition: opacity 200ms;
}
.build-step.completed {
opacity: 0.65;
}
.build-step.active {
opacity: 1;
}
/* ── Step 4: Done ─────────────────────────────────────────────────── */
[data-step='done'] h1 {
text-align: center;
}
[data-step='done'] .sub {
text-align: center;
}
.done-viewer {
position: relative;
width: 100%;
max-width: 320px;
margin: 0 auto 24px;
aspect-ratio: 3 / 4;
border-radius: 16px;
overflow: hidden;
background: var(--panel);
border: 1px solid var(--border);
}
.done-viewer::after {
content: '';
position: absolute;
inset: -2px;
border-radius: 18px;
background: conic-gradient(
from 0deg,
var(--accent),
rgba(136, 136, 136, 0.3),
var(--accent),
rgba(136, 136, 136, 0.3)
);
z-index: -1;
animation: done-glow 6s linear infinite;
opacity: 0.35;
}
@keyframes done-glow {
to {
transform: rotate(360deg);
}
}
.done-viewer model-viewer {
width: 100%;
height: 100%;
--poster-color: transparent;
}
/* Skeleton shimmer while the GLB streams in. */
.done-viewer.loading::before {
content: '';
position: absolute;
inset: 0;
z-index: 1;
background: linear-gradient(
100deg,
var(--panel) 30%,
rgba(255, 255, 255, 0.06) 50%,
var(--panel) 70%
);
background-size: 200% 100%;
animation: done-shimmer 1.4s ease-in-out infinite;
}
@keyframes done-shimmer {
to {
background-position: -200% 0;
}
}
/* GLB failed to load — show a recoverable message, never a black void. */
.done-viewer.failed::before {
content: 'Preview unavailable — open your avatar to view it.';
position: absolute;
inset: 0;
z-index: 1;
display: flex;
align-items: center;
justify-content: center;
text-align: center;
padding: 24px;
color: var(--muted);
font-size: 13px;
line-height: 1.5;
}
.name-row {
margin: 0 0 20px;
}
.name-input {
width: 100%;
padding: 12px 14px;
background: var(--panel);
border: 1px solid var(--border-strong);
border-radius: 10px;
color: var(--text);
font: 15px/1 inherit;
outline: none;
transition: border-color 120ms;
}
.name-input:focus {
border-color: var(--accent);
}
.name-input::placeholder {
color: var(--muted);
}
.done-actions {
display: flex;
flex-direction: column;
gap: 10px;
}
.btn-save {
width: 100%;
padding: 14px 18px;
background: var(--accent);
color: var(--accent-ink);
border: none;
border-radius: 10px;
font: 600 15px/1 inherit;
cursor: pointer;
transition: filter 120ms;
}
.btn-save:hover {
filter: brightness(1.06);
}
.btn-save:disabled {
opacity: 0.55;
cursor: not-allowed;
filter: none;
}
.btn-ghost {
width: 100%;
padding: 12px 18px;
background: var(--panel);
color: var(--muted);
border: 1px solid var(--border);
border-radius: 10px;
font: 500 14px/1 inherit;
cursor: pointer;
transition:
color 120ms,
border-color 120ms;
}
.btn-ghost:hover {
color: var(--text);
border-color: var(--border-strong);
}
.portability-note {
margin-top: 24px;
padding: 14px 16px;
background: rgba(255, 255, 255, 0.04);
border: 1px solid rgba(255, 255, 255, 0.12);
border-radius: 10px;
font-size: 13px;
color: var(--muted);
display: flex;
align-items: center;
justify-content: space-between;
gap: 12px;
flex-wrap: wrap;
}
.portability-note a {
color: var(--accent);
text-decoration: none;
white-space: nowrap;
font-weight: 500;
}
.portability-note a:hover {
text-decoration: underline;
}
.submit-bar {
margin-top: 6px;
position: sticky;
bottom: 16px;
z-index: 2;
}
.submit-bar[hidden] {
display: none;
}
#submit-btn {
width: 100%;
padding: 16px 18px;
background: var(--panel);
color: var(--muted);
border: 1px solid var(--border);
border-radius: 12px;
font: 600 15px/1.2 inherit;
cursor: not-allowed;
transition:
background 120ms,
color 120ms,
border-color 120ms;
display: flex;
align-items: center;
justify-content: center;
gap: 10px;
}
#submit-btn .meta {
font: 500 12px/1 inherit;
color: var(--muted);
opacity: 0.85;
}
#submit-btn.ready {
background: var(--accent);
color: var(--accent-ink);
border-color: var(--accent);
cursor: pointer;
box-shadow: 0 10px 30px -10px rgba(255, 255, 255, 0.25);
animation: btn-ready 300ms ease;
}
@keyframes btn-ready {
from {
transform: scale(0.97);
opacity: 0.8;
}
to {
transform: scale(1);
opacity: 1;
}
}
#submit-btn.ready .meta {
color: rgba(10, 10, 10, 0.7);
}
#submit-btn.ready:hover {
filter: brightness(0.92);
}
/* The camera is a full-screen modal, so it has to sit above the corner
stack (helper widgets, language switcher, getting-started pill),
which mounts at --z-corner-stack. At the old z-index of 1000 that
stack rendered ON TOP of the capture bar and, being fixed to the
bottom edge on phones, swallowed taps meant for the shutter and
Cancel. --z-overlay-modal is the platform's own token for exactly
this layer (public/corner-stack.js defines the ladder). */
#cam-overlay {
position: fixed;
inset: 0;
background: #000;
z-index: var(--z-overlay-modal, 2147483600);
display: none;
flex-direction: column;
}
#cam-overlay.open {
display: flex;
}
/* The action groups use display:contents so their buttons join the
.cam-bar flex row directly. An inline display:contents would beat
the UA's [hidden]{display:none}, which left the review buttons
visible during live capture (and vice versa); scoping both rules
here keeps `hidden` authoritative. */
#cam-actions-live,
#cam-actions-review {
display: contents;
}
#cam-actions-live[hidden],
#cam-actions-review[hidden] {
display: none;
}
#cam-stage {
position: relative;
flex: 1;
min-height: 0;
overflow: hidden;
}
#cam-stage video,
#cam-stage img.preview {
width: 100%;
height: 100%;
object-fit: cover;
}
#cam-stage video {
transform: scaleX(-1);
}
#cam-mesh-overlay {
position: absolute;
inset: 0;
width: 100%;
height: 100%;
object-fit: cover;
transform: scaleX(-1);
pointer-events: none;
z-index: 1;
}
.cam-badges {
position: absolute;
top: env(safe-area-inset-top, 12px);
left: 12px;
right: 12px;
display: flex;
gap: 5px;
flex-wrap: wrap;
z-index: 3;
padding-top: 50px;
}
/* Chips sit directly on the camera feed, which can be anything from a
dark room to a blown-out window. They keep an opaque dark base in
every state so the live verdict stays readable against both. */
.cam-badge-chip {
font-size: 10.5px;
font-weight: 600;
padding: 3px 8px;
border-radius: 6px;
letter-spacing: 0.03em;
text-transform: uppercase;
background: rgba(0, 0, 0, 0.62);
border: 1px solid rgba(255, 255, 255, 0.14);
color: rgba(255, 255, 255, 0.62);
backdrop-filter: blur(6px);
}
.cam-badge-chip.ok {
color: var(--accent);
border-color: rgba(255, 255, 255, 0.35);
background: rgba(0, 0, 0, 0.62);
}
.cam-badge-chip.bad {
color: #ff8b8b;
border-color: rgba(255, 107, 107, 0.55);
background: rgba(74, 12, 12, 0.72);
}
.cam-prompt {
position: absolute;
top: env(safe-area-inset-top, 18px);
left: 0;
right: 0;
text-align: center;
color: rgba(255, 255, 255, 0.92);
font-size: 13px;
letter-spacing: 0.06em;
text-transform: uppercase;
padding: 16px 18px;
background: linear-gradient(to bottom, rgba(0, 0, 0, 0.5), transparent);
pointer-events: none;
}
.cam-prompt strong {
font-weight: 600;
color: var(--accent);
}
.cam-oval {
position: absolute;
inset: 0;
pointer-events: none;
display: flex;
align-items: center;
justify-content: center;
}
.cam-oval svg {
width: min(70vw, 60vh);
height: auto;
max-height: 75vh;
}
.cam-oval ellipse {
fill: none;
stroke: rgba(255, 255, 255, 0.45);
stroke-width: 3;
stroke-dasharray: 12 8;
transition: stroke 200ms;
}
.cam-oval.detected ellipse {
stroke: var(--accent);
stroke-dasharray: 0;
filter: drop-shadow(0 0 8px rgba(255, 255, 255, 0.4));
}
/* The retake prompt is the whole point of the gates, so it cannot wash
out against a bright frame: it carries its own scrim rather than
relying on the underlying image being dark. */
.cam-hint {
position: absolute;
bottom: 100px;
left: 12px;
right: 12px;
width: fit-content;
max-width: calc(100% - 24px);
margin: 0 auto;
text-align: center;
color: #fff;
font-size: 13px;
line-height: 1.4;
padding: 8px 14px;
border-radius: 10px;
background: rgba(0, 0, 0, 0.62);
backdrop-filter: blur(6px);
pointer-events: none;
transition: opacity 200ms;
}
.cam-hint.ok {
color: var(--accent);
}
#cam-error {
position: absolute;
top: 60px;
left: 16px;
right: 16px;
padding: 10px 14px;
background: rgba(239, 77, 77, 0.92);
color: white;
border-radius: 9px;
font-size: 13.5px;
text-align: center;
}
#cam-review-verdict {
text-align: center;
color: rgba(255, 255, 255, 0.85);
font-size: 13px;
line-height: 1.45;
padding: 10px 18px 0;
background: rgba(0, 0, 0, 0.7);
}
#cam-review-verdict.ok {
color: var(--accent);
}
#cam-review-verdict.warn {
color: #ffc46b;
}
#cam-review-verdict.bad {
color: #ff6b6b;
}
.cam-bar button:disabled {
opacity: 0.35;
cursor: not-allowed;
}
.cam-bar {
padding: 16px 22px calc(env(safe-area-inset-bottom, 18px) + 18px);
background: rgba(0, 0, 0, 0.7);
display: flex;
align-items: center;
justify-content: space-between;
gap: 16px;
}
.cam-bar button {
background: rgba(255, 255, 255, 0.08);
color: var(--text);
border: 1px solid rgba(255, 255, 255, 0.18);
border-radius: 9px;
padding: 10px 16px;
font: 600 14px/1 inherit;
cursor: pointer;
min-width: 88px;
}
.cam-bar button.shutter {
width: 72px;
height: 72px;
border-radius: 50%;
background: var(--accent);
color: var(--accent-ink);
border: none;
padding: 0;
min-width: 72px;
}
.cam-bar button.shutter::before {
content: '';
display: block;
width: 56px;
height: 56px;
border-radius: 50%;
border: 3px solid var(--accent-ink);
margin: 0 auto;
}
.cam-bar button.shutter:disabled {
opacity: 0.35;
cursor: not-allowed;
filter: grayscale(0.6);
transition:
opacity 200ms,
filter 200ms;
}
.cam-bar .spacer {
flex: 1;
}
.cam-countdown {
position: absolute;
inset: 0;
display: none;
align-items: center;
justify-content: center;
pointer-events: none;
z-index: 4;
}
.cam-countdown.show {
display: flex;
}
.cam-countdown .count-num {
font:
700 96px/1 -apple-system,
BlinkMacSystemFont,
'Segoe UI',
sans-serif;
color: var(--accent);
text-shadow:
0 4px 18px rgba(0, 0, 0, 0.6),
0 0 24px rgba(255, 255, 255, 0.4);
animation: cd-pop 1s ease-out forwards;
}
@keyframes cd-pop {
0% {
transform: scale(0.5);
opacity: 0;
}
20% {
transform: scale(1.15);
opacity: 1;
}
80% {
transform: scale(1);
opacity: 1;
}
100% {
transform: scale(0.8);
opacity: 0;
}
}
.done-actions .btn-secondary {
width: 100%;
padding: 12px 18px;
background: transparent;
color: var(--text);
border: 1px solid var(--accent);
border-radius: 10px;
font: 600 14px/1 inherit;
cursor: pointer;
transition: background 120ms;
}
.done-actions .btn-secondary:hover {
background: rgba(255, 255, 255, 0.06);
}
.quality-notice {
display: flex;
align-items: flex-start;
gap: 10px;
margin: 16px 0 0;
padding: 12px 14px;
border-radius: 10px;
font-size: 13px;
line-height: 1.45;
border: 1px solid var(--border-strong);
background: rgba(255, 255, 255, 0.03);
color: var(--text);
animation: qn-in 240ms ease;
}
.quality-notice[hidden] {
display: none;
}
.quality-notice.warn {
border-color: rgba(245, 200, 90, 0.34);
background: rgba(245, 200, 90, 0.08);
color: #f3d79b;
}
.quality-notice.good {
border-color: rgba(110, 220, 150, 0.34);
background: rgba(110, 220, 150, 0.08);
color: #a7e3bf;
}
.quality-notice .qn-icon {
flex-shrink: 0;
width: 16px;
height: 16px;
margin-top: 1px;
border-radius: 50%;
background: currentColor;
position: relative;
opacity: 0.9;
}
.quality-notice.warn .qn-icon::after {
content: '!';
position: absolute;
inset: 0;
display: flex;
align-items: center;
justify-content: center;
font: 700 11px/1 sans-serif;
color: #1a1400;
}
.quality-notice.good .qn-icon::after {
content: '';
position: absolute;
left: 5px;
top: 2px;
width: 4px;
height: 8px;
border: 2px solid #06140b;
border-top: none;
border-left: none;
transform: rotate(45deg);
}
@keyframes qn-in {
from { opacity: 0; transform: translateY(-4px); }
to { opacity: 1; transform: translateY(0); }
}
.photo-tips {
margin: 16px 0 0;
padding: 12px 16px;
background: rgba(255, 255, 255, 0.03);
border: 1px solid rgba(255, 255, 255, 0.08);
border-radius: 10px;
font-size: 13px;
color: var(--muted);
}
.photo-tips .tips-title {
margin: 0 0 6px;
font-weight: 600;
font-size: 12px;
letter-spacing: 0.04em;
text-transform: uppercase;
color: var(--text);
opacity: 0.7;
}
.photo-tips ul {
margin: 0;
padding-left: 18px;
list-style: disc;
}
.photo-tips li {
margin-bottom: 2px;
line-height: 1.45;
}
.photo-tips li:last-child {
margin-bottom: 0;
}
</style>
<link rel="stylesheet" href="/mobile.css" />
<script
type="module"
src="https://cdn.jsdelivr.net/npm/@google/[email protected]/dist/model-viewer.min.js"
integrity="sha384-wjsPzEO+lXOf7d9csIDfAQpPt2OKuUU3m0K9qsdKIuzX4N8czSF6hdh23eAbZa3p"
crossorigin="anonymous"
></script>
<link rel="canonical" href="https://three.ws/create/selfie" />
<meta name="twitter:card" content="summary_large_image" />
<meta name="twitter:title" content="Selfie to Avatar · three.ws" data-i18n-attr="content:create_selfie.meta_twitter_title"/>
<meta
name="twitter:description"
content="One selfie. About a minute. A rigged 3D avatar that works everywhere."
data-i18n-attr="content:create_selfie.meta_twitter_description"/>
<meta name="twitter:image" content="https://three.ws/api/page-og?s=build&t=Selfie+to+Avatar&d=One+selfie.+About+a+minute.+A+rigged+3D+avatar+that+works+everywhere.&p=%2Fcreate%2Fselfie" />
<script type="application/ld+json">
{
"@context": "https://schema.org",
"@type": "WebPage",
"name": "Selfie to Avatar",
"description": "One selfie. About a minute. A rigged 3D avatar that works everywhere.",
"url": "https://three.ws/create/selfie",
"isPartOf": { "@type": "WebSite", "name": "three.ws", "url": "https://three.ws" }
}
</script>
<meta property="og:locale" content="en_US">
<meta property="og:image:alt" content="Selfie to Avatar — three.ws">
<meta name="twitter:site" content="@trythreews">
<script src="/model-viewer-meshopt.js"></script>
</head>
<body>
<main class="stage">
<div class="topbar">
<button class="back" id="back-btn" aria-label="Back" type="button" data-i18n-attr="aria-label:create_selfie.back_arialabel">
<svg
width="16"
height="16"
viewBox="0 0 24 24"
fill="none"
stroke="currentColor"
stroke-width="2.2"
stroke-linecap="round"
stroke-linejoin="round"
aria-hidden="true"
>
<line x1="19" y1="12" x2="5" y2="12" />
<polyline points="12 19 5 12 12 5" />
</svg>
</button>
<div class="label"><strong data-i18n="create_selfie.three_ws">three.ws</strong> · Selfie to avatar</div>
</div>
<p id="unsupported-msg" class="unsupported" data-i18n="create_selfie.your_browser_can_t_open_the_camera">
Your browser can't open the camera here — use Upload instead, or open this page in
Safari / Chrome on a device with a camera.
</p>
<!-- Step 1: capture (entry) -->
<section class="step active" data-step="capture">
<h1 data-i18n="create_selfie.one_selfie_one_avatar">One selfie. One avatar.</h1>
<p class="sub" data-i18n="create_selfie.front_facing_good_light_plain_background_we">
Front-facing, good light, plain background. We downscale and upload locally —
your photo never sits on disk.
</p>
<p class="alt-path" data-i18n-html="create_selfie.prefer_your_camera_live_use_camera_below">
Prefer to scan yourself live? Use camera below opens your webcam and
reconstructs you from the shot you take. Photographing an object instead of
yourself? <a href="/image-to-3d">Image to 3D</a> turns any photo into a
textured model.
</p>
<div class="hero-slot-wrap">
<div
class="hero-slot"
data-slot="frontal"
role="button"
tabindex="0"
aria-label="Front-facing photo"
>
<span class="hero-icon" aria-hidden="true">👤</span>
<span class="hero-title" data-i18n="create_selfie.add_a_front_facing_photo">Add a front-facing photo</span>
<span class="hero-sub"
data-i18n="create_selfie.tap_to_open_camera_or_upload_works">Tap to open camera or upload — works on phone or desktop.</span
>
</div>
<div class="hero-actions">
<button
type="button"
class="hero-pill"
data-action="open-camera"
id="hero-camera-btn"
>
<svg
width="14"
height="14"
viewBox="0 0 24 24"
fill="none"
stroke="currentColor"
stroke-width="2"
stroke-linecap="round"
stroke-linejoin="round"
aria-hidden="true"
>
<path
d="M23 19a2 2 0 0 1-2 2H3a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h4l2-3h6l2 3h4a2 2 0 0 1 2 2z"
/>
<circle cx="12" cy="13" r="4" />
</svg>
Use camera
</button>
<button type="button" class="hero-pill" data-action="open-upload">
<svg
width="14"
height="14"
viewBox="0 0 24 24"
fill="none"
stroke="currentColor"
stroke-width="2"
stroke-linecap="round"
stroke-linejoin="round"
aria-hidden="true"
>
<path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4" />
<polyline points="17 8 12 3 7 8" />
<line x1="12" y1="3" x2="12" y2="15" />
</svg>
Upload photo
</button>
</div>
</div>
<input
type="file"
data-slot-input="frontal"
accept="image/jpeg,image/png,image/webp,image/heic,image/heif"
hidden
/>
<div class="quality-notice" id="quality-notice" role="status" aria-live="polite" hidden>
<span class="qn-icon" aria-hidden="true"></span>
<span class="qn-text"></span>
</div>
<div class="photo-tips" id="photo-tips">
<p class="tips-title" data-i18n="create_selfie.tips_for_best_results">Tips for best results</p>
<ul>
<li data-i18n="create_selfie.face_the_camera_directly_no_extreme_angles">Face the camera directly — no extreme angles</li>
<li data-i18n="create_selfie.good_even_lighting_avoid_harsh_shadows_or">Good, even lighting — avoid harsh shadows or backlighting</li>
<li data-i18n="create_selfie.remove_sunglasses_masks_or_anything_covering">Remove sunglasses, masks, or anything covering your face</li>
<li data-i18n="create_selfie.keep_hair_away_from_your_forehead_and">Keep hair away from your forehead and jawline if possible</li>
</ul>
</div>
<details class="fidelity" id="fidelity-boost">
<summary>
<div>
<div class="fid-label">
Add side angles
<span class="fid-note" data-i18n="create_selfie.optional_adds_30s_for_more_detail">(optional — adds ~30s for more detail)</span>
</div>
</div>
<svg
class="fid-chev"
width="16"
height="16"
viewBox="0 0 24 24"
fill="none"
stroke="currentColor"
stroke-width="2.4"
stroke-linecap="round"
stroke-linejoin="round"
aria-hidden="true"
>
<polyline points="6 9 12 15 18 9" />
</svg>
</summary>
<div class="fid-body">
<div class="slots">
<div
class="slot-frame"
data-slot="left"
role="button"
tabindex="0"
aria-label="Left side photo slot"
>
<span class="slot-label" data-i18n="create_selfie.left">Left</span>
<span class="slot-hint" data-i18n="create_selfie.turn_45_left">Turn ~45° left</span>
</div>
<div
class="slot-frame"
data-slot="right"
role="button"
tabindex="0"
aria-label="Right side photo slot"
>
<span class="slot-label" data-i18n="create_selfie.right">Right</span>
<span class="slot-hint" data-i18n="create_selfie.turn_45_right">Turn ~45° right</span>
</div>
</div>
<input
type="file"
data-slot-input="left"
accept="image/jpeg,image/png,image/webp,image/heic,image/heif"
hidden
/>
<input
type="file"
data-slot-input="right"
accept="image/jpeg,image/png,image/webp,image/heic,image/heif"
hidden
/>
</div>
</details>
<div class="opts">
<div class="opt-group">
<p class="opt-label" data-i18n="create_selfie.style">Style</p>
<div class="style-grid" role="group" aria-label="Avatar style">
<button
type="button"
class="style-card"
data-type="v1"
aria-pressed="true"
data-i18n-html="create_selfie.photoreal_likeness_first_closest_to_how_you">
<span class="style-swatch photoreal" aria-hidden="true"></span>
<span>
<span class="style-title">Photoreal</span>
<span class="style-desc"
>Likeness-first. Closest to how you actually look.</span
>
</span>
</button>
<button
type="button"
class="style-card"
data-type="v2"
aria-pressed="false"
data-i18n-html="create_selfie.stylized_cleaner_cartoon_leaning_good_for_st">
<span class="style-swatch stylized" aria-hidden="true"></span>
<span>
<span class="style-title">Stylized</span>
<span class="style-desc"
>Cleaner, cartoon-leaning. Good for streaming + games.</span
>
</span>
</button>
</div>
</div>
<!-- No body-type picker, deliberately. The reconstruction engine
fits your face onto ONE shared template body today, so a
Masc/Femme toggle here would change nothing — and this page
shipped with exactly that: two buttons whose choice was sent,
accepted, and silently ignored (the worker's male/female
template files never existed). A control that does nothing is
worse than no control. Body choice returns for real when
reconstruction moves onto the parametric base (122 morph
sliders — gender, build, height), tracked in
docs/avatar-fidelity-program.md, Track 5. -->
</div>
<div id="submit-bar" class="submit-bar">
<button id="submit-btn" type="button" disabled data-i18n-html="create_selfie.add_a_photo_to_start">
<span class="label">Add a photo to start</span>
</button>
</div>
</section>
<!-- Step 3: Building your avatar -->
<section class="step" data-step="building">
<h1 data-i18n="create_selfie.building_your_avatar">Building your avatar…</h1>
<p class="sub" data-i18n="create_selfie.this_usually_takes_1_2_minutes_don">This usually takes 1–2 minutes. Don't close this tab.</p>
<div class="build-progress" role="list" aria-label="Build progress">
<div class="build-step completed" data-bstep="upload" role="listitem">
<span class="bstep-dot" aria-hidden="true"></span>
<span class="bstep-label" data-i18n="create_selfie.photos_uploaded">Photos uploaded</span>
</div>
<div class="build-step active" data-bstep="process" role="listitem">
<span class="bstep-dot" aria-hidden="true"></span>
<span class="bstep-label" id="build-status-text" aria-live="polite"
data-i18n="create_selfie.processing_your_face">Processing your face…</span
>
</div>
<div class="build-step" data-bstep="finish" role="listitem">
<span class="bstep-dot" aria-hidden="true"></span>
<span class="bstep-label" data-i18n="create_selfie.finishing_rig">Finishing rig</span>
</div>
</div>
<div class="build-viewer" aria-hidden="true">
<!-- loading="lazy": this viewer is decoration inside a hidden step.
It must not cost 748KB on first paint, so it only starts
fetching once the building step is actually shown. -->
<model-viewer
id="build-model"
src="/avatars/default.glb"
auto-rotate
rotation-per-second="12deg"
interaction-prompt="none"
disable-zoom
disable-pan
shadow-intensity="0.5"
environment-image="neutral"
exposure="0.9"
camera-orbit="0deg 78deg auto"
loading="lazy"
></model-viewer>
<img id="build-preview" class="build-preview" alt="" />
<div class="build-veil">
<div class="build-ring"></div>
</div>
</div>
<p id="build-error-msg" class="build-error" role="alert"></p>
<button id="build-retry-btn" class="build-retry" type="button" data-i18n="create_selfie.try_again">← Try again</button>
</section>
<!-- Step 4: Done -->
<section class="step" data-step="done">
<h1 data-i18n="create_selfie.your_avatar_is_ready">Your avatar is ready</h1>
<p class="sub" data-i18n="create_selfie.name_it_and_open_it_in_your">Name it and open it in your workspace.</p>
<div class="done-viewer">
<model-viewer
id="done-model"
auto-rotate
rotation-per-second="10deg"
interaction-prompt="none"
camera-controls
shadow-intensity="1.0"
shadow-softness="0.9"
environment-image="neutral"
exposure="1.5"
tone-mapping="aces"
camera-orbit="0deg 78deg auto"
loading="eager"
alt="Your new avatar"
></model-viewer>
</div>
<div class="name-row">
<input
type="text"
id="done-name"
class="name-input"
placeholder="Name your avatar"
maxlength="60"
autocomplete="off"
aria-label="Avatar name"
/>
</div>
<div class="done-actions">
<button id="done-save-btn" class="btn-save" type="button" data-i18n="create_selfie.open_my_avatar">
Open my avatar →
</button>
<button id="done-agent-btn" class="btn-secondary" type="button" data-i18n="create_selfie.turn_this_into_an_agent">
Turn this into an agent
</button>
<button id="done-list-btn" class="btn-secondary" type="button" data-i18n="create_selfie.list_on_marketplace">
List on marketplace
</button>
<button id="done-editor-btn" class="btn-ghost" type="button" data-i18n="create_selfie.customize_in_editor">
Customize in editor
</button>
<button id="done-regen-btn" class="btn-ghost" type="button" data-i18n="create_selfie.not_quite_right_try_again">
Not quite right — try again
</button>
</div>
<div class="portability-note">
<span data-i18n="create_selfie.this_avatar_works_in_any_three_ws">This avatar works in any three.ws-powered app.</span>
<a href="/docs/embedding" target="_blank" rel="noopener" data-i18n="create_selfie.learn_how_to_embed">Learn how to embed →</a>
</div>
</section>
</main>
<!-- Step "api-key" — shown when reconstruction requires a BYOK API key.
Displayed either at boot (BYOK mode, no cached key) or when the
selfie:needs-byok event fires mid-flow (no key was cached and the
platform has no configured backend). -->
<section class="step" data-step="api-key" hidden>
<style>
.byok-card {
max-width: 480px;
margin: 0 auto;
padding: 40px 24px;
}
.byok-card h1 {
font-size: 1.5rem;
font-weight: 700;
margin: 0 0 8px;
letter-spacing: -0.02em;
}
.byok-card .sub {
color: #9aa3b2;
margin: 0 0 32px;
font-size: 0.9rem;
}
.byok-provider-row {
display: flex;
gap: 12px;
margin-bottom: 24px;
}
.byok-provider-btn {
flex: 1;
padding: 14px 16px;
border: 1.5px solid var(--border, #222);
border-radius: 10px;
background: var(--panel-elev, #111);
color: var(--text, #e8e8e8);
cursor: pointer;
text-align: left;
transition: border-color 0.15s, background 0.15s;
font-size: 0.875rem;
}
.byok-provider-btn:hover {
border-color: #555;
background: var(--bg-1, #1a1a1a);
}
.byok-provider-btn.selected {
border-color: #fff;
background: #1c1c1c;
}
.byok-provider-btn .provider-name {
font-weight: 600;
display: block;
margin-bottom: 2px;
}
.byok-provider-btn .provider-desc {
color: #9aa3b2;
font-size: 0.78rem;
}
.byok-key-group {
position: relative;
margin-bottom: 20px;
}
.byok-key-input {
width: 100%;
padding: 12px 44px 12px 14px;
background: var(--panel-elev, #111);
border: 1.5px solid var(--border, #222);
border-radius: 8px;
color: var(--text, #e8e8e8);
font-size: 0.875rem;
font-family: 'SF Mono', 'Fira Mono', monospace;
outline: none;
box-sizing: border-box;
transition: border-color 0.15s;
}
.byok-key-input:focus {
border-color: #555;
}
.byok-key-input.invalid {
border-color: var(--danger, #f87171);
}
.byok-key-toggle {
position: absolute;
right: 12px;
top: 50%;
transform: translateY(-50%);
background: none;
border: none;
color: #666;
cursor: pointer;
padding: 4px;
font-size: 0.8rem;
}
.byok-key-toggle:hover { color: #aaa; }
.byok-hint {
font-size: 0.78rem;
color: #777;
margin-bottom: 20px;
}
.byok-hint a {
color: #9aa3b2;
text-decoration: underline;
}
.byok-hint a:hover { color: #e8e8e8; }
.byok-error {
font-size: 0.82rem;
color: var(--danger, #f87171);
margin-bottom: 12px;
display: none;
}
.byok-error.show { display: block; }
.byok-actions {
display: flex;
flex-direction: column;
gap: 10px;
}
.byok-submit {
width: 100%;
padding: 13px 20px;
background: #fff;
color: #000;
border: none;
border-radius: 8px;
font-size: 0.9rem;
font-weight: 600;
cursor: pointer;
transition: opacity 0.15s;
}
.byok-submit:disabled {
opacity: 0.45;
cursor: not-allowed;
}
.byok-divider {
text-align: center;
color: #555;
font-size: 0.78rem;
margin: 2px 0;
}
.byok-alt {
text-align: center;
font-size: 0.82rem;
color: #666;
}
.byok-alt a {
color: #9aa3b2;
text-decoration: underline;
}
.byok-alt a:hover { color: #e8e8e8; }
/* Reduced-motion: stop the build/preview/done loops and the countdown
pop. model-viewer auto-rotate is removed in JS when this matches. */
@media (prefers-reduced-motion: reduce) {
.build-ring, .build-preview, .bstep .dot, .done-viewer::after,
.done-viewer::before, .cd-num { animation: none !important; }
}
</style>
<div class="byok-card">
<h1 data-i18n="create_selfie.connect_your_3d_engine">Connect your 3D engine</h1>
<p class="sub" data-i18n="create_selfie.selfie_avatar_uses_a_professional_3d_ai">
Selfie → avatar uses a professional 3D AI API. Add your key to continue — it takes 30 seconds.
</p>
<!-- Provider selector -->
<div class="byok-provider-row" role="radiogroup" aria-label="Choose 3D engine">
<button
type="button"
class="byok-provider-btn selected"
data-byok-provider="meshy"
aria-pressed="true"
data-i18n-html="create_selfie.meshy_image_3d_90s_free_trial_credits">
<span class="provider-name">Meshy</span>
<span class="provider-desc">Image → 3D · ~90s · free trial credits</span>
</button>
<button
type="button"
class="byok-provider-btn"
data-byok-provider="tripo"
aria-pressed="false"
data-i18n-html="create_selfie.tripo_image_3d_60s_high_quality">
<span class="provider-name">Tripo</span>
<span class="provider-desc">Image → 3D · ~60s · high quality</span>
</button>
</div>
<!-- Key input -->
<div class="byok-key-group">
<input
type="password"
id="byok-key-input"
class="byok-key-input"
placeholder="msy_…"
autocomplete="off"
spellcheck="false"
aria-label="API key"
/>
<button
type="button"
class="byok-key-toggle"
id="byok-key-toggle"
aria-label="Show key"
data-i18n="create_selfie.show" data-i18n-attr="aria-label:create_selfie.show_key_arialabel">show</button>
</div>
<p class="byok-hint" id="byok-key-hint" data-i18n-html="create_selfie.get_a_free_key_at_meshy_ai">
Get a free key at <a href="https://www.meshy.ai" target="_blank" rel="noopener">meshy.ai</a>
— it takes under a minute. The key stays in your browser and is never stored on our servers.
</p>
<p class="byok-error" id="byok-key-error" role="alert" aria-live="assertive"></p>
<div class="byok-actions">
<button type="button" class="byok-submit" id="byok-submit-btn" disabled data-i18n="create_selfie.continue">
Continue →
</button>
<div class="byok-divider">or</div>
<p class="byok-alt" data-i18n-html="create_selfie.already_saved_a_key_manage_keys_in">
Already saved a key?
<a href="/dashboard/api">Manage keys in settings →</a>
</p>
</div>
</div>
</section>
<!-- Camera overlay (driven by selfie-capture.js) -->
<div id="cam-overlay" role="dialog" aria-modal="true" aria-label="Camera capture">
<div id="cam-stage">
<video id="cam-video" autoplay playsinline muted></video>
<canvas id="cam-mesh-overlay" aria-hidden="true"></canvas>
<div class="cam-oval" id="cam-oval" aria-hidden="true">
<svg viewBox="0 0 300 400" preserveAspectRatio="xMidYMid meet">
<ellipse cx="150" cy="180" rx="115" ry="155" />
</svg>
</div>
<div class="cam-badges" id="cam-badges" aria-hidden="true"></div>
<div class="cam-hint" id="cam-hint">Center your face in the oval</div>
<div class="cam-countdown" id="cam-countdown" aria-hidden="true">
<span class="count-num" id="cam-count-num">3</span>
</div>
</div>
<div class="cam-prompt">Take your <strong id="cam-slot-name" data-i18n="create_selfie.photo">photo</strong></div>
<div id="cam-error" hidden></div>
<div id="cam-review-verdict" role="status" aria-live="polite" hidden></div>
<div class="cam-bar">
<div id="cam-actions-live">
<button type="button" data-cam-action="cancel" data-i18n="create_selfie.cancel">Cancel</button>
<button
type="button"
class="shutter"
data-cam-action="shoot"
aria-label="Take photo"
id="cam-shutter"
data-i18n-attr="aria-label:create_selfie.take_photo_arialabel"></button>
<div class="spacer"></div>
</div>
<div id="cam-actions-review" hidden>
<button type="button" data-cam-action="retake" data-i18n="create_selfie.retake">Retake</button>
<button type="button" data-cam-action="use" data-i18n="create_selfie.use_this">Use this</button>
</div>
</div>
</div>
<script type="module">
import { captureWizardReturn, pendingWizardReturn, clearWizardReturn, wizardReturnUrl } from '/src/shared/wizard-return.js';
// The /start wizard links here with ?next=; remember it so the finished
// avatar can be handed straight back into the setup flow.
captureWizardReturn();
function showStep(name) {
document.querySelectorAll('.step[data-step]').forEach((s) => {
const isTarget = s.dataset.step === name;
s.classList.toggle('active', isTarget);
s.hidden = !isTarget;
});
const sb = document.getElementById('submit-bar');
if (sb) sb.hidden = (name === 'api-key');
}
// Load config to find out if we're running in platform mode (server has
// API credentials) or BYOK mode (user must supply their own key).
const cfg = await fetch('/api/config', { credentials: 'omit' })
.then((r) => (r.ok ? r.json() : null))
.catch(() => null);
const reconstructMode = cfg?.features?.avatarReconstructMode ?? 'platform';
// Always load the camera + pipeline — they're needed regardless of mode.
await import('/src/selfie-capture.js');
const pipeline = await import('/src/selfie-pipeline.js');
// ── Photo quality feedback ────────────────────────────────────────────
// Assess each frontal photo the moment it's added so the user can swap a
// drawing / blurry / no-face shot BEFORE waiting out a full build.
const { assessPhoto } = await import('/src/selfie-refine.js');
const qNotice = document.getElementById('quality-notice');
let _qSeq = 0;
function showQuality(kind, text) {
if (!qNotice) return;
if (!text) {
qNotice.hidden = true;
return;
}
qNotice.classList.remove('warn', 'good');
if (kind) qNotice.classList.add(kind);
qNotice.querySelector('.qn-text').textContent = text;
qNotice.hidden = false;
}
async function bitmapFromFile(file) {
if (typeof createImageBitmap === 'function') {
try {
return await createImageBitmap(file);
} catch (_) {}
}
return await new Promise((resolve, reject) => {
const img = new Image();
img.onload = () => resolve(img);
img.onerror = () => reject(new Error('decode failed'));
img.src = URL.createObjectURL(file);
});
}
document.addEventListener('selfie:photo-added', async (e) => {
const { slot, file } = e.detail || {};
if (slot !== 'frontal' || !file) return;
const seq = ++_qSeq;
showQuality(null, 'Checking your photo…');
try {
const bmp = await bitmapFromFile(file);
const a = await assessPhoto(bmp);
try {
bmp.close?.();
} catch (_) {}
if (seq !== _qSeq) return; // a newer photo superseded this check
if (a.verdict === 'good') showQuality('good', 'Looks great — clear face, good framing.');
else showQuality('warn', a.message);
} catch (_) {
if (seq === _qSeq) showQuality(null, '');
}
});
// Re-surface warnings discovered during the (higher-res) submit pass.
document.addEventListener('selfie:quality', (e) => {
const warnings = e.detail?.warnings || [];
const frontal = warnings.find((w) => w.slot === 'frontal') || warnings[0];
if (frontal) showQuality('warn', frontal.message);
});
document.addEventListener('selfie:reset', () => showQuality(null, ''));
// ── BYOK key entry form wiring ────────────────────────────────────────
let _selectedProvider = 'meshy';
const PROVIDER_HINTS = {
meshy: 'Get a free key at <a href="https://www.meshy.ai" target="_blank" rel="noopener">meshy.ai</a> — it takes under a minute. The key stays in your browser and is never stored on our servers.',
tripo: 'Get a key at <a href="https://platform.tripo3d.ai" target="_blank" rel="noopener">platform.tripo3d.ai</a>. The key stays in your browser and is never stored on our servers.',
};
const PROVIDER_PLACEHOLDERS = {
meshy: 'msy_…',
tripo: 'tripo_…',
};
document.querySelectorAll('[data-byok-provider]').forEach((btn) => {
btn.addEventListener('click', () => {
_selectedProvider = btn.dataset.byokProvider;
document.querySelectorAll('[data-byok-provider]').forEach((b) => {
b.classList.toggle('selected', b.dataset.byokProvider === _selectedProvider);
b.setAttribute('aria-pressed', String(b.dataset.byokProvider === _selectedProvider));
});
const keyInput = document.getElementById('byok-key-input');
if (keyInput) keyInput.placeholder = PROVIDER_PLACEHOLDERS[_selectedProvider] || '';
const hint = document.getElementById('byok-key-hint');
if (hint) hint.innerHTML = PROVIDER_HINTS[_selectedProvider] || '';
validateByokKey();
});
});
const byokInput = document.getElementById('byok-key-input');
const byokSubmit = document.getElementById('byok-submit-btn');
const byokToggle = document.getElementById('byok-key-toggle');
const byokError = document.getElementById('byok-key-error');
function validateByokKey() {
const val = byokInput?.value?.trim() || '';
const valid = val.length > 8;
if (byokSubmit) byokSubmit.disabled = !valid;
return valid;
}
byokInput?.addEventListener('input', () => {
validateByokKey();
byokInput.classList.remove('invalid');
if (byokError) { byokError.textContent = ''; byokError.classList.remove('show'); }
});
byokToggle?.addEventListener('click', () => {
const isHidden = byokInput?.type === 'password';
if (byokInput) byokInput.type = isHidden ? 'text' : 'password';
if (byokToggle) byokToggle.textContent = isHidden ? 'hide' : 'show';
});
byokSubmit?.addEventListener('click', () => {
const key = byokInput?.value?.trim() || '';
if (!key) return;
pipeline.storeByokKey(_selectedProvider, key);
showStep('capture');
});
// Handle the event the pipeline fires when no BYOK key is found mid-flow.
document.addEventListener('selfie:needs-byok', () => {
pipeline.clearStoredByokKey();
if (byokInput) { byokInput.value = ''; byokInput.type = 'password'; }
if (byokToggle) byokToggle.textContent = 'show';
if (byokError) {
byokError.textContent = 'No API key found. Enter your key to continue.';
byokError.classList.add('show');
}
validateByokKey();
showStep('api-key');
});
// ── Boot: decide first step ───────────────────────────────────────────
if (reconstructMode === 'byok') {
// Check if a key is already cached from a prior session visit.
const cached = pipeline.getStoredByokKey();
if (!cached) {
// No cached key → show the key entry form before the camera.
showStep('api-key');
}
// If there IS a cached key, the default 'capture' step is already active.
}
// In 'platform' mode the camera step is already the default active step.
let _avatarId = null;
let _wizardThumb = null;
let _modelUrl = null;
let _docTitleBase = document.title;
let _notifyPermission =
typeof Notification !== 'undefined' ? Notification.permission : 'denied';
// The build-step viewer is pure decoration (the placeholder avatar
// spinning behind the veil while reconstruction runs). If its GLB fetch
// fails (transient network drop, navigation mid-download), fall back to
// the designed state (the captured-photo preview and progress veil)
// instead of leaving a dead black canvas behind them.
document.getElementById('build-model')?.addEventListener('error', (e) => {
/** @type {HTMLElement} */ (e.currentTarget).style.visibility = 'hidden';
});
document.addEventListener('selfie:preview', (e) => {
const dataUrl = /** @type {CustomEvent} */ (e).detail?.dataUrl;
if (!dataUrl) return;
const img = /** @type {HTMLImageElement|null} */ (
document.getElementById('build-preview')
);
if (!img) return;
img.src = dataUrl;
requestAnimationFrame(() => img.classList.add('show'));
});
document.addEventListener('selfie:building', () => {
showStep('building');
// Ask for notification permission once, while the user is engaged — so
// when they switch tabs mid-build we can ping them back.
if (typeof Notification !== 'undefined' && _notifyPermission === 'default') {
Notification.requestPermission()
.then((p) => {
_notifyPermission = p;
})
.catch(() => {});
}
});
document.addEventListener('selfie:progress', (e) => {
const label = /** @type {CustomEvent} */ (e).detail?.label;
if (!label) return;
const el = document.getElementById('build-status-text');
if (el) el.textContent = label;
// Advance the step indicator to "finish" on later attempts
const processStep = document.querySelector('.build-step[data-bstep="process"]');
const finishStep = document.querySelector('.build-step[data-bstep="finish"]');
if (label.toLowerCase().includes('finish') || label.toLowerCase().includes('rig')) {
processStep?.classList.replace('active', 'completed');
finishStep?.classList.add('active');
}
});
document.addEventListener('selfie:done', async (e) => {
_avatarId = /** @type {CustomEvent} */ (e).detail?.avatarId;
if (!_avatarId) return;
document.querySelectorAll('.build-step').forEach((s) => {
s.className = 'build-step completed';
});
// Mid-wizard: the primary action is to take this avatar back to /start.
const wizardNext = pendingWizardReturn();
if (wizardNext && !document.getElementById('done-wizard-btn')) {
const actions = document.querySelector('.done-actions');
const wizardBtn = document.createElement('button');
wizardBtn.id = 'done-wizard-btn';
wizardBtn.type = 'button';
wizardBtn.className = 'btn-save';
wizardBtn.textContent = 'Use this avatar and continue setup →';
wizardBtn.addEventListener('click', async () => {
if (!_avatarId) return;
wizardBtn.disabled = true;
wizardBtn.textContent = 'Back to setup…';
const nameEl = /** @type {HTMLInputElement|null} */ (document.getElementById('done-name'));
const name = nameEl?.value?.trim();
if (name) {
try {
await fetch(`/api/avatars/${encodeURIComponent(_avatarId)}`, {
method: 'PATCH',
credentials: 'include',
headers: { 'content-type': 'application/json' },
body: JSON.stringify({ name }),
});
} catch (_) {}
}
clearWizardReturn();
window.location.assign(wizardReturnUrl(wizardNext, {
avatarId: _avatarId,
avatarName: name || '',
avatarThumb: _wizardThumb || '',
}));
});
actions?.prepend(wizardBtn);
const saveBtn = document.getElementById('done-save-btn');
if (saveBtn) saveBtn.className = 'btn-secondary';
}
const viewer = document.querySelector('.done-viewer');
viewer?.classList.add('loading');
viewer?.classList.remove('failed');
try {
const res = await fetch(`/api/avatars/${encodeURIComponent(_avatarId)}`, {
credentials: 'include',
});
if (res.ok) {
// The API wraps the record: { avatar: { model_url, name, ... } }.
const { avatar } = await res.json();
const modelEl = document.getElementById('done-model');
const modelUrl = avatar?.model_url || avatar?.url;
_modelUrl = modelUrl || null;
_wizardThumb = avatar?.thumbnail_url || null;
if (modelEl && modelUrl) {
modelEl.addEventListener(
'load',
() => viewer?.classList.remove('loading'),
{ once: true },
);
modelEl.addEventListener(
'error',
() => {
viewer?.classList.remove('loading');
viewer?.classList.add('failed');
},
{ once: true },
);
if (window.matchMedia?.('(prefers-reduced-motion: reduce)').matches) {
modelEl.removeAttribute('auto-rotate');
}
modelEl.setAttribute('src', modelUrl);
} else {
// Materialized but no GLB URL — don't leave a silent black void.
viewer?.classList.remove('loading');
viewer?.classList.add('failed');
}
const nameEl = /** @type {HTMLInputElement|null} */ (
document.getElementById('done-name')
);
if (nameEl && avatar?.name) nameEl.value = avatar.name;
} else {
viewer?.classList.remove('loading');
viewer?.classList.add('failed');
}
} catch (_) {
viewer?.classList.remove('loading');
viewer?.classList.add('failed');
}
notifyDone();
showStep('done');
});
function notifyDone() {
// Page-visible: nothing to do. Page-hidden: flash the title and fire a
// real OS-level notification if the user granted permission.
if (!document.hidden) return;
let on = true;
const tick = window.setInterval(() => {
document.title = on ? '✓ Avatar ready — three.ws' : _docTitleBase;
on = !on;
}, 900);
const restore = () => {
clearInterval(tick);
document.title = _docTitleBase;
document.removeEventListener('visibilitychange', restore);
};
document.addEventListener('visibilitychange', restore);
if (_notifyPermission === 'granted' && typeof Notification !== 'undefined') {
try {
const n = new Notification('Your avatar is ready', {
body: 'Tap to open it on three.ws.',
icon: '/favicon.ico',
tag: 'avatar-ready',
});
n.onclick = () => {
window.focus();
n.close();
};
} catch (_) {}
}
}
document.addEventListener('selfie:build-error', (e) => {
const detail = /** @type {CustomEvent} */ (e).detail || {};
const msg = detail.message || 'Something went wrong. Try again.';
const errEl = document.getElementById('build-error-msg');
const retryBtn = document.getElementById('build-retry-btn');
if (errEl) {
errEl.textContent = msg;
errEl.classList.add('show');
}
if (retryBtn) retryBtn.classList.add('show');
// Stop the spinner and mark the active step as failed.
const ring = document.querySelector('.build-ring');
if (ring) ring.style.display = 'none';
const veil = document.querySelector('.build-veil');
if (veil) veil.style.display = 'none';
const activeStep = document.querySelector('.build-step.active');
if (activeStep) {
activeStep.classList.remove('active');
activeStep.classList.add('failed');
const label = activeStep.querySelector('.bstep-label');
if (label) label.textContent = 'Failed';
}
// Update the heading
const heading = document.querySelector('[data-step="building"] h1');
if (heading) heading.textContent = "Couldn't build your avatar";
const sub = document.querySelector('[data-step="building"] .sub');
if (sub) sub.textContent = 'Check the tips below and try again with a new photo.';
// If we can identify the failing slot, highlight it for retake.
if (detail.slot) {
const slotFrame = document.querySelector(
detail.slot === 'frontal'
? `.hero-slot[data-slot="${detail.slot}"]`
: `.slot-frame[data-slot="${detail.slot}"]`,
);
slotFrame?.classList.add('error');
if (detail.slot !== 'frontal') {
const fid = /** @type {HTMLDetailsElement|null} */ (
document.getElementById('fidelity-boost')
);
if (fid) fid.open = true;
}
}
});
document.getElementById('build-retry-btn')?.addEventListener('click', () => {
const errEl = document.getElementById('build-error-msg');
const retryBtn = document.getElementById('build-retry-btn');
errEl?.classList.remove('show');
retryBtn?.classList.remove('show');
// Reset the building step UI for next attempt.
const ring = document.querySelector('.build-ring');
if (ring) ring.style.display = '';
const veil = document.querySelector('.build-veil');
if (veil) veil.style.display = '';
const heading = document.querySelector('[data-step="building"] h1');
if (heading) heading.textContent = 'Building your avatar…';
const sub = document.querySelector('[data-step="building"] .sub');
if (sub) sub.textContent = "This usually takes 1–2 minutes. Don't close this tab.";
document.querySelectorAll('.build-step').forEach((s) => {
s.classList.remove('completed', 'active', 'failed');
});
const uploadStep = document.querySelector('.build-step[data-bstep="upload"]');
if (uploadStep) uploadStep.classList.add('completed');
const processStep = document.querySelector('.build-step[data-bstep="process"]');
if (processStep) processStep.classList.add('active');
const statusText = document.getElementById('build-status-text');
if (statusText) statusText.textContent = 'Processing your face…';
showStep('capture');
});
document.getElementById('done-list-btn')?.addEventListener('click', async () => {
if (!_avatarId) return;
const btn = /** @type {HTMLButtonElement} */ (
document.getElementById('done-list-btn')
);
btn.disabled = true;
btn.textContent = 'Saving…';
const nameEl = /** @type {HTMLInputElement|null} */ (
document.getElementById('done-name')
);
const name = nameEl?.value?.trim();
if (name) {
try {
await fetch(`/api/avatars/${encodeURIComponent(_avatarId)}`, {
method: 'PATCH',
credentials: 'include',
headers: { 'content-type': 'application/json' },
body: JSON.stringify({ name, visibility: 'public' }),
});
} catch (_) {}
}
window.location.assign(`/marketplace/avatars/${encodeURIComponent(_avatarId)}`);
});
document.getElementById('done-save-btn')?.addEventListener('click', async () => {
if (!_avatarId) return;
const btn = /** @type {HTMLButtonElement} */ (
document.getElementById('done-save-btn')
);
btn.disabled = true;
btn.textContent = 'Saving…';
const nameEl = /** @type {HTMLInputElement|null} */ (
document.getElementById('done-name')
);
const name = nameEl?.value?.trim();
if (name) {
try {
await fetch(`/api/avatars/${encodeURIComponent(_avatarId)}`, {
method: 'PATCH',
credentials: 'include',
headers: { 'content-type': 'application/json' },
body: JSON.stringify({ name }),
});
} catch (_) {}
}
window.location.assign(`/avatars/${encodeURIComponent(_avatarId)}`);
});
// Pipeline handoff: an avatar is only the first stage. Carry it straight
// into the agent builder with the body pre-selected, matching the
// marketplace "Start an agent with this avatar" hand-off.
document.getElementById('done-agent-btn')?.addEventListener('click', async () => {
if (!_avatarId) return;
const btn = /** @type {HTMLButtonElement} */ (
document.getElementById('done-agent-btn')
);
btn.disabled = true;
btn.textContent = 'Opening the agent builder…';
const nameEl = /** @type {HTMLInputElement|null} */ (
document.getElementById('done-name')
);
const name = nameEl?.value?.trim();
if (name) {
try {
await fetch(`/api/avatars/${encodeURIComponent(_avatarId)}`, {
method: 'PATCH',
credentials: 'include',
headers: { 'content-type': 'application/json' },
body: JSON.stringify({ name }),
});
} catch (_) {}
}
const params = new URLSearchParams({ avatar_id: _avatarId });
if (name) params.set('avatar_name', name);
if (_modelUrl) params.set('avatar_glb', _modelUrl);
window.location.assign(`/create-agent?${params.toString()}`);
});
document.getElementById('done-editor-btn')?.addEventListener('click', () => {
if (!_avatarId) return;
window.location.assign(`/avatars/${encodeURIComponent(_avatarId)}/edit`);
});
document.getElementById('done-regen-btn')?.addEventListener('click', () => {
// Drop the just-built avatar and reset the capture step. Photos in
// memory are gone; the user picks fresh ones. We don't delete the
// avatar row — they can still open it later from /dashboard.
_avatarId = null;
const preview = /** @type {HTMLImageElement|null} */ (
document.getElementById('build-preview')
);
if (preview) {
preview.removeAttribute('src');
preview.classList.remove('show');
}
document.dispatchEvent(new CustomEvent('selfie:reset'));
showStep('capture');
});
</script>
<script src="/brand.js" defer></script>
<script src="/getting-started.js" defer></script>
<!-- Runtime i18n: detects locale, swaps annotated copy, mounts <lang-switcher>. -->
<script type="module" src="/i18n.js"></script>
</body>
</html>