# `ShadingNodes`

> Contract 2.0.0 · package sha256 `a857eca95b35921109faf997094bb4192f12527d9d0fcd4be7e97f06425bad6e` · generated from `configurator-runtime.d.ts` by `services/onsite-scripter/scripts/build-contract-docs.mjs`; edit the source, not this file.

Interface · `import type { ShadingNodes } from '@holostep-configurators/runtime-client/contract';` · labs, `@experimental` · since 2.0.0 · section 20. Labs

2.0's node set, by MaterialX 1.38's node and input names (`stdlib_defs.mtlx`): `add`, `subtract`,
`multiply`, `divide`, `power`, `absval`, `clamp`, `min`, `max`, `mix`, `smoothstep`, `ifgreater`,
`normalize`, `dotproduct`, `crossproduct`, `extract`, `combine3` and `image` (`mix` takes `fg`,
`bg` and `mix`; `multiply` `in1` and `in2`; `smoothstep` `in`, `low` and `high`; `image` `file`,
a 'texture' uniform, and [`texcoord`](ShadingNodes.texcoord.md), UV channel 0 when omitted), plus one Holostep node:
`holo_simplexnoise3d`, input [`position`](ShadingNodes.position.md) (vector3), output a float in about −1..1, today's GLSL
simplex noise (Ashima, as a live pergola's wood grain draws it). Any other node or input name, other
standard-library ones included, records 'unsupported-spec' naming it when the graph is built,
and materials wearing the graph keep their base fields. A 2.x minor adds
standard-library nodes as apps need them (spec section 3.2).

## Members

| Member | Kind | Summary |
| --- | --- | --- |
| <a id="uniform"></a>[`uniform`](ShadingNodes.uniform.md) | method | A graph input declared in `uniforms`; set it later with [`Shading.set`](Shading.set.md). |
| <a id="texcoord"></a>[`texcoord`](ShadingNodes.texcoord.md) | method | A UV channel. |
| <a id="position"></a>[`position`](ShadingNodes.position.md) | method | The surface position. |
| <a id="base"></a>[`base`](ShadingNodes.base.md) | method | The value the material's base fields feed `gltf_pbr`'s input, the one an omitted [`ShadingOutputs`](ShadingOutputs.md) key keeps: for 'baseColor', the factor × the slot's map sampled at its placement × the vertex colour (`COLOR_0`); for… |
| <a id="node"></a>[`node`](ShadingNodes.node.md) | method | A node of the set above by its MaterialX name (e.g. 'mix', 'holo_simplexnoise3d'), with its inputs by their MaterialX names. |

## Declaration

```ts
export interface ShadingNodes<U extends Record<string, ShadingUniformType>> {
  uniform<K extends keyof U & string>(name: K): ShadingNode<U[K]>;
  texcoord(channel?: 0 | 1 | 2 | 3): ShadingNode<'vector2'>;
  position(space?: 'object' | 'world'): ShadingNode<'vector3'>;
  base<K extends 'baseColor' | 'roughness' | 'metallic'>(input: K): ShadingNode<K extends 'baseColor' ? 'color3' : 'float'>;
  node<T extends ShadingUniformType>(name: string, inputs: Readonly<Record<string, ShadingNode | number | Point2 | Point3>>): ShadingNode<T>;
}
```

## Generic-API test (spec 3.1)

| Rule | Result |
| --- | --- |
| 1. Neutral name | pass: `ShadingNodes` names no product |
| 2. A precedent | pass: [Babylon.js NodeMaterial](https://github.com/BabylonJS/Babylon.js/blob/master/packages/dev/core/src/Materials/Node/nodeMaterial.ts) (row `K21`); [Blender shader nodes](https://docs.blender.org/manual/en/latest/render/shader_nodes/index.html) (row `K21`) |
| 3. Two apps, or labs | labs (`@experimental` at a stable path, reached through `has()` or `supports()`): it graduates when a second app uses it; apps today: app-510d750508, app-59c5b5751e |
| 4. The cheaper fix first | decided per need in Appendix B: rows `K21` at tier labs (a member only where no rule, data, asset or app code serves the need) |
