Adding and removing three.js lights at run time

If add new light then delete or clear previous Light object.

Please help me.

I am loading new Object for implemented some task , during loading the object added some light, object position, texture image are loaded.

Again or next new object to be load than previous data should be clear or deleted.

For Example:-
First Object loaded.
Second Object Loaded:-

=> Lights are effecting in second object. I want delete or previous lights during second object loaded.


Why don’t you just remove the lights from the scene graph?

How to remove Light ?
=> Remove Light
I am using this code but not working.

=> Add light:
pointLight = new THREE.PointLight(0xff0000, 0.5); = ‘Light’;

How to remove the previous light??

The code looks correct but you are missing something. If you change the number of lights, you have to update the materials of your scene via material.needsUpdate. See

This fact is also noted in the docs: How to update things, section Materials

1 Like

Its working…

material.needsUpdate is only work for texture image update during.

It is not effecting on Light object.

I have the same problem, I tried hard but my code is still not working. Any help will be appreciated.

My code is here:

Since you are not having an animation loop in your scene, you have to render it again when changing the light settings:

Hi Mehment.

Hope you are doing good!

You are using wrong method for light removing.

You should remove light from the scene.


scene.children.forEach(function (e) {

if ( == ‘Light’) {




Thanks, Mugen87.