Api

Materials and Shaders

Material JSON, shader metadata, texture slots, renderer flags, and editor controls.

Material Files

Materials live under:

game/materials/

Loaders accept a material ID such as "basic" and resolve it to materials/basic.json.

Minimum material:

{
  "version": 0,
  "shader": "basic"
}

Material Fields

FieldTypeMeaning
shaderstringShader resource ID. Required.
color / baseColorvec4Main material color.
tintColor / tintvec4Secondary tint color.
emissionColor / emission / emissiveColorvec4Emission color.
uvScalevec2Texture UV scale.
uvOffsetvec2Texture UV offset.
alphaCutofffloatAlpha test threshold.
emissionStrength / emissiveStrengthfloatEmission multiplier.
normalStrengthfloatNormal map strength.
customData0..3vec4Shader-defined custom data.
unlit / ignoreLightsboolIgnore scene lighting.
receiveShadowsboolReceive shadows.
ignoreShadowsboolLegacy inverse of receiveShadows.
castShadowsboolCast shadows.
texturesarray/objectTexture paths by slot type.
paramsobjectShader-schema parameter overrides and shortcut values.

Canonical material flags are unlit, receiveShadows, and castShadows. NVEditor reads legacy keys but writes canonical keys.

Texture Slots

Supported texture types:

TypeUse
diffuseBase color/albedo texture.
normalNormal map.
detailDetail texture.
emissive / emissionEmission texture.

Array form:

{
  "textures": [
    {
      "type": "diffuse",
      "path": "textures/asphalt/Road012B_4K-PNG_Color.png"
    },
    {
      "type": "normal",
      "path": "textures/asphalt/Road012B_4K-PNG_NormalDX.png"
    }
  ]
}

Object form:

{
  "textures": {
    "diffuse": "textures/diffuse.png",
    "normal": {
      "path": "textures/normal.png",
      "type": "normal"
    }
  }
}

Textured Material Example

From the asphalt material pattern:

{
  "version": 0,
  "shader": "basic",
  "color": [1.0, 1.0, 1.0, 1.0],
  "normalStrength": 1.0,
  "castShadows": true,
  "textures": [
    {
      "path": "textures/asphalt/Road012B_4K-PNG_Color.png",
      "type": "diffuse"
    },
    {
      "path": "textures/asphalt/Road012B_4K-PNG_NormalDX.png",
      "type": "normal"
    }
  ]
}

Sky/Cubemap Material Pattern

The current sky workaround uses a large mesh with an unlit material:

{
  "version": 0,
  "shader": "basic",
  "color": [1.0, 1.0, 1.0, -1.0],
  "emissionColor": [1.0, 1.0, 1.0, -1.0],
  "castShadows": false,
  "params": {
    "unlit": true,
    "receiveShadows": false
  },
  "textures": [
    {
      "path": "textures/StandardCubeMap.png",
      "type": "diffuse"
    }
  ]
}

In the current shader/material ABI, alpha less than zero is used by some materials as texture-only mode. If you use that mode without a diffuse texture, the loader warns.

Shader JSON

Shaders live under:

game/shaders/

Example:

{
  "version": 0,
  "pixelShader": "basic",
  "vertexShader": "basic",
  "material": {
    "parameters": [
      {
        "key": "color",
        "label": "Color",
        "target": "color",
        "type": "color",
        "default": [1.0, 1.0, 1.0, 1.0]
      },
      {
        "key": "unlit",
        "label": "Ignore Lights",
        "target": "unlit",
        "type": "bool",
        "default": false
      }
    ],
    "textures": [
      {
        "key": "diffuse",
        "label": "Diffuse",
        "type": "diffuse"
      }
    ]
  }
}

Parameter Targets

Shader parameter targets map editor controls and material params values back into renderer fields.

Common targets:

  • color
  • tintColor
  • emissionColor
  • uvScale
  • uvOffset
  • alphaCutoff
  • normalStrength
  • emissionStrength
  • unlit
  • receiveShadows
  • castShadows
  • customData0, customData1, customData2, customData3
  • component targets like customData0.x

params can override schema keys:

{
  "params": {
    "emissionStrength": 8.0,
    "unlit": true,
    "diffuse": "textures/neon.png"
  }
}

Texture keys in params are accepted for diffuse, normal, detail, emissive, and emission.