[SOLVED] Lighting artifacts when using clustered lighting

Hey guys,
I’ve been noticing that recently I’ve had tons of lighting artifacts popping up from dynamic lights in my scene when using clustered lighting. This didn’t happen a couple of weeks ago and I haven’t changed anything with the lights or materials since this started happening, so I’m thinking it must have been some side effect of the update that overhauled the clustered lighting recently.

Here are some examples of what I am talking about.

image image image

I’ve tried modifying the material properties to see if I could get it to fix, but the result is the same no matter how the material’s properties are set, so I think it must be something to do with the lighting system. I’m not really sure where to start with debugging this and any help would be much appreciated. Thanks!

Can you check against the previous minor version of the engine to double check please is from a change in the engine?

You can do this in the Editor via the settings:

1 Like

Switched back to previous version (1.49.4) and it looks like I’m still getting the artifacts, so I guess that wasn’t the issue.

Any Idea on what might be causing this? I really don’t remember seeing it at all until recently. And I haven’t changed anything about the materials or lighting for at least a couple months, at least not until today.


Any chance of being able to isolate this in a small public project for someone to look at?

Just double check, the issue is the black shapes that are randomly in the lighting?

Yeah! It’s like small shaped areas of the mesh are just being rendered as unlit for some reason. The shape changes as the camera orientation shifts around.

I’ll see if I can reproduce it in smaller project

Alright, it took a bit but I’ve got a project that reproduces the issue. It happens a couple seconds after you launch the project, to the lights near the end of the tube.


Here’s the project:

1 Like

I think this value is too small perhaps?
pc.app.scene.layers.clusteredLightingMaxLights = 18;

Is that number supposed to represent the max total amount of lights in the game at any given time?
I was under the impression that it was the max amount of lights in any single light cluster, since if you set it too low you get these errors:

What should that option be set to?

it should be max number per cell … otherwise you get warning.
I tried to bump up the number and the blocks went away … so I assume there’re more lights in a cell? You have pretty small number of cells as well.

yeah that’s true, when I changed the option to a higher value the artifacts seemed to have disappeared. However when it’s set to 18, I don’t get any warnings in the console either, so I’m not sure why the artifacts are appearing. I suppose for now I can just bump that value upward until the artifacts disappear, however I’m concerned about it effecting performance as I’m already near the hardware limits of our target devices.

It also seems that decreasing the size of the cells fixes the artifacting issue. Which would you recommend for better performance? increasing max number of lights per cell, or decreasing the cell size?

having more cells costs a bit more on CPU as it needs to be filled with lights every frame.
on the other hand less cells means more lights in a cell, so more GPU cost.
So depends on what you need to save. But in general, I think you had values around 5 or so … that is low. I’d go to maybe 8 or 10. Your level is a tube, so have more subdivisions around the long axes of your level … lets say its Z (in world space), then set it to maybe 4x4x30 or so.

Awesome, Thanks for the information! This will definitely help, I’ve decided to reduce the size of the cells since the only performance I’m worried about is related to the GPU. This seems to have fixed the issue completely.

The tube curves unpredictably along all 3 of the world axes so it isn’t really possible for me to prioritize one cell size axis over another. Still good advice though!