Realtime light not working with static geometry

Hello,

I might be missing something but it looks to me that (in 5.4.2p2) real-time lights are not working correctly with static geometry. The picture attached is a very simple setup:

  • Floor and walls are static but the right one
  • The sculpture is non static geometry
  • Directional light in mixed mode
  • Spotlight is real-time (red colour)
  • Pre-computed real-time and baked GI are enabled with default parameters
  • Render path is deferred with linear colours

What I’m getting:

The spotlight direct illumination is visible at the non-static geometry (sculpture and right wall) but not affecting the back wall that is static geometry. Bounced light from the spotlight is visible at the floor though.
If I enable “Important GI” to the back wall the direct light is visible.

I was expecting the spotlight to affect both static and dynamic geometry. Am I wrong and this is the expected behaviour? Am I missing something to make it work as I want to or is this a bug?

Try the mixed mode experimental builds.

I can make it work with the experimental build. But does that mean that is not possible to do it with 5.4? Do I have to disable baked global illumination altogether to have realtime lights?

Set them to realtime if you want them to be realtime.

The (initial) problem is that realtime lights does not produce any direct lighting on static geometry.

Can you share that scene?

(are you on deferred? Do you have more than 1 pixel light set in Quality Settings?)

Hi,

First thank you for your time.
The project is on deferred (linear colours) and the number of pixel lights is set up to 4.
I am attaching the project to reproduce it.

2838021–207017–LightingIsBroken.zip (29.3 KB)

I found the issue.

It’s the directional light. It’s set to mixed and that somehow interferes with the spotlight (for reasons unknown). Changing the Directional Light to Realtime or Baked, makes the spotlight work properly.

I would suggest avoiding mixed mode in general. It was more or less completely broken and while they fixed some things, it still causes more issues than it solves.

Either use the experimental mixed build if you want to use mixed mode at all, or wait for the changes to make it into the main builds (hopefully for 5.6?).

I will investigate this.

Doing our best to get it ready for 5.6 :slight_smile:

1 Like

AcidArrow thank you.
I tested it and you are right, as soon as my directional light is set to “baked” or “realtime” the spotlight works just fine.

Kemalakay. I made a few more tests:
It looks like the problem comes from the combination of type of light, mixed baking and having shadows enabled. Same directional light in mixed mode with no shadows works fine, but hard or soft shadows makes the problem appear. Spot and point lights with shadows in mixed mode works just fine as well.

Hey @oscarsc and @AcidArrow ,

Just a quick update: New light modes are now released in 5.6.0b2, you can download it from here: https://unity3d.com/unity/beta Please refer to release notes for known issues, we’ll address them within the beta cycle.

With the new shadowmasks feature, you can now use spotlight and point light to cast shadows on both dynamic and static objects. Mixed lights are now called as Stationary lights in Unity and I would like to emphasize that in new light modes, direct lighting is still calculated at run time, so materials on static meshes will retain their visual fidelity including full physically based shading support.

We also prepared a documentation for this feature, you can read and find out the details here: https://docs.google.com/document/d/116JvLXljfbdfllOLlyzVvWmNWpbUwcYKV16blVHuS2E/

Feel free to ask any questions or raise any problems you encounter.

Thank you

1 Like