Skip to main content

u3m_schema_1_0.json

u3m_schema.json Copy Json { "$schema": "http://json-schema.org/draft-04/schema#", "definitions": { "color_rgb": { "type": "...

Updated over 3 weeks ago

u3m_schema.json

Copy Json

{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "definitions": {
    "color_rgb": {
      "type": "object",
      "properties": {
        "r": {
          "type": "number",
          "minimum": 0,
          "maximum": 1
        },
        "g": {
          "type": "number",
          "minimum": 0,
          "maximum": 1
        },
        "b": {
          "type": "number",
          "minimum": 0,
          "maximum": 1
        }
      },
      "additionalProperties": false,
      "required": [
        "r",
        "g",
        "b"
      ]
    },
    "image": {
      "type": "object",
      "properties": {
        "width": {
          "type": "number",
          "minimum": 0
        },
        "height": {
          "type": "number",
          "minimum": 0
        },
        "dpi": {
          "type": "number",
          "minimum": 0
        },
        "path": {
          "description": "relative path to the image",
          "type": "string"
        },
        "repeat": {
          "type": [
            "object",
            "null"
          ],
          "properties": {
            "rotation": {
              "type": "number"
            },
            "mode": {
              "description": "normal - wrap_x + wrap_y, mirror_x - mirror_x + wrap_y, mirror_y - wrap_x + mirror_y, mirror_xy - mirror_x + mirror_y",
              "enum": [
                "normal",
                "mirror_x",
                "mirror_y",
                "mirror_xy"
              ]
            }
          },
          "additionalProperties": false,
          "required": [
            "rotation",
            "mode"
          ]
        }
      },
      "additionalProperties": false,
      "required": [
        "repeat",
        "dpi",
        "path",
        "width",
        "height"
      ]
    },
    "texture_and_color": {
      "type": [
        "object",
        "null"
      ],
      "properties": {
        "constant": {
          "$ref": "#/definitions/color_rgb"
        },
        "texture": {
          "type": [
            "object",
            "null"
          ],
          "properties": {
            "mode": {
              "enum": [
                "add",
                "subtract",
                "multiply",
                "divide",
                "max",
                "min",
                "overlay"
              ]
            },
            "factor": {
              "$ref": "#/definitions/color_rgb"
            },
            "image": {
              "$ref": "#/definitions/image"
            }
          },
          "additionalProperties": false,
          "required": [
            "factor",
            "mode",
            "image"
          ]
        }
      },
      "additionalProperties": false,
      "required": [
        "constant",
        "texture"
      ]
    },
    "texture_and_number": {
      "type": [
        "object",
        "null"
      ],
      "properties": {
        "constant": {
          "type": "number"
        },
        "texture": {
          "type": [
            "object",
            "null"
          ],
          "properties": {
            "factor": {
              "type": "number"
            },
            "offset": {
              "type": "number"
            },
            "image": {
              "$ref": "#/definitions/image"
            }
          },
          "additionalProperties": false,
          "required": [
            "factor",
            "offset",
            "image"
          ]
        }
      },
      "additionalProperties": false,
      "required": [
        "constant",
        "texture"
      ]
    },
    "visualisation": {
      "type": [
        "object",
        "null"
      ],
      "properties": {
        "alpha": {
          "$ref": "#/definitions/texture_and_number"
        },
        "anisotropy_value": {
          "$ref": "#/definitions/texture_and_number"
        },
        "anisotropy_rotation": {
          "$ref": "#/definitions/texture_and_number"
        },
        "clearcoat_value": {
          "$ref": "#/definitions/texture_and_number"
        },
        "clearcoat_normal": {
          "$ref": "#/definitions/texture_and_number"
        },
        "clearcoat_roughness": {
          "$ref": "#/definitions/texture_and_number"
        },
        "ior": {
          "$ref": "#/definitions/texture_and_number"
        },
        "metalness": {
          "$ref": "#/definitions/texture_and_number"
        },
        "normal": {
          "$ref": "#/definitions/texture_and_number"
        },
        "displacement": {
          "$ref": "#/definitions/texture_and_number"
        },
        "roughness": {
          "$ref": "#/definitions/texture_and_number"
        },
        "sheen_value": {
          "$ref": "#/definitions/texture_and_number"
        },
        "sheen_tint": {
          "$ref": "#/definitions/texture_and_number"
        },
        "specular_value": {
          "$ref": "#/definitions/texture_and_number"
        },
        "specular_tint": {
          "$ref": "#/definitions/texture_and_number"
        },
        "subsurface_radius": {
          "$ref": "#/definitions/texture_and_number"
        },
        "subsurface_value": {
          "$ref": "#/definitions/texture_and_number"
        },
        "transmission": {
          "$ref": "#/definitions/texture_and_number"
        },
        "basecolor": {
          "$ref": "#/definitions/texture_and_color"
        },
        "subsurface_color": {
          "$ref": "#/definitions/texture_and_color"
        },
        "shader": {
          "enum": [
            "principled"
          ]
        }
      },
      "additionalProperties": false,
      "minProperties": 21
    }
  },
  "type": "object",
  "properties": {
    "schema": {
      "enum": [
        "1.0"
      ]
    },
    "material": {
      "type": "object",
      "properties": {
        "id": {
          "description": "UUID4 represented as string with or without {}",
          "type": "string",
          "pattern": "^(#{{0,1}([0-9a-fA-F]){8}-([0-9a-fA-F]){4}-([0-9a-fA-F]){4}-([0-9a-fA-F]){4}-([0-9a-fA-F]){12}}{0,1})$"
        },
        "name": {
          "type": "string",
          "minLength": 1
        },
        "description": {
          "type": "string"
        },
        "created": {
          "type": "string",
          "format": "date-time"
        },
        "modified": {
          "type": "string",
          "format": "date-time"
        },
        "front": {
          "$ref": "#/definitions/visualisation"
        },
        "back": {
          "$ref": "#/definitions/visualisation"
        }
      },
      "additionalProperties": false,
      "required": [
        "name",
        "id",
        "created",
        "modified",
        "front",
        "back",
        "description"
      ]
    },
    "custom": {
      "type": [
        "object",
        "null"
      ]
    }
  },
  "additionalProperties": false,
  "required": [
    "schema",
    "material",
    "custom"
  ]
}
Did this answer your question?