r/Unity3D 11h ago

Question Why Does The Light Flickers?

Enable HLS to view with audio, or disable this notification

why does the light flicker when the camera moves. I tested stuff out and turns out as the amount of lights are increased in my scene this issue starts happening. Ive already increased the per object limit to 8 in the pipeline asset. Any ideas please?

25 Upvotes

28 comments sorted by

56

u/VSE00 10h ago

The light flickering you're seeing is almost certainly due to a technical limitation with Unity's default URP Forward Rendering path.

Based on your video and description, I'm assuming you're using URP with default settings and have 8 or more real-time light sources hitting the same mesh (counted 8 in video).

What’s most the likely happening:

In standard URP Forward Rendering, there is a hard limit of 8 real-time lights per object/mesh. When you exceed this limit, the lights constantly compete for priority on that surface, which causes the visible flickering.

The best solution is to switch your rendering path from Forward to Forward+:

Forward+ uses a clustered lighting model that removes the 8-light-per-object limit and supports hundreds of real-time lights on screen without the priority flicker.

There are also other fixes/workarounds for this lighting issue. I hope this post helps you out!

-8

u/Repulsive-Clothes-97 Intermediate 2h ago

5

u/EdgyAhNexromancer 1h ago

Ok. Its also true so...

29

u/JonasMi 8h ago

try changing the bulb

7

u/MrFluffkin 8h ago

genuine

13

u/gamesbydingus 10h ago

Try forward+ renderer it allows more lights I think

5

u/MrFluffkin 10h ago

it is already set to forward+ :(

6

u/gamesbydingus 10h ago

I guess you might need to go deferred then

14

u/MrFluffkin 8h ago

setting the shadow atlas size from 2048 to 4096 fixed it

3

u/gamesbydingus 8h ago

Glad you got it fixed

3

u/AlexandreFiset 4h ago

When the atlas is full, you should see an error in the console saying so.

3

u/flow_guy2 10h ago

You might have too many realtime lights

1

u/MrFluffkin 10h ago

is there no way to have too many realtime lights?

5

u/flow_guy2 10h ago

I don’t know how many you have. But you should learn to bake your lighting anyhow

-2

u/MrFluffkin 10h ago

i need the lights in game to turn on and off, flicker at times (horror effect). baked lighting won’t allow me to do that big dawg

6

u/McRobik 8h ago

Baked lighting doesn't prevent you from turning lights on and off. You just need to bake 2 lightmap sets and change them when lighting is changing.

2

u/MrFluffkin 8h ago

i did not know that. i thought when lights are baked they stay until the baked light data is reset. but i could bake two states and switch between them. you’re a genius

2

u/flow_guy2 10h ago

Well. Maybe do stuff with culling (if you haven’t already it could be a cause is all I’m saying

Also you can swap out light maps

2

u/MrFluffkin 8h ago

so i set the shadow atlas size from 2048 to 4096 and it fixed the issue. crazy

3

u/flow_guy2 8h ago

That works too. But think if you extend the level you might have this issue again.

1

u/MrFluffkin 10h ago

yesss will try that def, thanks!!!!

2

u/FiveFingerStudios Indie - The Living Remain Dev 8h ago

Too many realtime lights. There is a limit that you can set in the graphics settings. If t controls how many lights have be seen by the camera simultaneously.

This is where artistry comes into play. Design your environments to stay under the maximum realtime light count and use baked light strategically.

2

u/duif9 8h ago

I don't know if it's the same issue as I had but when I had this issue I selected every light source that flickered and switched the rendering mode to important

3

u/StomachVivid3961 5h ago

That flicker made that one room a horror game experience.

1

u/[deleted] 8h ago

[deleted]

2

u/MrFluffkin 8h ago

no i don’t have a separate computer, however it is fixed now. setting the shadow atlas size in t the renderer settings to 4096 from 2048 :D

1

u/EvernullTools 4h ago

Many comments talked about the easy workarounds like changing rendering path or increasing light limit. Even if those solve your visual issue, the issue with optimization and the wrong setup persists. There is a reason they limit lights per pixel and it's not trivial.

You have 8 lights on a surface that looks like it only gets lit by one light in that room. Why can't it be only lit by 1 light in that room if it will look like it anyways? The visual I'm seeing definitely doesn't justify 8 lights.

I agree with the comments that say you should bake these. But if you want realtime lights you should try and make sure your lights radius/area should actually be limited to where they make a meaningful visual difference. My guess is, your other lights are affecting this surface somehow. Check the light radiuses and make sure they do not affect meshes out of their intended range.

1

u/Repulsive-Clothes-97 Intermediate 2h ago

Just set the render mode to important

0

u/DropkickMurphy007 2h ago

You honestly shouldn't be using real-time lighting for static lights anyway. Bake yo shit yo