# Large number of shadows - WebGPU

**URL:** <https://discourse.threejs.org/t/large-number-of-shadows-webgpu/91223>\
**Category:** Showcase\
**Tags:** shadows, lights\
**Created:** [April 25, 2026, 2:36pm UTC](https://discourse.threejs.org/t/large-number-of-shadows-webgpu/91223 "2026-04-25T14:36:33Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Usnul](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/usnul/32/2355_2.png) [@Usnul](https://discourse.threejs.org/u/Usnul)\
**Post date:** [April 25, 2026, 2:36pm UTC](https://discourse.threejs.org/t/large-number-of-shadows-webgpu/91223/1 "2026-04-25T14:36:33Z")

</div>

Been working on shadows for local lights for [Shade](https://discourse.threejs.org/t/shade-webgpu-graphics/66969). Still WiP

[![](https://img.youtube.com/vi/PYmYlfBHabE/maxresdefault.jpg "131 shadowed lights - WebGPU") ](https://www.youtube.com/watch?v=PYmYlfBHabE)

There are 131 lights in the scene:  
1 directional light, which is shadowed with a 3-cascade CSM as before  
130 point lights

The system is fairly complex, with all shadows being drawn to the same atlas, including the CSM.

Here’s what the atlas looks like

 ![image](https://canada1.discourse-cdn.com/flex035/uploads/threejs/original/3X/2/6/26b82c8769dd52198cc7b3ffb7d0485383b5252c.jpeg)

The lights are scored each frame, and we have a fixed update budget, prioritizing most visible lights that occupy largest area of the screen.

There is a catch-up mechanic, that guarantees that if a light is on-screen, it will eventually be updated.

The second piece of the puzzle is automatic resizing. Lights don’t specify a shadow resolution. Instead - we update resolution each frame… well, not really, but we we allow the resolution for each shadow to change each frame.

So if a light is occupying a very small area of the screen - it gets a very small area in the atlas allocated to it. If the light is not even seen currently - it gets the tiniest area possible - 32x32 in this case.

If you look at the atlas, you’ll be able to notice, there are 5 point lights with 1024 resolution,

 ![image](https://canada1.discourse-cdn.com/flex035/uploads/threejs/original/3X/3/9/39bd73fc377c7e0a6be4931e9d5f40be660cf085.jpeg)

a couple with 512,

 ![image](https://canada1.discourse-cdn.com/flex035/uploads/threejs/original/3X/2/7/2742114921a81f399f46802cd7ff9cf236de82c1.jpeg)

a handful with 128

 ![image](https://canada1.discourse-cdn.com/flex035/uploads/threejs/original/3X/0/6/0620f613bec0f4b9ba1348c14b272907f970751e.jpeg)

and a bunch with 64x64

 ![image](https://canada1.discourse-cdn.com/flex035/uploads/threejs/original/3X/1/c/1c40d3ddcc6b46fe38077319ca96d14dac3ba748.jpeg)

There’s a one light that happens to be 32x32

 ![image](https://canada1.discourse-cdn.com/flex035/uploads/threejs/original/3X/8/d/8d9df2aaf8e683c9ffaaef321ba358202b4450e2.jpeg)

And if we move the camera around a bit, the lights that we never seen before get populated as well

 ![image](https://canada1.discourse-cdn.com/flex035/uploads/threejs/original/3X/d/b/dbe43daf723419cfa72f5e0690ff847082ac1a1f.jpeg)

* * *

There’s a lot of trickery that goes into making this work, but it does work, and it runs pretty well. I’m still going to work on separate render pipeline for local lights to squeeze out extra performance for them, but I’m very happy with the current results.

Theoretically - there is no limit on the number of lights, even if the space in the atlas is always going to be limited.

---

<div class="post-metadata">

**Author:** ![druidhawk](https://avatars.discourse-cdn.com/v4/letter/d/f08c70/32.png) [@druidhawk](https://discourse.threejs.org/u/druidhawk)\
**Post date:** [April 25, 2026, 3:23pm UTC](https://discourse.threejs.org/t/large-number-of-shadows-webgpu/91223/2 "2026-04-25T15:23:22Z")

</div>

I am in awe:)

---

<div class="post-metadata">

**Author:** ![Usnul](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/usnul/32/2355_2.png) [@Usnul](https://discourse.threejs.org/u/Usnul)\
**Post date:** [May 3, 2026, 11:05am UTC](https://discourse.threejs.org/t/large-number-of-shadows-webgpu/91223/3 "2026-05-03T11:05:49Z")

</div>

Here’s another one, Bistro scene, 129 light sources in here, all shadowed in real-time.

 ![Screenshot 2026-05-03 115722](https://canada1.discourse-cdn.com/flex035/uploads/threejs/original/3X/6/0/602e24b4382dcf91ef0663d4732e3812befd055e.jpeg)

[![](https://img.youtube.com/vi/hmELF8Tcdiw/maxresdefault.jpg "Shade - 3d graphics in the browser.") ](https://www.youtube.com/watch?v=hmELF8Tcdiw)

All 3 types of lights are present:

- Point lights: light bulbs, hanging pendant lights, street lights
- Spot lights: flood lights on the building facade, bike front light
- Directional light: there’s a faint moon illumination in the scene

Here are just the point lights that can be seen in the screenshot

 ![image](https://canada1.discourse-cdn.com/flex035/uploads/threejs/original/3X/7/4/74304268e2121d41a1678cd36387aeacd40bab99.jpeg)

And spot lights

 ![image](https://canada1.discourse-cdn.com/flex035/uploads/threejs/original/3X/0/4/0491ff68b42c9c8c0836de938ffedb91b954b0c5.jpeg)

---

<div class="post-metadata">

**Author:** ![PavelBoytchev](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/pavelboytchev/32/38639_2.png) [@PavelBoytchev](https://discourse.threejs.org/u/PavelBoytchev)\
**Post date:** [May 3, 2026, 12:24pm UTC](https://discourse.threejs.org/t/large-number-of-shadows-webgpu/91223/4 "2026-05-03T12:24:53Z")

</div>

Looks amazing and scary photorealistic.

Eager to witness the moment when you introduce light sources of any shape (think of rectangular light panels, neon light texts, light billboards of irregular shapes).
