Directional light & shadows through objects

Hi everyone,

My team and me are trying to build some light for a project. Unfortunately, we have some serious issues with that.
We have 2 kind of level in our game : outdoor (space) and indoor (space station). We only have one outdoor for now and it’s using a static directional light which is working fine in this level. But when we are in an indoor level, it still light the scene.
I tried to build the lights with or without the level hidden but even if it looks alright in the editor, the lights are still inside when we make a package of the game :frowning:
The game works with the streaming system so the outside level is not even loaded when the game starts.

Right now I’m trying in the editor (I didn’t create a package of the game yet) with a stationary directional light but I’m afraid about the frame rate of the game (which use the Oculus Rift). The outside level is still unload and when we almost reach the exit, I load it and chagne the intensity of the directional light from 0 to 3.5. But another problem appears then :

http://www.hostingpics.net/viewer.php?id=234969buglightdirectionalstationary.jpg

As you can see there are shadows from the walls all over the scene. I tried to check the Double Sided on the mesh properties but it doesn’t change anything.

http://www.hostingpics.net/viewer.php?id=860062buglightdirectionalstationarymesh.jpg

Is there any solution to build the light of the exterior separately from the inside levels ? Or should I continue to use a stationary light and set is intensity

1 Like

Anyone please ?

Hi Robi2005,

I have a few suggestions that may be worth investigating for you. It’s not without it’s own trial an error as you have some very specific setups you’re wanting to achieve.

I’m going to jump in where you posted your first image and explain what’s going on here:

The outside level is still unload and
when we almost reach the exit, I load
it and chagne the intensity of the
directional light from 0 to 3.5. But
another problem appears then : [Image 1]
. . .

As you can see there are shadows from
the walls all over the scene. I tried to check the Double Sided on the mesh properties but it doesn’t change anything

If you’re using a Movable light there is nothing stopping some light leakage except for other assets. Using the “Light as two sided” option only works with baked lighting and not Movable (dynamic) lighting. Also looking at your mesh in your second image I can see from it’s angle that the backside is only single sided and the mesh normals are facing inwards (to the right side). There is nothing to prevent light from passing through here. It would be worthwhile to make the material for this object as two-sided (material parameters in your material), create additional geometry to provide thickness to your mesh, or if no player will ever see the outside of this part of the level use a wall block kind of mesh to block lighting from entering the window.

In the Movable/Dynamic lights you can also adjust the Shadow Bias and Shadow Sharpen Filter to help increase some accuracy for your light.

If you decide to go the route of using baked lighting then using a persistent level that includes no light and then setting up individual sub-levels that would handle lighting for each of those levels specifically would be helpful for getting very specific lighting types.

I hope this has been helpful and if you have any questions feel free to ask.

Tim

Thanks for your answer Tim. I’m trying the two-sided option on the material and it fill the void of the other side of the mesh. But now I have another error when I’m trying to build the light :

http://www.hostingpics.net/viewer.php?id=924901buglight.jpg

So I can’t test if the light building is working with this method right now.

I already tried to build the light on each level individually (that’s also the case with the error above) but I’m still having some light even from levels which don’t have one. It’s like some kind of directional light is still loaded anyway.
I will keep you updated when I resolved the building problem.

Well, it’s not working on one of my level but it’s fine with the others.
So, I tried the two sided material, build the light on the level while keeping all the others hidden and there is the result :

http://www.hostingpics.net/viewer.php?id=615691lightfromnowhere.jpg

But there isn’t any light in my scene. I don’t know where this is come from.

Check your persistent level (the base level) to make sure there is really nothing in this level. If there is a light this will be present in any other levels when visible.

I deleted everything in the persistent level and rebuild the light. I get this result :

http://www.hostingpics.net/viewer.php?id=268367lightfromnowhere1.jpg

There was still some lights in a blueprint object of the persistent but even if it’s now empty, there is still some kind of light on the ground and walls.

If you move everything out of the persistent and build lights for only that specific level will there still be light casting through like that?

There is nothing left in my persistent level. I build lights in it while every other levels are hidden. Then I build one of these level while hiding all the others and I still have some light :

http://www.hostingpics.net/viewer.php?id=316477stilllights.jpg

For not having any lights in one of my level I had to deleted every other levels. So the building of lights level by level isn’t working. I have a directionnal light and a skybox in one of my level and this is the major source of lighting. My other levels were mostly black when I deleted this one.

Couple more things to try bc there’s a light somewhere that doesn’t want to be subdued! :slight_smile:

Make each level visible on it’s own. Place a mesh in there and if it lights up with preview lighting you know there is light source there. I understand there are levels that will have these lights and some should not. This is to test and make sure that there is no light in the ones that shouldn’t have them. For instance, in the persistent if you place the mesh it shouldn’t light up at all if the rest of the maps are not visible. If it does there’s a light in it.

ALso in this image above you have the persistent as not visible. That doesn’t really do anything if you build lighting and it has anything in it. If it has a light in it that light will be baked to every level under it.

If this doesn’t work to narrow it down My next suggestion would be to delete the directional light build lighting and make sure that nothing is there. Then replace the directional light in the level it belongs and see what happens after building lighting.