Stopping ambient light entering a building interior? How?

Hi

Ive just added interiors to a model pack im working on, but the directional main sunlight shines through the mesh into the interior. How do i set up the mesh so light simply passes through the open doorway?

Any help would be greatly apreciated

Thanks

Steve

Turn on shadows (if you have Pro). If you don’t have Pro, or even if you do, you can bake the lighting into a lightmap in your 3D app instead of using lights in Unity.

–Eric

HI

Thanks for the reply.

I do have pro, and have shadows turned on, but still the inside is fully lit?

Steve

I have this package I uploaded to another thread somewhere; maybe it will help.

–Eric

121714–4584–$lighttest_150.unitypackage (913 KB)

HI

Thanks for that, but its probably a little bit too complex for me at this stage - with the sunlight script etc.

Is there no way to simply stop the light flooding into the interior?

Thanks

Steve

The point is not the scripts, which you can ignore, but the light setup. Just take a look at the project without running anything.

Lights in realtime 3D illuminate all objects within range, which for directional lights is everything, and lighting for each polygon (or pixel) is computed individually with respect to the light, taking no other polygons into account. With realtime shadows in Unity, you can simulate the effect of objects blocking light, with some limitations (the main one being that anything outside of the shadow range obviously won’t be affected).

–Eric

HI,

Ok, ill take a look now, i thought it was the script i needed to check out.

Also, something else which is making it actually hard to zoom into an interior - is that the camera wont go through the mesh in the scene editor - does this happen when object collision is turned on for the mesh?

Thanks

Steve

HI

I notice though that your sun light is referencing that sun light script, however all the other lighting settings are the same as yours, except for colour differences in the sunlight.

I did notice though on your model in the scene, that inside the building it was still quite light, but i could clearly see the light was only coming in from the doorway

Steve

There isn’t any collision for the scene editor camera; you might have the focus on some object which is making it hard to move relative to what you want. Try putting the focus on some other object, like the first person controller.

That’s ambient lighting; turn it to 100% black if you don’t want any. In real life, light bounces around a lot, which is what ambient light simulates. It’s far too slow to do accurate lighting in real time, so you have to do a bunch of “hacks” to get the look you want. Also a shadow strength of less than one lets light from the light source “show through” to some extent, depending on the strength you use.

–Eric

There’s a good Tutorial on how to do that: http://www.willgoldstone.com/learn/index.php?currentPage=unity_lesson2&currentPart=unity2_6

Adding to the tutorial I think it would be a good idea to separate the polygons inside the houde to a separate object and then exclude only that inner object with the help of a tag from the outer light.
So the exterior will still recieve lighting while the interior won’t. depending on your setup there might be a visible seam between outside and inside, though. So you might want to think of a few more tricks to conceal it.

Thats a nice tutorial, the only problem is, is that the way its done there, is that the house is excluded from the main directional sun light, to stop any light from affecting the building, which is not really a desirable effect, as it wont cast shadows on the terrain, and the light from outside will be dark.

THis is harder than i expected!

Steve

Just put the interior meshes of your house into one layer and the exterior into another.

Yeah… thats a great idea.

This information is for a new medieval city pack which im going to be releasing in the next few days, via my site Arteria3d.com

http://www.arteria3d.com

Everyone who has contributed here thus far, will recieve a discount voucher for 80% off the cost, as a gesture of thanks for the help recieved again from this great community

Best Wishes

Steve

I made the interior a separate mesh, added it to a new layer, and excluded this from the main directional light - works a treat! Now i have my nice lights inside the interior working really well, is there a way if i add some fire particles to the medieval fire, that they could cast shadows inside as they move?

Thanks

Steve