Three.js How to add multiple Pointlights

I have a tunnel model in which THREE.PointLight is used for lighting, and now there are 28. Could you please add 28 THREE.PointLight to the Three.js scene at one time? If the performance cost is too high, please tell me how to optimize this point? thank you

1 Like

You are, thinking reasonably, allowed to use at most 8-10 lights in the scene. Due to the way three calculates light information - using more than that will start dragging the performance down (the lower-end the device, the faster FPS will converge to 0.)

What you can consider is to create a pool of 8 PointLights, and use them to lit up only the lights that are close enough to the camera (if a light would be too far away, it would not be visible and would not affect the materials in the scene.)

And if you really need tons of lights - your best bet would be to go either with this, or pinging @DolphinIQ so he’d teach you how to write a DeferredRenderer for three.js (deferred rendering allows almost and unlimited amount of lights in the scene, but has it’s own pros and cons.)