MCPcopy Index your code
hub / github.com/0xGF/avatar-3d

github.com/0xGF/avatar-3d @main

Chat with this repo
repository ↗ · DeepWiki ↗ · + Follow
98 symbols 221 edges 27 files 5 documented · 5%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

Avatar 3D

Generate interactive 3D avatars from a single photo using AI. Choose between cursor-tracking rotation or full 3D model export.

Features

  • Two Generation Modes:
  • Cursor Tracking - Generate a grid of head rotation frames for mouse-follow effect
  • 3D Model - Generate an actual GLB 3D model you can use in Blender, Unity, etc.
  • Pixar-Style Preprocessing - Photos are transformed into stylized 3D characters
  • Custom Style Prompts - Add accessories, change styles (cyberpunk, cartoon villain, etc.)
  • Export Options - Download GLB files, HTML embeds, individual frames, or React components

Inspiration

Inspired by Wes Bos's Eye Ballz project, which creates interactive eye-tracking avatars. This project extends the concept with AI-powered stylization and true 3D model generation.

How It Works

  1. Upload a photo with a face
  2. The app preprocesses your photo using google/nano-banana-pro to create a Pixar-style 3D character
  3. Based on your selected mode:
  4. Cursor Tracking: Generates a grid of images at different head angles using fofr/expression-editor
  5. 3D Model: Generates a GLB model using firtoz/trellis
  6. Preview and export your creation

Getting Started

Prerequisites

Installation

# Clone the repo
git clone https://github.com/0xGF/avatar-3d.git
cd avatar-3d

# Install dependencies
pnpm install

# Copy environment variables
cp .env.example .env.local

# Add your Replicate API token to .env.local
# REPLICATE_API_TOKEN=r8_xxxxx

# Run the dev server
pnpm dev

Open http://localhost:3000 in your browser.

Configuration

Cursor Tracking Mode

  • Horizontal/Vertical Steps: Number of images in each direction (5x5 = 25 frames)
  • Higher step counts = smoother rotation but more API calls

3D Model Mode

  • Texture Size: Resolution of the model texture (512-2048px)
  • Mesh Quality: Detail level of the 3D mesh (50-100%)

Cost Estimates

  • Preprocessing: ~$0.01 per image
  • Cursor Tracking: ~$0.01 per frame (5x5 grid ≈ $0.25)
  • 3D Model: ~$0.05-0.10 per generation

Tech Stack

Star History

Star History Chart

License

MIT

Extension points exported contracts — how you extend this code

Viewer3DProps (Interface)
(no doc)
src/components/Viewer3D.tsx
SavedRender (Interface)
(no doc)
src/lib/storage.ts
ImageUploadProps (Interface)
(no doc)
src/components/ImageUpload.tsx
UserSettings (Interface)
(no doc)
src/lib/storage.ts
RenderHistoryProps (Interface)
(no doc)
src/components/RenderHistory.tsx
GenerateImageOptions (Interface)
(no doc)
src/lib/replicate.ts
RenderCardProps (Interface)
(no doc)
src/components/RenderHistory.tsx
Step (Interface)
(no doc)
src/lib/types.ts

Core symbols most depended-on inside this repo

cn
called by 16
src/lib/utils.ts
fetchAsBuffer
called by 5
src/lib/replicate.ts
openDB
called by 4
src/lib/storage.ts
round
called by 4
src/lib/constants.ts
encodeSSE
called by 4
src/app/api/generate/stream/route.ts
getSavedRendersAsync
called by 3
src/lib/storage.ts
getReplicateClient
called by 3
src/lib/replicate.ts
toDataUri
called by 3
src/lib/replicate.ts

Shape

Function 75
Interface 23

Languages

TypeScript100%

Modules by API surface

src/lib/storage.ts17 symbols
src/lib/types.ts14 symbols
src/components/RenderHistory.tsx8 symbols
src/components/ExportModal.tsx8 symbols
src/lib/replicate.ts7 symbols
src/components/ui/card.tsx7 symbols
src/components/Viewer3D.tsx5 symbols
src/components/ModelViewer.tsx5 symbols
src/app/api/generate/stream/route.ts5 symbols
src/components/ui/tooltip.tsx4 symbols
src/lib/constants.ts3 symbols
src/components/ImageUpload.tsx2 symbols

For agents

$ claude mcp add avatar-3d \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact