Best practices for character and style reference images in realtime models
Reference images guide how realtime models transform your video. Lucy 2 uses them for character transformation — your face maps onto the reference identity. Mirage uses them for style guidance — the visual aesthetic of the reference carries into the output.This guide covers image requirements, best practices for character portraits, style references, and troubleshooting.
Upload a face photo and Lucy 2 maps your movements, expressions, and gestures onto that character in realtime. The reference image provides the visual identity — your camera provides the motion.
Copy
Ask AI
import { createDecartClient, models } from "@decartai/sdk";const client = createDecartClient({ apiKey: "your-api-key-here" });const model = models.realtime("lucy_2_rt");const stream = await navigator.mediaDevices.getUserMedia({ video: { frameRate: model.fps, width: model.width, height: model.height },});const realtimeClient = await client.realtime.connect(stream, { model, onRemoteStream: (s) => { document.getElementById("output").srcObject = s; },});// Upload a character referenceconst photo = document.querySelector("input[type=file]").files[0];await realtimeClient.set({ prompt: "Transform into this character", image: photo, enhance: true,});
Upload a style image and Mirage uses its visual aesthetic — colors, textures, lighting — to guide the transformation of your live stream.
You can change the reference image at any time without reconnecting. The transition is near-instant:
Copy
Ask AI
// Switch to a new characterconst newCharacter = document.querySelector("input[type=file]").files[0];await realtimeClient.set({ prompt: "Transform into this character", image: newCharacter, enhance: true,});// Or clear the reference entirely to fall back to text-only editingawait realtimeClient.set({ image: null });
Use set() when updating both the prompt and image together. This applies both changes atomically, avoiding intermediate states.
Character reference and text prompts work together. The reference sets the identity; the prompt adds modifications:
Copy
Ask AI
// Character reference + text modificationawait realtimeClient.set({ prompt: "Transform into this character, wearing a red cape", image: characterPhoto, enhance: true,});// Update just the prompt (keep the same character)await realtimeClient.set({ prompt: "Same character but in a dark room with dramatic lighting" });
// Set initial style with a reference imageconst styleRef = await fetch("/monet-painting.jpg").then((r) => r.blob());await realtimeClient.setImage(styleRef);// Combine with a text prompt for more controlrealtimeClient.setPrompt("Apply this painting style with warm golden lighting");
Remove the reference image to return to text-only editing:
Copy
Ask AI
// Clear the character referenceawait realtimeClient.set({ image: null });// Now text prompts apply directly to your camera feedawait realtimeClient.set({ prompt: "Add sunglasses" });