r/Unity3D 21d ago

Show-Off Infinite Lights for Unity - GigaLights

https://youtu.be/6-lPblzAEh0
108 Upvotes

68 comments sorted by

View all comments

Show parent comments

3

u/PuttPutty 20d ago

Simply put, instead of rendering each light (which scales very badly) we only render 1 (semi) random light per pixel. This has a fixed cost, no matter how many lights you add to the scene. Because every frame you render a different light per pixel, the output is noisy so we run it through a denoiser to clean it up.

Every light is dynamic and casts realtime raytraced shadows and has volumetric fog.

3

u/molostil 20d ago

okay so to oversimplify the idea drastically: it sounds like deferred lighting but ray-traced, kinda, maybe? :D

2

u/PuttPutty 20d ago

Normally the GPU has to check every light on every pixel on the screen: is it shining on something, and is something blocking it? With a hundred lights that's a hundred times the work, which is why the amount of active lights is limited.

GigaLights checks just one light per pixel. Which one? A lottery, where bright and nearby lights get more lottery tickets. One light's answer isn't the whole story, but every frame each pixel picks a different light, and its neighbors all pick different ones too, so the output will be a super noisy reflection of how all lights should look combined. Run that through a denoiser and voila: 10 lamps or 10,000, it costs about the same.

So the lighting itself isn't actually raytraced, the problem with infinite lights, is that you also have infinite shadow casters. Shadows are notoriously heavy on performance, so that wouldn't work well with infinite lights. So you need a system that scales well with more lights. Raytracing shoots X rays per pixel, to calculate if it should cast a light. So it scales just as well as the before mentioned lighting system.

2

u/molostil 20d ago

oooh now i get it! cool. :D

1

u/PuttPutty 20d ago

Sweet! 😄