Skip to content

Web SDK: Options and results

The options create() and add() take, and what the scene reports.

CreateOptions

Options for SonaRenderer.create().

Field Type Meaning
canvas HTMLCanvasElement Your canvas. The SDK owns its WebGPU or WebGL2 context.
renderer (optional) 'auto' | 'webgpu' | 'webgl2' "auto": WebGPU on a hardware adapter, else WebGL2. "webgpu" or "webgl2" asks for one (SonaError "unsupported" when WebGPU is missing). The two draw the same pixels. Default "auto".
appId (optional) string Defaults to the app id this copy was built for.
host (optional) string Where assets come from. Default: the 360sona developer site (https://360sona.com).
loop (optional) 'auto' | 'manual' "auto": the SDK runs requestAnimationFrame. "manual": you call frame() from your loop; avatars build only inside frame(), so await scene.settle() (it draws frames) rather than avatar.ready alone. Default "auto".
pixelRatio (optional) number Device pixels per CSS pixel. Default min(2, devicePixelRatio).
supersample (optional) number Supersampling, 1 to 2. Default 1. Capped at 5.2 million pixels.
antialias (optional) boolean | 'auto' 4x multisampled edges. "auto" turns it off on software rasterisers (SwiftShader, llvmpipe), where each sample costs a full shade. Default "auto".
faceSize (optional) 128 | 256 | 512 | 'auto' Face sheet size per avatar. "auto": 512 for 1 to 4 avatars, 256 up to 32, 128 beyond. Default "auto".
faces (optional) 'animated' | 'still' "animated": faces follow each clip's expression track. "still": one face per avatar. Default "animated".
shadow (optional) boolean The key light shadow. Tuned for one figure near the origin. Default false.
background (optional) [number, number, number, number] Clear colour, premultiplied RGBA 0 to 1. Default [0, 0, 0, 0] (transparent).
credit (optional) 'bottom-right' | 'bottom-left' | 'top-right' | 'top-left' | false Where the credit badge sits. A small "Powered by 360sona" link, shown once an avatar is on screen. false hides it: then put the line in your credits, about page, footer or store page (Licence S2). Default "bottom-right".
buildBudgetMs (optional) number Milliseconds of avatar building allowed per frame. Default 6.
maxAvatars (optional) number Most avatars at once. Default 256, at most 1024.
pauseWhenHidden (optional) boolean Stop drawing while the canvas is off screen or the tab is hidden (auto loop only). Default true.
controls (optional) boolean | { drag?: boolean; zoom?: boolean; pitch?: boolean } Drag to turn the camera, and optionally scroll to zoom and drag up and down to tilt. Default false.

Placement

Where an avatar stands.

Field Type Meaning
position (optional) Vec3 World position in metres. Y is up. Default [0, 0, 0].
turn (optional) number Degrees about Y. 0 faces the default camera (towards -Z). Default 0.
scale (optional) number Uniform scale. Default 1.

AddOptions

Options for scene.add().

Field Type Meaning
clip (optional) ClipKey | null What to play once ready. Default "idle".
loop (optional) boolean Loop the clip. Default true.
speed (optional) number Playback speed. Default 1.
startAt (optional) number | 'random' Seconds into the clip, or "random" to desynchronise a crowd. Default 0.
visible (optional) boolean Draw it. Default true.
priority (optional) number Higher builds sooner. Default 0.

Vec3

type Vec3 = [number, number, number];

A point or direction in metres. Y is up; an avatar is about 1.8 tall.

ClipKey

type ClipKey = string;

A clip key from scene.clips() (for example "GenericWave" or "Stand0"), a raw clip id, "prop" (the held prop's own clip), "idle" (a quiet playlist) or "still" (hold the pose).

ClipInfo

One playable clip.

Field Type Meaning
key string The name to play it by, for example "GenericWave".
id string | null Its clip id, or null for "prop" (each prop has its own).
seconds number | null Its length in seconds where known; null in this release, which reads a clip's length only when it decodes it.
prop boolean True for "prop", the held prop's own clip.
caption string | null Its name in plain words where the clip table has one, else null.

FrameStats

What one frame did.

Field Type Meaning
ms number Wall time since the previous frame.
cpuMs number Time spent inside frame().
drawn number Avatars drawn.
culled number Avatars outside the view.
drawCalls number Draw calls in the main pass.
built number Build steps run this frame.

SceneStats

Rolling scene numbers.

Field Type Meaning
fps number Frames a second over the last two seconds.
msPerFrame number Milliseconds between frames, the mean over the last two seconds.
p95Ms number Milliseconds between frames that 95 of 100 frames beat, over the last two seconds.
cpuMsPerFrame number Milliseconds a frame spends inside frame(), the mean over the last two seconds.
avatars number Avatars in the scene, ready or not.
ready number Avatars built and shown.
queued number Avatars waiting to be built or loading.
drawn number Avatars drawn in the last frame.
drawCalls number Draw calls in the last frame's main pass.
geometries number Meshes held on the GPU.
textures number Textures held on the GPU.
gpuMB number MiB of GPU memory the scene's meshes and textures hold.
cpuMB number MiB of item files and decoded assets held in memory.
buildMsAvg number Milliseconds of a build step, the mean over the last 200.
buildMsMax number Milliseconds of the longest build step since the scene was made.
longFrames number Frames over the threshold of 33 ms in the last two seconds.

BenchStep

One row of the benchmark.

Field Type Meaning
avatars number Avatars in this step.
fps number Frames a second while they all played.
msPerFrame number Milliseconds between frames, the mean.
p95Ms number Milliseconds between frames that 95 of 100 frames beat.
cpuMsPerFrame number Milliseconds a frame spent inside frame(), the mean.
drawCalls number Draw calls in the last frame's main pass.
gpuMB number MiB of GPU memory the scene held.
ready number How many of the step's avatars were ready.
readyMs number Milliseconds from adding the step's avatars to the last one ready (at most 180,000).
buildMsMax number Milliseconds of the longest build step so far.

WardrobeItem

One wardrobe item, as scene.wardrobe() and the editor offer it.

Field Type Meaning
id string The item id.
name string Its name.
section string The editor section: shirt, trousers, shoes, costume (outfits), headwear, glasses, gloves, wristwear, ring, earrings, carryable (props), hair, eyes, eyebrows, mouth, facialHair, eyeShadow, facialFeature (face paint), chin, nose, ears, shape (a garment's body shape, listed only while worn, so it can be taken off) or animation. The editor's search of every item finds all of them; shape and animation items cannot be put on.
mask number The item type bits. 0x1000000 alone is a garment's body shape, offered only while worn.
kind number 1 a garment (body-specific), 2 a face texture, 3 a shape.
gender number | null For garments: 1 male body, 2 female body, 3 either, null not body-specific.
hidden boolean A duplicate of another item; offered only while worn.
stock boolean Part of the built-in wardrobe.
awarded boolean An award item.
game string | null The game an award or item came with, where known.
colours number How many colourways the item carries (scene.colourways gives them once it is loaded); 0 or 1 when it has no choice.
sub string | null The catalogue's subcategory name, where it has one; searched with the name.
slots readonly string[] The slots the item fills ("shirt", "trousers", ...).

This page as Markdown · All the docs as one file (llms-full.txt)