Skip to main content

Scene Format

The Yugma scene format is JSON that describes all objects, transforms, materials, metadata, and relationships.

Top-Level Structure

{
"objects": { "id1": {...}, "id2": {...} },
"objectOrder": ["id1", "id2", "id3"],
"environment": {
"hdriPreset": "city",
"backgroundColor": "#1a1a2e",
"ambientIntensity": 0.4,
"fogEnabled": false,
"fogColor": "#000000",
"fogNear": 10,
"fogFar": 50
}
}

SceneObject (v1.5)

{
"id": "abc1234567",
"name": "wall_north",
"type": "box",
"visible": true,
"locked": false,
"castShadow": true,
"receiveShadow": true,
"tags": ["wall", "structural"],
"parentId": null,

"transform": {
"position": [0, 1.5, -5],
"rotation": [0, 0, 0],
"scale": [10, 3, 0.15]
},

"material": {
"color": "#808080",
"roughness": 0.9,
"metalness": 0.0,
"opacity": 1.0,
"wireframe": false,
"emissive": "#000000",
"emissiveIntensity": 0
},

"geometry": {
"width": 1,
"height": 1,
"depth": 1
},

"userData": { "customKey": "customValue" },
"semanticRole": "wall",
"relationships": {
"nextTo": ["def4567890"],
"supports": ["ghi7890123"]
},

"createdAt": 1712678400000,
"updatedAt": 1712678400000
}

Object Types

TypeDescriptionKey Geometry Params
boxRectangular prismwidth, height, depth
sphereUV sphereradius, widthSegments, heightSegments
cylinderCylinderradiusTop, radiusBottom, cylinderHeight
coneConeradius, cylinderHeight
torusDonuttorusRadius, tube, torusSegments
planeFlat planewidth, height
capsuleCapsuleradius, cylinderHeight
tetrahedronTetrahedronradius, detail
dodecahedronDodecahedronradius, detail
custom_gltfImported modelgltfUrl

Transform

  • position[x, y, z] in meters, world space, Y-up
  • rotation[x, y, z] in degrees, Euler XYZ order
  • scale[x, y, z] multiplier (1.0 = default)

Material

PropertyRangeDescription
colorhexBase color
roughness0.0–1.00 = mirror, 1 = chalk
metalness0.0–1.00 = plastic, 1 = metal
opacity0.0–1.0Transparency (glass ≈ 0.3)
emissivehexGlow color (#000000 = off)
emissiveIntensity0–10Glow strength
wireframebooleanWireframe rendering

YSL v1.5 Fields (Optional, Additive)

FieldTypeDescription
userDataRecord<string, unknown>Extension point for custom data
semanticRolestring"wall", "floor", "hero", "prop", "light-source"
relationships.parentOfstring[]IDs of child objects
relationships.nextTostring[]Adjacent objects
relationships.supportsstring[]Objects this one holds up
relationships.referencesstring[]Semantic references

All v1.5 fields are optional. Documents saved before v1.5 load unchanged — fields default to undefined.

Environment

FieldTypeDescription
hdriPresetstringcity, sunset, dawn, night, forest, studio, warehouse, apartment
backgroundColorhexScene background
ambientIntensitynumberAmbient light (0–2)
fogEnabledbooleanVolumetric fog
fogColorhexFog color
fogNear / fogFarnumberFog distance range

Storage

Firestore (Cloud)

Scenes are stored in projects/{projectId} with metadata:

{
"meta": { "name": "My Project", "ownerId": "firebase-uid" },
"scene": { "objects": {...}, "objectOrder": [...], "environment": {...} }
}

URL-encoded scenes using lz-string compression in the URL hash. Decoded client-side.

GLB Export

Scenes can be exported as GLB via the export menu or the exportScene Cloud Function.