You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is your feature request related to a problem? Please describe.
Currently the node materials inject default uniforms and varyings from their base material (ShaderMaterial) and from their main shader node (Physical, Standard, Basic, etc.). This ends up adding a bunch of uniforms and varyings that may or may not be used and no clear way on how we might use them>
I'd really like a way to be able to properly define and reference these uniforms/varyings. Perhaps nodes like UniformNode and AttributeNode can check to see if there is already a defined uniform/attribute and reuse those?
Alternately, these uniforms/varyings could only be user defined. And I think there's a decent case to be made that this is the better option.
The issue I'm currently trying to solve with node materials is being able to dynamically assign which uv gets used for each texture so that i can properly support glTF's texCoord property (See #12608). In the above snippet, you can see that because the node material is based on the other material, it pulls in the same assumptions about which uvs to use for each texture. This means, even if I wanted to write a node shader that dynamically assigned which uv set to use per texture, I couldn't for these maps.
I think NodeMaterial may be better off extending RawShaderMaterial and using a simplified ShaderLib to get rid of these assumptions and allow for maximum developer flexibility.
Describe alternatives you've considered
Perhaps this is already possible for uniforms with the MaterialNode? I really can't tell how that works.
Additional context
None
The text was updated successfully, but these errors were encountered:
The issue I'm currently trying to solve with node materials is being able to dynamically assign which uv gets used for each texture so that i can properly support glTF's texCoord property...
Perhaps this is already possible for uniforms with the MaterialNode? I really can't tell how that works.
Currently the node materials inject default uniforms and varyings from their base material (ShaderMaterial) and from their main shader node (Physical, Standard, Basic, etc.). This ends up adding a bunch of uniforms and varyings that may or may not be used and no clear way on how we might use them>
In most cases these defaults defines like USE_MAP of Three.js will never be used because if the user uses material.colorNode shouldn't use material.map. NodeMaterial will always replace the default behavior related. So this pattern below will not be processed by the GPU:
#ifdef USE_MAP
uniformsampler2D map;
#endif
The clean version of NodeBuilder is being developed based on the WebGPURenderer but could be absorbed into the WebGLRenderer as well at some point.
Yeah I think having NodeBuilder built on top of RawShaderMaterial in the future will solve this. I've moved away from this solution and am now just patching the ShaderChunks to get what I need.
The solution you pose above will work so long as you don't use any of the built in uniforms. This just becomes tough when trying to reproduce the behaviors of MeshStandardMaterial.
Anyway, I think this is a nice thing to have in the future. I think we should close this and whoever tries implementing MeshStandardMaterial on top of NodeMaterial in the future should ping me with their solution!
Is your feature request related to a problem? Please describe.
Currently the node materials inject default uniforms and varyings from their base material (ShaderMaterial) and from their main shader node (Physical, Standard, Basic, etc.). This ends up adding a bunch of uniforms and varyings that may or may not be used and no clear way on how we might use them>
From the generated code in the webgl_nodes_materials_standard example:
Describe the solution you'd like
I'd really like a way to be able to properly define and reference these uniforms/varyings. Perhaps nodes like
UniformNode
andAttributeNode
can check to see if there is already a defined uniform/attribute and reuse those?Alternately, these uniforms/varyings could only be user defined. And I think there's a decent case to be made that this is the better option.
The issue I'm currently trying to solve with node materials is being able to dynamically assign which uv gets used for each texture so that i can properly support glTF's
texCoord
property (See #12608). In the above snippet, you can see that because the node material is based on the other material, it pulls in the same assumptions about which uvs to use for each texture. This means, even if I wanted to write a node shader that dynamically assigned which uv set to use per texture, I couldn't for these maps.I think
NodeMaterial
may be better off extendingRawShaderMaterial
and using a simplifiedShaderLib
to get rid of these assumptions and allow for maximum developer flexibility.Describe alternatives you've considered
Perhaps this is already possible for uniforms with the
MaterialNode
? I really can't tell how that works.Additional context
None
The text was updated successfully, but these errors were encountered: