3
\$\begingroup\$

I want outdoor areas connected with indoor areas. I use the default setup in Unity. But as you see in image, indoor point light affects the outdoor area (through the walls) and the skybox does more environment illumination in the indoor area.

How to fix that?

So, I want a skybox that only affects outdoor areas, and point lights that only affect interior areas.

enter image description here

enter image description here

\$\endgroup\$

3 Answers 3

2
\$\begingroup\$

The point light is shining through the wall because it doesn't have shadows turned on. To fix this, change the Shadow Type variable on the Light component to either Hard Shadows or Soft Shadows, depending on which one you like best. Also, make sure the walls, ceiling and floor have Cast Shadows and Receive Shadows on. This means the walls and ceiling will now block light from the point light from passing through.

The reason the Skybox affects the indoors is due to the Ambient Light in the scene. Ambient Light is light that is added to the object even when it's in shadow. To disable this:

  • Open the Lighting window using Window > Lighting
  • Open the Scene tab
  • Slide the Ambient Intensity slider all the way to zero.

This will disable the ambient lighting.

\$\endgroup\$
4
  • \$\begingroup\$ I checked Hard Shadows but still light was coming through the wall. \$\endgroup\$
    – Wildfire
    Commented May 26, 2017 at 20:53
  • \$\begingroup\$ @Wildfire Did you enable "cast shadows" in the Mesh Renderers of the walls and "receives shadows" in that of the terrain? By the way, be careful not to overdo it with shadow-casting lights. They can be a real performance killer, especially when they overlap. \$\endgroup\$
    – Philipp
    Commented May 26, 2017 at 21:02
  • \$\begingroup\$ @Philipp , yes, this was the issue. Could you tell me when importing fbx, should I check lightmap UV if I didn't UV the model? Could this be an issue in Unity? \$\endgroup\$
    – Wildfire
    Commented May 26, 2017 at 22:10
  • 1
    \$\begingroup\$ @Wildfire The Generate Lightmap UVs function creates a second set of UVs for Unity to use when baking GI. It will work even if the model doesn't have UVs. \$\endgroup\$ Commented May 27, 2017 at 7:30
1
\$\begingroup\$

You could try these solutions:

  1. You can set the wall objects layer to "Indoor" and uncheck the layers from point light's Culling Mask which you don't want that Point Light to affect (You should set your plane object's layer something not "Indoor" in your scene). Also uncheck the "Indoor" layer from the Directional Light's culling mask property.
  2. Use dynamic shadows to compensate the areas you dont want to be affected by some specific lights, which is completely the hardest solution to implement for this problem.
  3. Try not to use point light. And you should decide which other one could be used for your desires.

And there are other solutions for Unity Pro but I guess you are using not that one. If you do, check this page for further info. Hope this helps!

\$\endgroup\$
2
  • \$\begingroup\$ I think I have problem with directional light and skybox. Directional light is weirdly creating light emission on indoor edges. Eliminating that with layer it works but creates unrealistic prefab. Like it's not belonging to the scene. \$\endgroup\$
    – Wildfire
    Commented May 26, 2017 at 20:56
  • 1
    \$\begingroup\$ Actually I have tried the approach that Philipp posted above and it works perfectly fine. Make sure that you have completely disable the Ambient Light by sliding it down to zero. \$\endgroup\$
    – Tolga Şen
    Commented May 26, 2017 at 21:42
0
\$\begingroup\$

Just wanted to add more additional info to this thread. If you happen to be working on an interior and the mesh / wall is solid on the inside but transparent on the outside, light will pass through the mesh illuminating the interior unless you switch the Cast Shadows box to 'Two Sided'. This will block light from passing through the open sides of a mesh.

\$\endgroup\$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .