I am thinking in the next NodeMaterial update create refractions materials and possible probe lights. I am plan starting with an individual renderer collector objects, maybe a THREE.FrustumObjectCollector? like how:
this.collector = new THREE.FrustumObjectCollector();
this.collector.sortObjects = true;
//...
this.collector.projectObject( scene, camera );
//...
renderObjects( this.collector.opaqueObjects );
renderObjects( this.collector.transparentObjects );
This can optimize Post-Processing too since transparentObjects and opaqueObjects list can be shared in others renderer call using a shared collector like how:
var collector = new THREE.FrustumObjectCollector();
collector.projectObject( scene, camera );
//...
// this.render = function ( scene, camera, renderTarget, forceClear, collector ) {
renderer.render( scene, camera, texture, false, collector );
//...
renderer.render( scene, camera, texture, false, collector );
I could create a RTT only with opaque objects to pre-generate the cubes to probe lights like how:
cubeCamera.enableTransparents = false;
cubeCamera.updateCubeMap( renderer, scene );
//... ( inside CubeCamera.js )
var enableTransparents = renderer.collector.enableTransparents ;
renderer.collector.enabledTransparents = this.enableTransparents;
//... render all targets
renderer.render( scene, cameraPX, renderTarget );
//...
//... returns to default value
renderer.collector.enableTransparents = enableTransparents;
Something like #9545?
Have you thought of using Object3D.layers to determine the objects that are used in the RTT pass?
that is: set all the objects you want to process in the RTT to be in one layer, which is matched by the layer mask in the cameraPX. I have done something like this, and it works with three.js without modification, also allows much more flexibility that just transparent/non transparent.
Thanks! I did not know the Layers, this is very good. Maybe it solves in Material.layers because a possible problem of MultiMaterial in same Mesh and facilitate to share materials.
Just implemented a similar feature: https://github.com/mrdoob/three.js/commit/83e9745bf928087389764e7bdd903e701ed7f4e8
Thanks!
Most helpful comment
Have you thought of using Object3D.layers to determine the objects that are used in the RTT pass?
that is: set all the objects you want to process in the RTT to be in one layer, which is matched by the layer mask in the cameraPX. I have done something like this, and it works with three.js without modification, also allows much more flexibility that just transparent/non transparent.