-
-
Notifications
You must be signed in to change notification settings - Fork 35.3k
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 revision #16796
NodeMaterial revision #16796
Conversation
…ated afterwards with needsUpdate=false
…has been fixed either way now
Fix texture cube node
Fix nodemat compile
- rename Node.parse() to Node.analyze() - rename Node.buildCode() to Node.flow() - rename Node.eval to Node.parse - move NodeBuilder.optimize to NodeBuilder.context.ignoreCache
How should we call the Select |
Here the original code:
|
Opts it is a new THREE.NormalNode( THREE.NormalNode.WORLD ) |
Great progress! Looking forward to seeing these changes made |
Thanks @DanielSturk! Done the fixes and update the example. The visual result should be the same for both now |
@donmccurdy following your tip. |
@@ -18,6 +18,22 @@ function NodeMaterial( vertex, fragment ) { | |||
|
|||
this.updaters = []; | |||
|
|||
// onBeforeCompile can't be in the prototype because onBeforeCompile.toString varies per material |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Where does onBeforeCompile.toString
get called?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't see anything calling toString()
in these PRs?
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In 15674 have a commit calling toString
07236bb
The description of the problem:
#15674 (comment)
I think that this approach will be improved in the future...
three.js/src/renderers/webgl/WebGLPrograms.js
Line 249 in 7fe9a41
array.push( material.onBeforeCompile.toString() ); |
@sunag thank you! :) In words, how would you define 'analyze', 'parse', and 'flow' as they relate to NodeMaterial? I'm having some trouble understanding what "analyze" means — the word usually doesn't imply side effects, but in this case |
Primary process
Secundary process
The process superficially is similar to this diagram: |
|
Thanks! I'm confused, but I appreciate the detailed writeup. Probably I need to read the code more and see what calls what. 😅 |
@donmccurdy should I merge this one for now or do you want to take a closer look? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good to merge. 👍
Thanks! |
This includes fixes and example of @DanielSturk, irradiance feature and better interface for Color Space using nodes.
Related:
#16788
#16668
#16375
Changes
Math1Node
,Math2Node
,Math3Node
toMathNode
ColorSpaceNode
webgl_materials_envmaps_hdr_nodes.html
Node.parse
toNode.analyze
Node.buildCode
toNode.flow
Node.eval
toNode.parse
NodeBuilder.optimize = false
toNodeBuilder.context.ignoreCache = true
LDR
,HDR
andRGBM16
RectAreaLight
https://rawgit.com/sunag/three.js/dev-fix-TextureCubeNode/examples/index.html?q=nodes#webgl_materials_envmaps_hdr_nodes