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

NodeMaterial, how to interface with properties #14254

Closed
pailhead opened this issue Jun 8, 2018 · 5 comments
Closed

NodeMaterial, how to interface with properties #14254

pailhead opened this issue Jun 8, 2018 · 5 comments

Comments

@pailhead
Copy link
Contributor

pailhead commented Jun 8, 2018

Another topic extracted from #7522 and #14252

When i look at the example here:
https://github.com/mrdoob/three.js/blob/dev/examples/webgl_materials_nodes.html#L361-L367

I'm experiencing cognitive overload when i read this code. For every material prop .foo there seems to be a corresponding .node.foo node.

This means that every property .foo that i have on Material now, will no longer be Texture,Color,Vector2,Float etc. but all will be Node.

Every .foo property will thus have to be accessed through .foo.value which is very similar to ShaderMaterial.uniforms.

What kind of an interface can i expect with NodeMaterial moving to /src?

@donmccurdy
Copy link
Collaborator

donmccurdy commented Jun 8, 2018

Let's not start an issue on this please. My example code was purely a speculative attempt at a backward-compatible MeshStandardMaterial implementation on top of nodes, and it is not worth discussing specific syntax here until some code exists to discuss. The goal here is to have a backward-compatible state for existing code, and not that we would encourage people to mix and match nodes and previous syntax in that way.

@pailhead
Copy link
Contributor Author

pailhead commented Jun 8, 2018

@donmccurdy
You're saying a PR has to be made in order to examine some interface? I disagree with this. Maybe the example code can be changed from the speculative attempt into something more meaningful.

The only insight i can find into interfacing with NodeMaterial is this:
https://github.com/mrdoob/three.js/blob/dev/examples/webgl_materials_nodes.html

I find the 2400 overwhelming. A minimal example would be much more valuable.

Could you please reopen this if i remove your code reference? I can study the node example and come up with something minimal.

@pailhead
Copy link
Contributor Author

pailhead commented Jun 8, 2018

@donmccurdy i've removed your code that i used in the post and made it generic. Please reopen this issue as i feel that it's valid, for one of the current examples. I find it extremely important to understand how such a crucial part of the system (materials) will work in the future.

It seems like i could have both be

myMaterial.roughness = 1
myMaterial.metalness = 1
myMaterial.color = new THREE.Color()
myMaterial.texture = new THREE.Texture()

and then node material has

myMaterial.nodes = []

However, the current state of the world is, if i want nodes, the first code block turns to

myMaterial.roughness.value = 1
myMaterial.metalness.value = 1
myMaterial.color.value = new THREE.Color()
myMaterial.texture.value = new THREE.Texture()

@donmccurdy
Copy link
Collaborator

donmccurdy commented Jun 8, 2018

The crux of the problem is that no documentation has yet been written. Certainly we should fix that. There is no need for an open-ended issue discussing how to use NodeMaterial or a theoretical backward-compatible wrapper, unless it is feedback on code that is already checked in. Sorry to be terse, these are too many tangents and resurrections of previous threads, and it is becoming disruptive to the aspects of NodeMaterial that require more focused discussion.

@pailhead
Copy link
Contributor Author

pailhead commented Jun 8, 2018

The checked in code can be seen here:
https://github.com/mrdoob/three.js/blob/dev/examples/webgl_materials_nodes.html#L361-L367

The feedback is:

why are inputs one level detached from the material. Why .prop.value and not just .prop?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants