Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Request Uniforms/Inputs from a NodeMaterial #30186

Open
DennisSmolek opened this issue Dec 22, 2024 · 0 comments
Open

Request Uniforms/Inputs from a NodeMaterial #30186

DennisSmolek opened this issue Dec 22, 2024 · 0 comments

Comments

@DennisSmolek
Copy link

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

@sunag sunag added Suggestion TSL Three.js Shading Language WebGPU and removed TSL Three.js Shading Language labels Dec 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants