-
-
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 doesn't always recompile #18347
Comments
It can be a problem if the proposal is to share the same shader program with other materials. Do you already try to add this.onBeforeCompile = function ( shader, renderer ) {
var materialProperties = renderer.properties.get( this );
if ( this.version !== materialProperties.__version ) {
this.build( { renderer: renderer } );
shader.uniforms = this.uniforms;
shader.vertexShader = this.vertexShader;
shader.fragmentShader = this.fragmentShader;
this.needsCompile = false;
}
}; |
No, that doesn't work. |
This change worked for r111 and r112, but is no longer sufficient for r113. |
/ping @sunag Any ideas? I don't feel like making a PR for something potentially troublesome. |
@njarraud @rclankhorst You can test now with the current |
Should be fixed via #19833. I think it's okay to close this one. It can be reopened if there are still recompilation issues with |
Description of the problem
NodeMaterial is only recompiled the first time the needsUpdate flag is set to true if the WebGL program cache key doesn't change. I believe that this is due to the fact that now material recompiling is based on version and not only on this needsUpdate flag.
To fix this issue, onBeforeCompile.toString method of NodeMaterial shall return the material version instead of the needsCompile flag. It will force programCacheKey to be different and therefore the material will recompile as requested by the needsUpdate flag.
Three.js version
Browser
OS
\ping @sunag
The text was updated successfully, but these errors were encountered: