Today, I follow the https://threejs.org/examples/?q=mul#webgl_multiple_renderers example.
And I found that when you use multiple renderer to render the same scene and change the texture ( I change the .map property) of the model, only the first renderer will response to the change.
I fix it by set the ".needsUpdate" to true after the first renderer's render(), then the second renderer can response the material's change.
It seems like that each renderer has its own cache, and when the first renderer complete render, it set the needsUpdate property to false so that the second renderer can't know the material's change.
I consider that a renderer manager will be the essential solution to this problem. In addition, use multiple viewport and multiple canvas instead, like in other examples, is not powerful enough. Multiple renderer is more useful and convenient in some case so hope can solve it : )
Thanks for reading ~ I will set the ".needsUpdate" property to true by myself in current case.
I'm assuming this is similar to the problem I've been having, exemplified here: https://codepen.io/anon/pen/jZBVaG?editors=0010
While the workaround is quite simple to implement in the codepen above, keeping track of this in a code-base where the different renderers have no knowledge of each other is much harder. On the surface, it seems like this could be fixed by making needsUpdate a property that increments a material version, similar to what is used elsewhere in the code base.
For reference, this is the executive summary of that codepen:
renderer1.render(scene, camera);
renderer2.render(scene, camera);
mesh1.castShadow = true;
mesh2.receiveShadow = true;
mesh2.material.needsUpdate = true;
renderer1.render(scene, camera);
// This line is needed for second renderer to pick up shadows on mat2:
// mesh2.material.needsUpdate = true;
renderer2.render(scene, camera);
@vidartf did you find a proper workaround for that issue? I suppose this was for pythreeJS?
@Mugen87 Would you like to give this a go? Seems like we just need to implement versioning to Material
?
Would you like to give this a go?
You bet! 馃槉
Thanks a lot for your work, that's awesome!
Most helpful comment
You bet! 馃槉