#URP - Light leaking on vertical walls

1 messages · Page 1 of 1 (latest)

dark aspen
#

Hello,

I'm attempting to light up scene using Mixed lighting, however one problem that persists is that the light seemingly leaks onto the other side of the walls, despite the other meshes (floor) are lit up correctly. You can see what I am talking about on the first picture.

The walls remain bright even if they should be nearly pitch black, just like the floor is.

My settings are:

  • Environment has 'Environment Lighting' set to Color and Black. Environment reflections are set to Custom with no Cubemap supplied. Without any lights, the scene is pitch black.
  • The light in question is a point light, it doesn't matter which Mode it is using, however Baked at least makes the lighting on the floor look correct. The light is using Hard Shadows. The culling mask and rendering layers are set to Everything.
  • The meshes are Static, Static Shadow Casters and receive GI from Lightmaps. Using Two-Sided shadow casting doesn't solve it.
  • I tried increasing all the Lighting 'Scene' settings to maximum, which helped slightly, but didn't solve the issue. I included my current settings in a screenshot.
  • I included the Rendering Asset settings in the screenshot as well.

However hard I tried, I could not get the right result where the walls in the back are correctly lit (black), without there being a constant amount of light present (which is not ambient, I have that disabled).

I've considered splitting the mesh into separate parts, since the walls are one big mesh, with the exception of the floors.

How should I approach this? What else should I try? Do you see error in my settings?

Thank you for any suggestions.

#

To give more details, the Realtime lighting fully passes through the walls, if I am using Per-Vertex Lighting. It simply ignores them. Per-Pixel lighting works correctly, though.

drifting hamlet
#

If it is, confirm that the mesh has lightmap UV generation enabled in its import settings with minimum lightmap resolution matching your baked lighting resolution

dark aspen
#

Thank you very much. I didn't have lightmap UV generation checked, which solved the light bleed when baking the light.

However, the realtime portion of the light is still bleeding. On the next screenshot, I set the light to be 'Realtime' and I cleared the baked data. Otherwise, the settings remain the same as in the screenshots above.

I will try to look through the import settings, if there is something that could affect this as well. I tried different Near Plane and Bias settings, but to no avail.

On the screenshots below are my settings for the mesh and the import settings:

drifting hamlet
#

Are the light's settings still same as here

#

but realtime instead of mixed?

#

Confirm that "additional lights" are per pixel, not per vertex

#

Then create some default cubes (without changing their scale) and see if you can make them cast shadows on each other

dark aspen
# drifting hamlet but realtime instead of mixed?

Yes, I am currently using the same settings, except Mode is set to realtime.

Using Per-pixel option solves this - however shouldn't I be able to make use of Per-vertex lighting without the realtime lighting passing through walls?

As for the lighting setup, I am only using this single light, so the Per-vertex light limit is definitely not reached.

drifting hamlet
#

Per vertex lights don't support shadow casting at all

#

In vertex mode the lighting is calculated only for each individual vertex
So the information about the geometry between them that could occlude light isn't there at all

#

It'd be possible with a custom shader, but because raster shadowcasting is much more expensive than fragment (per pixel) lighting, it's not worth the effort if optimization is the goal

dark aspen
#

I see, thank you for the explanation. In that case I am stuck with per-pixel if I want to be using Mixed lighting with correct shadows. I am using a forward+ renderer.

In that case if I wish to optimise the lighting, the best bet is to keep most of the environment lights as Baked, and set only few instances of lights that should be dynamically casting shadows to Mixed? While keeping 'Additional Lights' globally as 'Per-Pixel'.

What would be roughly the performance impact of using Per-Pixel lighting with many light sources set to 'Mixed', if I wanted to have roughly 4 light sources per room? What I mean is really a rough estimate, to know what is idiomatic in Unity development; to stop myself from accidentally doing something that should never be done.

drifting hamlet
#

Baked lighting is practically free, unless you have very big lightmap textures
Mixed lights are same as realtime but potentially with additional lightmap textures and blending operations if using shadowmasking
But in 'baked indirect' mixed doesn't add a cost over realtime

#

Forward+ may have some overhead cost but makes realtime lights nearly free with limits in the hundreds on PC, cost relative to light range and range overlap on screen

#

But realtime shadow casting is more expensive than anything else, maybe more expensive than everything else combined
Each shadowmap is a newly rendered camera perspective, though depth only
Spot lights have one shadowmap, point lights have 6

#

So, shadowcasting hugely more expensive than pixel lights
Pixel lights hugely more expensive than baked lights
Anything more specific is up to your testing, but that's the rule of thumb

#

You can get shadows against dynamic objects from purely baked lights too, with the help of light probes, though not very accurate maybe adequate

#

APVs can get much more accurate, but can't say where their rendering cost typically settles at

#

Realtime lights even with shadows only have to exist locally so they can be culled
APVs are more of a scene-wide thing