Force a node to rebuild
Makio64 opened this issue · 6 comments
Description
Add ability to force a node to rebuild.
PS : It might already exist, but for example how to force scene.backgroundNode
to rebuild ?
Solution
node.needsUpdate = true
Alternatives
node.rebuild()
Additional context
No response
In which context would you need to update only a node?
If it's for a material material.needsUpdate = true
should work, otherwise in the context of postprocessing postprocessing.needsUpdate = true;
@RenaudRohlinger : In the context of the scene.backgroundNode for example ( I’m not sure if internally it use a material?)
I guest it might exist other edge cases ?
Technically scene.backgroundNode
simply creates a new NodeMaterial
so it's the same, but for this particular case we would indeed need a way to mark the generated backgroundMesh
from backgroundNode
to needsUpdate = true
but the logic should stay basically the same.
Maybe we could mark a material as needsUpdate = true
if one of its node has its version incremented. However, this approach might introduce some overhead in the renderer pipeline for what is essentially an edge case.
@RenaudRohlinger Oh thanks I was wondering about it. I angree introduce automatic needs update is not a good solution as it can introduce a lot of overhead and dev can easily control this.
Just before closing this issue, is there a way to access to the backgroundMesh.material ?
Post initial compilation of the backgroundNode:
console.log( renderer._background.get( scene ).backgroundMesh.material );
Got same troubles for the scene.fogNode, it does not rebuild !
@RenaudRohlinger