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
| Field | Type | Meaning |
|---|---|---|
shader | string | Shader resource ID. Required. |
color / baseColor | vec4 | Main material color. |
tintColor / tint | vec4 | Secondary tint color. |
emissionColor / emission / emissiveColor | vec4 | Emission color. |
uvScale | vec2 | Texture UV scale. |
uvOffset | vec2 | Texture UV offset. |
alphaCutoff | float | Alpha test threshold. |
emissionStrength / emissiveStrength | float | Emission multiplier. |
normalStrength | float | Normal map strength. |
customData0..3 | vec4 | Shader-defined custom data. |
unlit / ignoreLights | bool | Ignore scene lighting. |
receiveShadows | bool | Receive shadows. |
ignoreShadows | bool | Legacy inverse of receiveShadows. |
castShadows | bool | Cast shadows. |
textures | array/object | Texture paths by slot type. |
params | object | Shader-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:
| Type | Use |
|---|---|
diffuse | Base color/albedo texture. |
normal | Normal map. |
detail | Detail texture. |
emissive / emission | Emission 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:
colortintColoremissionColoruvScaleuvOffsetalphaCutoffnormalStrengthemissionStrengthunlitreceiveShadowscastShadowscustomData0,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.
