-
-
Notifications
You must be signed in to change notification settings - Fork 35.5k
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
Rework how NodeMaterial is built and make other updates #23797
Conversation
@LeviPesin I think we're going to need compatibility for non |
For this I added the function |
I think it would be better |
I think that with Materials it would be easier to keep track of whether it is MeshBasicNodeMaterial, MeshStandardNodeMaterial, or so on (and also with NodeMaterial.fromMaterial NodeMaterial should import all other materials which will create another circular inclusion problem). |
I think It doens't look like a common function style of TJS The other reson it that it currently does not bind @Mugen87 @mrdoob
|
It is not a part of Materials class API, it is just a function exported from the |
I see, I think that is more a reason to change. I think it would be more appropriate for us to follow this rule for now:
|
I am not sure that I understand what "does not bind NodeMaterial dependencies in the core" means... The main problem with |
I fixed a circular dependecy in |
Another approach I wanted to test is create a static lib where we can add the classes without need to extend the function... |
This is a good idea - i.e. make materialsLib empty by default and extend it in each Material class. But I think it should be a separate PR. |
@sunag So what is your opinion about node material conversion function? If you think that it should be made |
Sorry for this! I some moment I thought you were editing |
Can you please test the original (i.e. before this PR) WebGPUNodeBuilder with the code
changed to
? When I've tested it locally it was working the same as before the PR. And this cannot be an issue with the BypassNode - |
Set a let vertex = positionLocal;
if ( this.positionNode ) builder.addFlow( 'vertex', assign( positionLocal, vertex = this.positionNode ) );
if ( builder.object.isSkinnedMesh ) builder.addFlow( 'vertex', vertex = skinning( builder.object ) );
builder.context.vertex = vertex; |
…three.js-1 into rework-node-materials
It is possible to notice in two Skinning examples that |
@LeviPesin Still this fix break Skinning Points. It is safer to introduce the BypassNode to leave the assigns in the final process. I think that it can be only |
But in SkinningNode it can be fixed changing |
I think that are not the same thing...
let vertex = positionLocal;
vertex = bypass( vertex, displace( .. ) );
vertex = bypass( vertex, morpher( .. ) );
vertex = bypass( vertex, skinning( builder.object ) );
// This will process all vars, cache, etc before returning positionLocal to the output |
OK, I will revert the changes to BypassNode and add it to ShaderNode. |
@sunag So what do you think about WebGLNodeBuilder? Is there a way for it to use the |
In case of the user use the property We still don't have some optimizers for |
I meant the scene lightNode (and fogNode), similarly to how it is done in WebGPUNodeBuilder. If we add some code to construct them, then we can remove a large part of the WebGLNodeBuilder (that allows using "native" shaders) and replace it with just
I am not sure that even WebGPUNodeBuilder's current optimizers are working too good... See #23728. |
Thanks!! 👍 |
@sunag Now ShaderNodeUtils does not work, because there is no function |
I will fix this.
not all arguments must be |
OK. Will think how it would be possible to construct LightNode and FogNode in WebGLNodeBuilder... |
The implementation is similar to what already exist, the problem here is to reuse variables created in WebGLRenderer as normal and position calcs for the lights and others. This is the optimization I'm referring here. |
Can you please share it? |
* Rework NodeMaterial and make other updates * Fix DeepScan issues * Fix DeepScan issues * Cleanup * NodeMaterial.fromMaterial() * Fix * Revert BypassNode removal * Fix * Split ShaderNode into two parts * Fix * Fix * Another fix * One more fix * Apply suggestions * One more fix * Move ShaderNodeUtils to core * move ShaderNode* to ./shadernode/ and fixes * fix from deepscan Co-authored-by: sunag <[email protected]>
Related issue: -
Description
The main change in this PR is to replace WebGPUNodeBuilder._parseObject and WebGLNodeBuilder._parseObject with NodeMaterial.build.