If you have a reflector and it’s not visible, will it still render the scene in the reflector?
No, will not render. Because the reflector itself is filtered out by three’s frustumCull logic, so will not trigger the
onBeforeRender hook, thus will not render the reflected scene.
What if its visible, but its not facing the camera (i.e. its surface normal is facing a way from the camera).
Will not render. These codes at the very top of Reflector.js’s
onBeforeRender hook already checked this:
// Avoid rendering when reflector is facing away
if ( view.dot( normal ) > 0 ) return;
If it’s partially visible, and lets say some of the pixels are occluded by another object, are the occluded pixel values still computed?
Will render. Because internally use a standalone virtualCamera which from a different angle of view of the main camera, thus may hard to check the occlusion. And seeing from the output of the internal renderTarget, it really rendered every pixel.
If it still renders when its not visible, or if it is visible but not facing the camera, is there some boilerplate function to determine if a plane is visible to a camera, and it’s normal faces the camera, that can be used to turn the reflector on/off?
Because Reflector.js and three’s frustumCull logic already cared about them all, so do not need do it by self.
Regarding the occlusion part, I also plan to try to optimize it, but the priority is relatively low.
This is the result of my understanding and testing. Please point out if any errors.