Editor

Material Editor

How NVEditor reads, edits, and saves material JSON and shader metadata.

Material Files

Material JSON lives under:

game/materials/

Open a material from the Project panel to edit shader parameters, texture slots, and renderer flags.

Pinned Flags

The Material panel pins these renderer flags:

LabelCanonical key
Ignore Lightsunlit
Receive ShadowsreceiveShadows
Cast ShadowscastShadows

Legacy ignoreLights and ignoreShadows are read for compatibility. Saves write canonical keys.

Shader-Driven Controls

NVEditor reads the shader's material metadata:

{
  "material": {
    "parameters": [
      {
        "key": "normalStrength",
        "label": "Normal Strength",
        "target": "normalStrength",
        "type": "float",
        "default": 1.0,
        "min": 0.0,
        "max": 1.0,
        "speed": 0.01
      }
    ],
    "textures": [
      {
        "key": "normal",
        "label": "Normal",
        "type": "normal"
      }
    ]
  }
}

The editor writes material values into params or canonical top-level fields, and the runtime loader maps those back into the Material struct.

Texture Slots

The editor understands the same texture slot types as the runtime:

  • diffuse
  • normal
  • detail
  • emissive

Textures can be assigned from existing paths or by dragging image assets.

Save Behavior

Material saves are written through a temporary file before replacing the original. This reduces the chance of corrupting a material if a write fails.

Good Material Hygiene

  • Prefer canonical unlit, receiveShadows, and castShadows.
  • Keep texture paths relative to the game asset root.
  • Use shader metadata for custom controls instead of editing customData0..3 by hand everywhere.
  • Use params for shader-specific values.
  • Keep castShadows explicit on transparent, sky, or special-effect materials.