Scene kit command

material.set

Change Material

Changes material `material` (name or id): base color, metallic, roughness, emission, alpha, transmission and more.

Kit
Scene 0.1.0 (.kscene)
Changes the document
yes

Parameters

Parameters of material.set
NameTypeRequiredDescription
alphaCutoffnumbernoclip: the alpha below which the surface is not there (0.5)
alphaMode"opaque" | "clip" | "blend"noHow the base colour's alpha is used
baseColornumber[] | stringnoBase colour
emissionnumber[] | stringnoEmission colour
emissionStrengthnumbernoEmission strength
iornumbernoIndex of refraction (1.5)
materialinteger | stringyesThe material's id or name
metallicnumberno0 to 1
namestringnoA new name
normalStrengthnumbernoHow strongly the normal map bends the surface (1)
roughnessnumberno0 to 1
shaderinteger | string | nullnoA shader group (id or name) giving the surface and volume in path-traced renders, or null to let go of it
transmissionnumbernoHow much light passes through, 0 to 1 (glass at 1)

Call through scene_run

text
scene_run {
  "path": "<file>.kscene",
  "steps": [{ "command": "material.set", "params": { "material": <integer | string> } }]
}

The required parameters, with placeholders for their types: not a tested example. Optional: alphaCutoff, alphaMode, baseColor, emission, emissionStrength, ior, metallic, name, normalStrength, roughness, shader, transmission. scene_run answers the step’s result in completed[i].result.

Result

The kit gives no result schema for this command.

Parameter schema

json
{
  "additionalProperties": false,
  "properties": {
    "alphaCutoff": {
      "description": "clip: the alpha below which the surface is not there (0.5)",
      "type": "number"
    },
    "alphaMode": {
      "description": "How the base colour's alpha is used",
      "enum": [
        "opaque",
        "clip",
        "blend"
      ],
      "type": "string"
    },
    "baseColor": {
      "description": "Base colour",
      "oneOf": [
        {
          "description": "[r, g, b] or [r, g, b, a], linear, 0 to 1",
          "items": {
            "type": "number"
          },
          "type": "array"
        },
        {
          "description": "#rrggbb (sRGB)",
          "type": "string"
        }
      ]
    },
    "emission": {
      "description": "Emission colour",
      "oneOf": [
        {
          "description": "[r, g, b] or [r, g, b, a], linear, 0 to 1",
          "items": {
            "type": "number"
          },
          "type": "array"
        },
        {
          "description": "#rrggbb (sRGB)",
          "type": "string"
        }
      ]
    },
    "emissionStrength": {
      "description": "Emission strength",
      "type": "number"
    },
    "ior": {
      "description": "Index of refraction (1.5)",
      "type": "number"
    },
    "material": {
      "description": "The material's id or name",
      "oneOf": [
        {
          "type": "integer"
        },
        {
          "type": "string"
        }
      ],
      "x-khp-name": "name",
      "x-khp-types": [
        "Material"
      ]
    },
    "metallic": {
      "description": "0 to 1",
      "type": "number"
    },
    "name": {
      "description": "A new name",
      "type": "string"
    },
    "normalStrength": {
      "description": "How strongly the normal map bends the surface (1)",
      "type": "number"
    },
    "roughness": {
      "description": "0 to 1",
      "type": "number"
    },
    "shader": {
      "description": "A shader group (id or name) giving the surface and volume in path-traced renders, or null to let go of it",
      "oneOf": [
        {
          "type": "integer"
        },
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "x-khp-name": "name",
      "x-khp-types": [
        "NodeGroup"
      ]
    },
    "transmission": {
      "description": "How much light passes through, 0 to 1 (glass at 1)",
      "type": "number"
    }
  },
  "required": [
    "material"
  ],
  "type": "object"
}

Generated from the command list of @kition/[email protected] and the kit itself (scene_commands through @kition/[email protected], built from KitionAI/kition-scene@4d06faf). As data: commands.jsonl.