Skip to content

Request Uniforms/Inputs from a NodeMaterial #30186

Closed
@DennisSmolek

Description

@DennisSmolek

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

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions