{
  "openapi": "3.1.1",
  "info": {
    "title": "Scene Light Rig Comparison API",
    "version": "1.0.0",
    "summary": "Compare four deterministic light rigs on the same 3D concept.",
    "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://renderloomlightrigs.usefulweb.app"
    }
  ],
  "paths": {
    "/api/v1/calculate": {
      "post": {
        "operationId": "calculate",
        "summary": "Compare four deterministic light rigs on the same 3D concept.",
        "description": "Keep the camera, object colors and geometry fixed while comparing soft key, side, high-key and grazing light. Download a four-tile SVG contact sheet and an editable Renderloom scene, then refine lighting locally.\n\nMethodology:\n- Four renders keep geometry, camera, materials and sampling seed identical. Only light direction, elevation, softness and ambient light change.\n- The shared local concept renderer uses orthographic rays, direct light, sampled soft shadows, short-range ambient occlusion and one metal reflection. It does not execute MoonRay or load external renderers.\n- Each tile is 32–96 pixels per side and one or two samples. The complete comparison permits 65536 pixel samples. Colors are display sRGB; output is a compact raster represented by SVG rectangles.",
        "tags": [
          "apps"
        ],
        "x-mcp-tool": "renderloom_light_rigs",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/RenderloomLightRigsInput"
              },
              "examples": {
                "example1": {
                  "summary": "Compare terraced forms",
                  "value": {}
                },
                "example2": {
                  "summary": "A finer small comparison",
                  "value": {
                    "width": 64,
                    "height": 64,
                    "samples": 2
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Calculation result envelope.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RenderloomLightRigsResult"
                }
              }
            }
          },
          "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"
                }
              }
            }
          }
        }
      },
      "RenderloomLightRigsInput": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "project": {
            "title": "Renderloom scene, render recipe or Form Studio JSON",
            "type": "string",
            "maxLength": 250000,
            "default": "{\"format\":\"renderloom-scene\",\"version\":1,\"name\":\"Terraced forms\",\"recipe\":{\"format\":\"kerfwise-render\",\"version\":1,\"source\":{\"format\":\"kerfwise-form\",\"version\":1,\"name\":\"Terraced forms\",\"units\":\"mm\",\"grid\":100,\"snap\":true,\"objects\":[{\"id\":\"part-1\",\"name\":\"Terrace 1\",\"tag\":\"Objects\",\"color\":\"#d6c5ab\",\"profile\":[[0,0],[2200,0],[2200,1800],[0,1800]],\"height\":300,\"x\":-1100,\"y\":-900,\"z\":0,\"rotation\":0,\"visible\":true,\"locked\":false},{\"id\":\"part-2\",\"name\":\"Terrace 2\",\"tag\":\"Objects\",\"color\":\"#b5c5b6\",\"profile\":[[0,0],[1800,0],[1800,1500],[0,1500]],\"height\":300,\"x\":-900,\"y\":-750,\"z\":300,\"rotation\":0,\"visible\":true,\"locked\":false},{\"id\":\"part-3\",\"name\":\"Terrace 3\",\"tag\":\"Objects\",\"color\":\"#789b90\",\"profile\":[[0,0],[1400,0],[1400,1200],[0,1200]],\"height\":300,\"x\":-700,\"y\":-600,\"z\":600,\"rotation\":0,\"visible\":true,\"locked\":false},{\"id\":\"part-4\",\"name\":\"Terrace 4\",\"tag\":\"Objects\",\"color\":\"#3e6662\",\"profile\":[[0,0],[1000,0],[1000,900],[0,900]],\"height\":300,\"x\":-500,\"y\":-450,\"z\":900,\"rotation\":0,\"visible\":true,\"locked\":false}],\"scenes\":[{\"name\":\"Overview\",\"camera\":{\"azimuth\":-45,\"elevation\":32,\"span\":3548.2671827245476,\"target\":[0,0,600]}},{\"name\":\"Plan view\",\"camera\":{\"azimuth\":-90,\"elevation\":90,\"span\":3548.2671827245476,\"target\":[0,0,600]}}]},\"camera\":{\"azimuth\":-45,\"elevation\":32,\"span\":3548.2671827245476,\"target\":[0,0,600]},\"settings\":{\"width\":480,\"height\":360,\"samples\":4,\"seed\":1,\"lightAzimuth\":-100,\"lightElevation\":55,\"softness\":0.12,\"ambient\":0.3,\"exposure\":0,\"background\":\"#f3eee3\",\"ground\":true,\"transparent\":false},\"materials\":{}},\"notes\":\"Four levels for comparing grazing light and material finishes.\",\"shots\":[{\"id\":\"shot-1\",\"name\":\"Overview\",\"camera\":{\"azimuth\":-45,\"elevation\":32,\"span\":3548.2671827245476,\"target\":[0,0,600]}},{\"id\":\"shot-2\",\"name\":\"Plan view\",\"camera\":{\"azimuth\":-90,\"elevation\":90,\"span\":3548.2671827245476,\"target\":[0,0,600]}}]}"
          },
          "width": {
            "title": "Tile width (px)",
            "type": "number",
            "minimum": 32,
            "maximum": 96,
            "default": 64
          },
          "height": {
            "title": "Tile height (px)",
            "type": "number",
            "minimum": 32,
            "maximum": 96,
            "default": 48
          },
          "samples": {
            "title": "Samples per pixel",
            "type": "number",
            "minimum": 1,
            "maximum": 2,
            "default": 1
          }
        },
        "required": []
      },
      "RenderloomLightRigsResult": {
        "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": [
              "project",
              "width",
              "height",
              "pixelSamples",
              "tiles",
              "sheet",
              "projectFile",
              "openInApp"
            ],
            "properties": {
              "project": {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "format",
                  "version",
                  "name",
                  "recipe",
                  "notes",
                  "shots"
                ],
                "properties": {
                  "format": {
                    "const": "renderloom-scene"
                  },
                  "version": {
                    "const": 1
                  },
                  "name": {
                    "type": "string",
                    "maxLength": 120
                  },
                  "recipe": {
                    "type": "object",
                    "additionalProperties": false,
                    "required": [
                      "format",
                      "version",
                      "source",
                      "camera",
                      "settings",
                      "materials"
                    ],
                    "properties": {
                      "format": {
                        "const": "kerfwise-render"
                      },
                      "version": {
                        "const": 1
                      },
                      "source": {
                        "type": "object",
                        "additionalProperties": false,
                        "required": [
                          "format",
                          "version",
                          "name",
                          "units",
                          "grid",
                          "snap",
                          "objects",
                          "scenes"
                        ],
                        "properties": {
                          "format": {
                            "const": "kerfwise-form"
                          },
                          "version": {
                            "const": 1
                          },
                          "name": {
                            "type": "string",
                            "maxLength": 120
                          },
                          "units": {
                            "enum": [
                              "mm",
                              "in"
                            ]
                          },
                          "grid": {
                            "type": "number",
                            "minimum": 0.1,
                            "maximum": 10000
                          },
                          "snap": {
                            "type": "boolean"
                          },
                          "objects": {
                            "type": "array",
                            "maxItems": 128,
                            "items": {
                              "type": "object",
                              "additionalProperties": false,
                              "required": [
                                "id",
                                "name",
                                "tag",
                                "color",
                                "profile",
                                "height",
                                "x",
                                "y",
                                "z",
                                "rotation",
                                "visible",
                                "locked"
                              ],
                              "properties": {
                                "id": {
                                  "type": "string",
                                  "pattern": "^[-a-zA-Z0-9_]{1,64}$"
                                },
                                "name": {
                                  "type": "string",
                                  "maxLength": 80
                                },
                                "tag": {
                                  "type": "string",
                                  "maxLength": 40
                                },
                                "color": {
                                  "type": "string",
                                  "pattern": "^#[a-fA-F0-9]{6}$"
                                },
                                "profile": {
                                  "type": "array",
                                  "minItems": 3,
                                  "maxItems": 64,
                                  "items": {
                                    "type": "array",
                                    "minItems": 2,
                                    "maxItems": 2,
                                    "items": {
                                      "type": "number",
                                      "minimum": -100000,
                                      "maximum": 100000
                                    }
                                  }
                                },
                                "height": {
                                  "type": "number",
                                  "minimum": 1,
                                  "maximum": 100000
                                },
                                "x": {
                                  "type": "number",
                                  "minimum": -100000,
                                  "maximum": 100000
                                },
                                "y": {
                                  "type": "number",
                                  "minimum": -100000,
                                  "maximum": 100000
                                },
                                "z": {
                                  "type": "number",
                                  "minimum": -100000,
                                  "maximum": 100000
                                },
                                "rotation": {
                                  "type": "number"
                                },
                                "tiltX": {
                                  "type": "number",
                                  "minimum": -180,
                                  "maximum": 180
                                },
                                "tiltY": {
                                  "type": "number",
                                  "minimum": -180,
                                  "maximum": 180
                                },
                                "visible": {
                                  "type": "boolean"
                                },
                                "locked": {
                                  "type": "boolean"
                                },
                                "orthogonal": {
                                  "type": "string",
                                  "maxLength": 12000
                                }
                              }
                            }
                          },
                          "scenes": {
                            "type": "array",
                            "maxItems": 8,
                            "items": {
                              "type": "object",
                              "additionalProperties": false,
                              "required": [
                                "name",
                                "camera"
                              ],
                              "properties": {
                                "name": {
                                  "type": "string",
                                  "maxLength": 60
                                },
                                "camera": {
                                  "type": "object",
                                  "additionalProperties": false,
                                  "required": [
                                    "azimuth",
                                    "elevation",
                                    "span",
                                    "target"
                                  ],
                                  "properties": {
                                    "azimuth": {
                                      "type": "number"
                                    },
                                    "elevation": {
                                      "type": "number",
                                      "minimum": 5,
                                      "maximum": 90
                                    },
                                    "span": {
                                      "type": "number",
                                      "minimum": 10,
                                      "maximum": 1000000
                                    },
                                    "target": {
                                      "type": "array",
                                      "minItems": 3,
                                      "maxItems": 3,
                                      "items": {
                                        "type": "number"
                                      }
                                    }
                                  }
                                }
                              }
                            }
                          }
                        }
                      },
                      "camera": {
                        "type": "object",
                        "additionalProperties": false,
                        "required": [
                          "azimuth",
                          "elevation",
                          "span",
                          "target"
                        ],
                        "properties": {
                          "azimuth": {
                            "type": "number",
                            "minimum": -3600,
                            "maximum": 3600
                          },
                          "elevation": {
                            "type": "number",
                            "minimum": 5,
                            "maximum": 90
                          },
                          "span": {
                            "type": "number",
                            "minimum": 10,
                            "maximum": 1000000
                          },
                          "target": {
                            "type": "array",
                            "minItems": 3,
                            "maxItems": 3,
                            "items": {
                              "type": "number",
                              "minimum": -300000,
                              "maximum": 300000
                            }
                          }
                        }
                      },
                      "settings": {
                        "type": "object",
                        "additionalProperties": false,
                        "required": [
                          "width",
                          "height",
                          "samples",
                          "seed",
                          "lightAzimuth",
                          "lightElevation",
                          "softness",
                          "ambient",
                          "exposure",
                          "background",
                          "ground",
                          "transparent"
                        ],
                        "properties": {
                          "width": {
                            "type": "integer",
                            "minimum": 32,
                            "maximum": 800
                          },
                          "height": {
                            "type": "integer",
                            "minimum": 32,
                            "maximum": 800
                          },
                          "samples": {
                            "type": "integer",
                            "minimum": 1,
                            "maximum": 32
                          },
                          "seed": {
                            "type": "integer",
                            "minimum": 0,
                            "maximum": 4294967295
                          },
                          "lightAzimuth": {
                            "type": "number",
                            "minimum": -360,
                            "maximum": 360
                          },
                          "lightElevation": {
                            "type": "number",
                            "minimum": 5,
                            "maximum": 90
                          },
                          "softness": {
                            "type": "number",
                            "minimum": 0,
                            "maximum": 0.6
                          },
                          "ambient": {
                            "type": "number",
                            "minimum": 0,
                            "maximum": 1
                          },
                          "exposure": {
                            "type": "number",
                            "minimum": -4,
                            "maximum": 4
                          },
                          "background": {
                            "type": "string",
                            "pattern": "^#[a-fA-F0-9]{6}$"
                          },
                          "ground": {
                            "type": "boolean"
                          },
                          "transparent": {
                            "type": "boolean"
                          }
                        },
                        "description": "At most 384000 pixels and 6 million pixel samples."
                      },
                      "materials": {
                        "type": "object",
                        "maxProperties": 128,
                        "additionalProperties": {
                          "enum": [
                            "matte",
                            "satin",
                            "metal"
                          ]
                        },
                        "description": "Keys reference source solid IDs. At most 4096 visible triangles."
                      }
                    }
                  },
                  "notes": {
                    "type": "string",
                    "maxLength": 12000
                  },
                  "shots": {
                    "type": "array",
                    "maxItems": 8,
                    "items": {
                      "type": "object",
                      "additionalProperties": false,
                      "required": [
                        "id",
                        "name",
                        "camera"
                      ],
                      "properties": {
                        "id": {
                          "type": "string",
                          "pattern": "^[-a-zA-Z0-9_]{1,64}$"
                        },
                        "name": {
                          "type": "string",
                          "maxLength": 60
                        },
                        "camera": {
                          "type": "object",
                          "additionalProperties": false,
                          "required": [
                            "azimuth",
                            "elevation",
                            "span",
                            "target"
                          ],
                          "properties": {
                            "azimuth": {
                              "type": "number",
                              "minimum": -3600,
                              "maximum": 3600
                            },
                            "elevation": {
                              "type": "number",
                              "minimum": 5,
                              "maximum": 90
                            },
                            "span": {
                              "type": "number",
                              "minimum": 10,
                              "maximum": 1000000
                            },
                            "target": {
                              "type": "array",
                              "minItems": 3,
                              "maxItems": 3,
                              "items": {
                                "type": "number",
                                "minimum": -300000,
                                "maximum": 300000
                              }
                            }
                          }
                        }
                      }
                    }
                  }
                }
              },
              "width": {
                "type": "integer"
              },
              "height": {
                "type": "integer"
              },
              "pixelSamples": {
                "type": "integer"
              },
              "tiles": {
                "type": "array",
                "minItems": 4,
                "maxItems": 4,
                "items": {
                  "type": "object"
                }
              },
              "sheet": {
                "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)."
                  }
                }
              },
              "projectFile": {
                "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",
                  "null"
                ]
              }
            }
          },
          "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"
              }
            }
          }
        }
      }
    }
  }
}