Individual renderer collector objects

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;
Three.js version
  • Dev

Author: Fantashit

1 thought on “Individual renderer collector objects

  1. 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.

Comments are closed.