How to block directional lighting on an area

I have a top down shooter with a mix between interiors and exteriors. Because of defered lighting, I’ve been unable to avoid the sunlight (a single directional light) to affect the underground parts of my level.

For now, I have placed a giant roof above all the undergrounds. But :

  • it needs a lot of useless objects,
  • it is not practical in the editor when dezooming (I need to constantly hide/show them)
  • it creates a giant shadow and causes performance warnings (and issues?)
  • most of it : it is not éelegant :slight_smile:

Is there a better practice to avoid that?

*élégant

Why not turn off the directional light when you enter the undergrounds?

This was my first attempt, but the global illumination of the sun is baked for all the level, and does not disapear when the light is turned off at runtime.

I would solve this in a similar way that you have except that the shadow-casting roofs don’t need to also render. In the object’s details go to rendering and set ‘Actor Hidden in Game’ to true. Then in the lighting section make sure Hidden Shadow is set to true.

Now your shadow casters should still cast shadows but you won’t need to manage their rendering.

I found this, it doesn’t work for static light, might work for stationary, check the limitation section

Thanks for your answer, I will continue like this for now. It don’t seem to cause any built warning to have those giant roofs so I guess it’s not a bad solution.

I’m not very comfortable with world composition but can’t it be a solution? Will the directional light instantiated in one level will lit the other levels?

the way I see this now is to set any mesh’s you don’t want lit by the directional light to a different lighting channel than the directional light. Only issue is the outside portions of anything exposed outdoors will not be lit either. Works for indoor ceilings or floors. , but the outside , exposed walls are an issue because then they do not reflect any directional light on the outside.