Best way to "turn off" a light

lights

#1

Just wondering, performance wise what is the best method for disabling (toggling really) a light?

I’ve seen this, but it’s old and see no mention of the “visible” property in the docs.

Will setting intensity to 0 work or should I remove the light from the scene when it’s “off”?


#2

As an option, set light’s colour to black.


#3

And this would yield the same render performance as removing the light from the scene?


#4

I’m not sure about that.
Do yo have so many lights in your scene that it causes problems with performance?


#5

I would do this:

light.visible = false;

For testing: https://jsfiddle.net/f2Lommf5/2730/

It’s a property of Object3D.


#6

Awesome, thank you.