get_materials

Every defined material, sorted by ref, as { materials: [{ ref, baseColor, metallic, roughness, emissive, opacity, and its texture bindings (normalTexture with scale, occlusionTexture with strength) }] }.

Query

Usage

TypeScript
surface.query('get_materials')

Returns

object with materials, in the ok: true envelope.

JSON
{
  "type": "object",
  "properties": {
    "materials": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "ref": {
            "type": "string"
          },
          "baseColor": {
            "type": "array",
            "minItems": 4,
            "maxItems": 4,
            "items": {
              "type": "number",
              "minimum": 0,
              "maximum": 1
            }
          },
          "metallic": {
            "type": "number",
            "minimum": 0,
            "maximum": 1
          },
          "roughness": {
            "type": "number",
            "minimum": 0,
            "maximum": 1
          },
          "emissive": {
            "type": "array",
            "minItems": 3,
            "maxItems": 3,
            "items": {
              "type": "number",
              "minimum": 0,
              "maximum": 10000
            }
          },
          "opacity": {
            "type": "number",
            "minimum": 0,
            "maximum": 1
          },
          "baseColorTexture": {
            "type": "object",
            "properties": {
              "texture": {
                "type": "string"
              },
              "texCoord": {
                "type": "integer",
                "enum": [
                  0
                ]
              }
            },
            "required": [
              "texture"
            ]
          },
          "metallicRoughnessTexture": {
            "type": "object",
            "properties": {
              "texture": {
                "type": "string"
              },
              "texCoord": {
                "type": "integer",
                "enum": [
                  0
                ]
              }
            },
            "required": [
              "texture"
            ]
          },
          "normalTexture": {
            "type": "object",
            "properties": {
              "texture": {
                "type": "string"
              },
              "texCoord": {
                "type": "integer",
                "enum": [
                  0
                ]
              },
              "scale": {
                "type": "number",
                "minimum": -10,
                "maximum": 10
              }
            },
            "required": [
              "texture"
            ]
          },
          "occlusionTexture": {
            "type": "object",
            "properties": {
              "texture": {
                "type": "string"
              },
              "texCoord": {
                "type": "integer",
                "enum": [
                  0
                ]
              },
              "strength": {
                "type": "number",
                "minimum": 0,
                "maximum": 1
              }
            },
            "required": [
              "texture"
            ]
          },
          "emissiveTexture": {
            "type": "object",
            "properties": {
              "texture": {
                "type": "string"
              },
              "texCoord": {
                "type": "integer",
                "enum": [
                  0
                ]
              }
            },
            "required": [
              "texture"
            ]
          }
        },
        "required": [
          "ref",
          "baseColor",
          "metallic",
          "roughness"
        ]
      }
    }
  },
  "required": [
    "materials"
  ]
}

See also