Closed
Description
Description
When creating a node material you can create inputs with the uniform
node and later change them from javascript etc.
However, there's no easy way to get the uniforms or inputs later in the system.
Consider a loader that returns a NodeMaterial
you wont know what the inputs are let alone change them.
Solution
I think it would be possible to take the material input nodes and use them as start points to traverse and do tests for isUniformNode
or isInputNode
and then return an object or array of the nodes..
Consider:
const mesh = getSomeMeshFromGLTF('simplified.glb');
const inputs = mesh.material.getInputs();
// in a helper function
makeUiControls(inputs);
// direct
if (inputs.color1) inputs.color1.value = color('#fff');
if (inputs.mix) inputs.mix = 0.5;
Alternatives
Users will have to implement it themselves.
Additional context
No response