{
  "openapi": "3.1.1",
  "info": {
    "title": "Renderloom Scene to GLB API",
    "version": "1.0.0",
    "summary": "Export a Renderloom or Form Studio scene as a glTF 2.0 GLB with PBR materials.",
    "description": "Every endpoint performs the same calculation as the human page and returns inputs, result, units, assumptions, sources, warnings and computedAt. MCP endpoint: /mcp."
  },
  "servers": [
    {
      "url": "https://renderloomsceneglb.usefulweb.app"
    }
  ],
  "paths": {
    "/api/v1/calculate": {
      "post": {
        "operationId": "calculate",
        "summary": "Export a Renderloom or Form Studio scene as a glTF 2.0 GLB with PBR materials.",
        "description": "Convert a Renderloom scene, Kerfwise Form Studio project or render recipe into one GLB file: a node per solid grouped by tag with its position and rotation, metallic-roughness materials from colours and finishes, and optionally a Material Nodes PBR texture set (base colour, normal, occlusion-roughness-metallic) on all solids, one tag or one solid. The file is re-read by a strict GLB parser before download.\n\nMethodology:\n- The scene root node converts Renderloom millimetres with Z up to glTF metres with Y up (scale 0.001, −90° about X). Below it, one group node per tag holds one node per solid.\n- Each solid node carries its translation and its Z rotation and X/Y tilts as one quaternion (Z · Y · X, the Form Studio order), so the mesh is the untransformed extruded footprint.\n- Colours are converted from sRGB to linear factors. Finishes map to metallic/roughness: matte 0/0.85, satin 0/0.45, metal 1/0.3.\n- Material Nodes textures are evaluated by the same engine as the app and stored as PNG: base colour (sRGB), normal (+Y, OpenGL style) and one ORM image bound as occlusion (R) and metallic-roughness (G, B).\n- After writing, the GLB is parsed again (header, chunks, buffer views, accessors, min/max, indices, hierarchy, textures) and its world-space geometry is checked for closed solids.\n\nSolids are exported as separate closed meshes with flat normals; no boolean union, cameras, lights or animation. Textured solids get planar (top/bottom) and perimeter (side) UVs; tangents are left to the viewer (glTF MikkTSpace default).",
        "tags": [
          "apps"
        ],
        "x-mcp-tool": "renderloom_scene_glb",
        "x-owner-app": "renderloom",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/RenderloomSceneGlbInput"
              },
              "examples": {
                "example1": {
                  "summary": "Studio corner with colours and finishes",
                  "value": {}
                },
                "example2": {
                  "summary": "Pavilion with an oak plank texture",
                  "value": {
                    "scene": "{\"format\":\"renderloom-scene\",\"version\":1,\"name\":\"Courtyard pavilion\",\"recipe\":{\"format\":\"kerfwise-render\",\"version\":1,\"source\":{\"format\":\"kerfwise-form\",\"version\":1,\"name\":\"Courtyard pavilion\",\"units\":\"mm\",\"grid\":100,\"snap\":true,\"objects\":[{\"id\":\"part-1\",\"name\":\"Platform\",\"tag\":\"Architecture\",\"color\":\"#d2c6b5\",\"profile\":[[0,0],[5000,0],[5000,3600],[0,3600]],\"height\":150,\"x\":-2500,\"y\":-1800,\"z\":0,\"rotation\":0,\"visible\":true,\"locked\":false},{\"id\":\"part-2\",\"name\":\"Column\",\"tag\":\"Architecture\",\"color\":\"#73938a\",\"profile\":[[0,0],[200,0],[200,200],[0,200]],\"height\":2700,\"x\":-2200,\"y\":-1500,\"z\":150,\"rotation\":0,\"visible\":true,\"locked\":false},{\"id\":\"part-3\",\"name\":\"Column\",\"tag\":\"Architecture\",\"color\":\"#73938a\",\"profile\":[[0,0],[200,0],[200,200],[0,200]],\"height\":2700,\"x\":-2200,\"y\":1300,\"z\":150,\"rotation\":0,\"visible\":true,\"locked\":false},{\"id\":\"part-4\",\"name\":\"Column\",\"tag\":\"Architecture\",\"color\":\"#73938a\",\"profile\":[[0,0],[200,0],[200,200],[0,200]],\"height\":2700,\"x\":2000,\"y\":-1500,\"z\":150,\"rotation\":0,\"visible\":true,\"locked\":false},{\"id\":\"part-5\",\"name\":\"Column\",\"tag\":\"Architecture\",\"color\":\"#73938a\",\"profile\":[[0,0],[200,0],[200,200],[0,200]],\"height\":2700,\"x\":2000,\"y\":1300,\"z\":150,\"rotation\":0,\"visible\":true,\"locked\":false},{\"id\":\"part-6\",\"name\":\"Canopy\",\"tag\":\"Architecture\",\"color\":\"#b58f62\",\"profile\":[[0,0],[5400,0],[5400,4000],[0,4000]],\"height\":180,\"x\":-2700,\"y\":-2000,\"z\":2850,\"rotation\":0,\"visible\":true,\"locked\":false},{\"id\":\"part-7\",\"name\":\"Bench\",\"tag\":\"Furniture\",\"color\":\"#c7ac86\",\"profile\":[[0,0],[2800,0],[2800,500],[0,500]],\"height\":450,\"x\":-1400,\"y\":700,\"z\":150,\"rotation\":0,\"visible\":true,\"locked\":false}],\"scenes\":[{\"name\":\"Overview\",\"camera\":{\"azimuth\":-45,\"elevation\":32,\"span\":8477.372249111158,\"target\":[0,0,1515]}},{\"name\":\"Plan view\",\"camera\":{\"azimuth\":-90,\"elevation\":90,\"span\":8477.372249111158,\"target\":[0,0,1515]}}]},\"camera\":{\"azimuth\":-45,\"elevation\":32,\"span\":8477.372249111158,\"target\":[0,0,1515]},\"settings\":{\"width\":480,\"height\":360,\"samples\":4,\"seed\":1,\"lightAzimuth\":35,\"lightElevation\":55,\"softness\":0.12,\"ambient\":0.3,\"exposure\":0,\"background\":\"#f3eee3\",\"ground\":true,\"transparent\":false},\"materials\":{}},\"notes\":\"A simple pavilion: inspect canopy shadows and ground contact.\",\"shots\":[{\"id\":\"shot-1\",\"name\":\"Overview\",\"camera\":{\"azimuth\":-45,\"elevation\":32,\"span\":8477.372249111158,\"target\":[0,0,1515]}},{\"id\":\"shot-2\",\"name\":\"Plan view\",\"camera\":{\"azimuth\":-90,\"elevation\":90,\"span\":8477.372249111158,\"target\":[0,0,1515]}}]}",
                    "texture": "wood",
                    "textureSize": "128",
                    "tileMm": 800
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Calculation result envelope.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RenderloomSceneGlbResult"
                }
              }
            }
          },
          "400": {
            "description": "Malformed JSON body.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "422": {
            "description": "Invalid input (see errors[]).",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded (see Retry-After).",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/tool": {
      "get": {
        "operationId": "getToolDefinition",
        "summary": "Inputs, output schema and examples for this tool",
        "responses": {
          "200": {
            "description": "Tool definition.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "Problem": {
        "type": "object",
        "description": "RFC 9457 problem details. 422 responses include per-field `errors`.",
        "required": [
          "type",
          "title",
          "status",
          "detail"
        ],
        "properties": {
          "type": {
            "type": "string"
          },
          "title": {
            "type": "string"
          },
          "status": {
            "type": "integer"
          },
          "detail": {
            "type": "string"
          },
          "code": {
            "type": "string"
          },
          "errors": {
            "type": "array",
            "items": {
              "type": "object",
              "required": [
                "field",
                "message"
              ],
              "properties": {
                "field": {
                  "type": "string"
                },
                "message": {
                  "type": "string"
                }
              }
            }
          }
        }
      },
      "RenderloomSceneGlbInput": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "scene": {
            "title": "Renderloom scene, Form Studio project or render recipe JSON",
            "type": "string",
            "maxLength": 2000000,
            "default": "{\"format\":\"renderloom-scene\",\"version\":1,\"name\":\"Studio corner\",\"recipe\":{\"format\":\"kerfwise-render\",\"version\":1,\"source\":{\"format\":\"kerfwise-form\",\"version\":1,\"name\":\"Studio corner\",\"units\":\"mm\",\"grid\":100,\"snap\":true,\"objects\":[{\"id\":\"part-1\",\"name\":\"Floor\",\"tag\":\"Architecture\",\"color\":\"#e0ddd3\",\"profile\":[[0,0],[4800,0],[4800,3600],[0,3600]],\"height\":40,\"x\":-2400,\"y\":-1800,\"z\":-40,\"rotation\":0,\"visible\":true,\"locked\":false},{\"id\":\"part-2\",\"name\":\"Back wall\",\"tag\":\"Architecture\",\"color\":\"#e8e6dc\",\"profile\":[[0,0],[4800,0],[4800,100],[0,100]],\"height\":2200,\"x\":-2400,\"y\":1700,\"z\":0,\"rotation\":0,\"visible\":true,\"locked\":false},{\"id\":\"part-3\",\"name\":\"Side wall\",\"tag\":\"Architecture\",\"color\":\"#d8dfdb\",\"profile\":[[0,0],[100,0],[100,3500],[0,3500]],\"height\":2200,\"x\":-2400,\"y\":-1800,\"z\":0,\"rotation\":0,\"visible\":true,\"locked\":false},{\"id\":\"part-4\",\"name\":\"Desk top\",\"tag\":\"Furniture\",\"color\":\"#bd9464\",\"profile\":[[0,0],[2200,0],[2200,850],[0,850]],\"height\":60,\"x\":-1700,\"y\":100,\"z\":720,\"rotation\":0,\"visible\":true,\"locked\":false},{\"id\":\"part-5\",\"name\":\"Desk leg\",\"tag\":\"Furniture\",\"color\":\"#364c4a\",\"profile\":[[0,0],[70,0],[70,70],[0,70]],\"height\":720,\"x\":-1620,\"y\":180,\"z\":0,\"rotation\":0,\"visible\":true,\"locked\":false},{\"id\":\"part-6\",\"name\":\"Desk leg\",\"tag\":\"Furniture\",\"color\":\"#364c4a\",\"profile\":[[0,0],[70,0],[70,70],[0,70]],\"height\":720,\"x\":-1620,\"y\":790,\"z\":0,\"rotation\":0,\"visible\":true,\"locked\":false},{\"id\":\"part-7\",\"name\":\"Desk leg\",\"tag\":\"Furniture\",\"color\":\"#364c4a\",\"profile\":[[0,0],[70,0],[70,70],[0,70]],\"height\":720,\"x\":360,\"y\":180,\"z\":0,\"rotation\":0,\"visible\":true,\"locked\":false},{\"id\":\"part-8\",\"name\":\"Desk leg\",\"tag\":\"Furniture\",\"color\":\"#364c4a\",\"profile\":[[0,0],[70,0],[70,70],[0,70]],\"height\":720,\"x\":360,\"y\":790,\"z\":0,\"rotation\":0,\"visible\":true,\"locked\":false},{\"id\":\"part-9\",\"name\":\"Shelf\",\"tag\":\"Furniture\",\"color\":\"#bd9464\",\"profile\":[[0,0],[1100,0],[1100,360],[0,360]],\"height\":45,\"x\":-1900,\"y\":1200,\"z\":1350,\"rotation\":0,\"visible\":true,\"locked\":false},{\"id\":\"part-10\",\"name\":\"Storage\",\"tag\":\"Furniture\",\"color\":\"#d6b98c\",\"profile\":[[0,0],[650,0],[650,500],[0,500]],\"height\":650,\"x\":1200,\"y\":1000,\"z\":0,\"rotation\":0,\"visible\":true,\"locked\":false},{\"id\":\"part-11\",\"name\":\"Seat\",\"tag\":\"Furniture\",\"color\":\"#597c75\",\"profile\":[[0,0],[650,0],[650,600],[0,600]],\"height\":110,\"x\":-1100,\"y\":-950,\"z\":460,\"rotation\":0,\"visible\":true,\"locked\":false},{\"id\":\"part-12\",\"name\":\"Seat leg\",\"tag\":\"Furniture\",\"color\":\"#364c4a\",\"profile\":[[0,0],[45,0],[45,45],[0,45]],\"height\":460,\"x\":-1050,\"y\":-900,\"z\":0,\"rotation\":0,\"visible\":true,\"locked\":false},{\"id\":\"part-13\",\"name\":\"Seat leg\",\"tag\":\"Furniture\",\"color\":\"#364c4a\",\"profile\":[[0,0],[45,0],[45,45],[0,45]],\"height\":460,\"x\":-1050,\"y\":-500,\"z\":0,\"rotation\":0,\"visible\":true,\"locked\":false},{\"id\":\"part-14\",\"name\":\"Seat leg\",\"tag\":\"Furniture\",\"color\":\"#364c4a\",\"profile\":[[0,0],[45,0],[45,45],[0,45]],\"height\":460,\"x\":-550,\"y\":-900,\"z\":0,\"rotation\":0,\"visible\":true,\"locked\":false},{\"id\":\"part-15\",\"name\":\"Seat leg\",\"tag\":\"Furniture\",\"color\":\"#364c4a\",\"profile\":[[0,0],[45,0],[45,45],[0,45]],\"height\":460,\"x\":-550,\"y\":-500,\"z\":0,\"rotation\":0,\"visible\":true,\"locked\":false},{\"id\":\"part-16\",\"name\":\"Seat back\",\"tag\":\"Furniture\",\"color\":\"#597c75\",\"profile\":[[0,0],[650,0],[650,70],[0,70]],\"height\":550,\"x\":-1100,\"y\":-950,\"z\":500,\"rotation\":0,\"visible\":true,\"locked\":false},{\"id\":\"planter\",\"name\":\"Planter\",\"tag\":\"Details\",\"color\":\"#bd7962\",\"profile\":[[210,0],[202.84442352070434,54.35199947152935],[181.86533479473212,104.99999999999999],[148.49242404917499,148.49242404917496],[105.00000000000003,181.8653347947321],[54.35199947152935,202.84442352070434],[1.2858791391047208e-14,210],[-54.35199947152938,202.84442352070434],[-104.99999999999996,181.86533479473212],[-148.49242404917496,148.49242404917499],[-181.86533479473212,104.99999999999999],[-202.8444235207043,54.35199947152941],[-210,2.5717582782094416e-14],[-202.84442352070437,-54.351999471529275],[-181.8653347947321,-105.00000000000003],[-148.492424049175,-148.49242404917496],[-105.0000000000001,-181.8653347947321],[-54.35199947152933,-202.84442352070434],[-3.857637417314162e-14,-210],[54.35199947152926,-202.84442352070437],[105.00000000000003,-181.8653347947321],[148.49242404917496,-148.492424049175],[181.86533479473206,-105.0000000000001],[202.84442352070434,-54.351999471529346]],\"height\":450,\"x\":1450,\"y\":-1000,\"z\":0,\"rotation\":0,\"visible\":true,\"locked\":false},{\"id\":\"plant\",\"name\":\"Plant crown\",\"tag\":\"Details\",\"color\":\"#52765d\",\"profile\":[[300,0],[259.8076211353316,149.99999999999997],[150.00000000000003,259.8076211353316],[1.8369701987210297e-14,300],[-149.99999999999994,259.8076211353316],[-259.8076211353316,149.99999999999997],[-300,3.6739403974420595e-14],[-259.8076211353316,-150.00000000000003],[-150.00000000000014,-259.80762113533154],[-5.510910596163089e-14,-300],[150.00000000000003,-259.8076211353316],[259.8076211353315,-150.00000000000014]],\"height\":700,\"x\":1450,\"y\":-1000,\"z\":400,\"rotation\":0,\"visible\":true,\"locked\":false}],\"scenes\":[{\"name\":\"Overview\",\"camera\":{\"azimuth\":-45,\"elevation\":32,\"span\":7365.173181942159,\"target\":[0,0,1080]}},{\"name\":\"Plan view\",\"camera\":{\"azimuth\":-90,\"elevation\":90,\"span\":7365.173181942159,\"target\":[0,0,1080]}}]},\"camera\":{\"azimuth\":-45,\"elevation\":32,\"span\":7365.173181942159,\"target\":[0,0,1080]},\"settings\":{\"width\":480,\"height\":360,\"samples\":4,\"seed\":1,\"lightAzimuth\":-45,\"lightElevation\":55,\"softness\":0.12,\"ambient\":0.3,\"exposure\":0,\"background\":\"#f3eee3\",\"ground\":true,\"transparent\":false},\"materials\":{}},\"notes\":\"A quiet workspace. Compare warm wood with cool upholstery.\",\"shots\":[{\"id\":\"shot-1\",\"name\":\"Overview\",\"camera\":{\"azimuth\":-45,\"elevation\":32,\"span\":7365.173181942159,\"target\":[0,0,1080]}},{\"id\":\"shot-2\",\"name\":\"Plan view\",\"camera\":{\"azimuth\":-90,\"elevation\":90,\"span\":7365.173181942159,\"target\":[0,0,1080]}}]}"
          },
          "visibleOnly": {
            "title": "Export visible solids only",
            "type": "boolean",
            "default": true
          },
          "texture": {
            "title": "PBR texture",
            "type": "string",
            "enum": [
              "none",
              "brick",
              "wood",
              "stone",
              "metal",
              "fabric"
            ],
            "default": "none"
          },
          "textureSize": {
            "title": "Texture size (pixels)",
            "type": "string",
            "enum": [
              "64",
              "128",
              "256",
              "512"
            ],
            "default": "256"
          },
          "apply": {
            "title": "Apply texture to",
            "type": "string",
            "enum": [
              "all",
              "tag",
              "solid"
            ],
            "default": "all"
          },
          "target": {
            "title": "Tag or solid ID",
            "type": "string",
            "maxLength": 120,
            "default": ""
          },
          "tileMm": {
            "title": "Texture repeats every (mm)",
            "type": "number",
            "minimum": 10,
            "maximum": 100000,
            "default": 500
          }
        },
        "required": []
      },
      "RenderloomSceneGlbResult": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "schemaVersion",
          "tool",
          "computedAt",
          "inputs",
          "summary",
          "result",
          "units",
          "assumptions",
          "sources",
          "warnings",
          "presentation",
          "links"
        ],
        "properties": {
          "schemaVersion": {
            "type": "string",
            "const": "1.0"
          },
          "tool": {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "id",
              "name",
              "version"
            ],
            "properties": {
              "id": {
                "type": "string"
              },
              "name": {
                "type": "string"
              },
              "version": {
                "type": "string"
              }
            }
          },
          "computedAt": {
            "type": "string",
            "format": "date-time"
          },
          "inputs": {
            "type": "object",
            "description": "Normalised inputs actually used, including applied defaults."
          },
          "summary": {
            "type": "string"
          },
          "result": {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "report",
              "file",
              "openInApp"
            ],
            "properties": {
              "report": {
                "type": "object"
              },
              "file": {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "artifactId",
                  "filename",
                  "mime",
                  "bytes",
                  "sha256",
                  "path"
                ],
                "properties": {
                  "artifactId": {
                    "type": "string"
                  },
                  "filename": {
                    "type": "string"
                  },
                  "mime": {
                    "type": "string"
                  },
                  "bytes": {
                    "type": "integer"
                  },
                  "sha256": {
                    "type": "string"
                  },
                  "path": {
                    "type": "string",
                    "description": "Download path on the same site (valid for about 2 hours)."
                  }
                }
              },
              "openInApp": {
                "type": "string"
              }
            }
          },
          "units": {
            "type": "object",
            "additionalProperties": {
              "type": "string"
            }
          },
          "assumptions": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "sources": {
            "type": "array",
            "items": {
              "type": "object",
              "additionalProperties": false,
              "required": [
                "title"
              ],
              "properties": {
                "title": {
                  "type": "string"
                },
                "url": {
                  "type": "string"
                },
                "publisher": {
                  "type": "string"
                },
                "retrievedAt": {
                  "type": "string"
                },
                "note": {
                  "type": "string"
                }
              }
            }
          },
          "warnings": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "presentation": {
            "type": "array",
            "items": {
              "type": "object"
            },
            "description": "Display blocks used by the human page (same data)."
          },
          "links": {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "human",
              "api",
              "openapi",
              "methodology"
            ],
            "properties": {
              "human": {
                "type": "string",
                "format": "uri"
              },
              "api": {
                "type": "string",
                "format": "uri"
              },
              "openapi": {
                "type": "string",
                "format": "uri"
              },
              "methodology": {
                "type": "string",
                "format": "uri"
              }
            }
          }
        }
      }
    }
  }
}