Latest  | Search | Go
Edit this page   |   Attach file 

  Home | Tutorials | Technical Reference | Runtime | API Documentation | IndoorOutdoorLighting  


Indoor & Outdoor Lighting

Author: Jeremy Stieglitz

IndoorOutdoorLighting.jpg


The Concept of Indoor vs Outdoor Lighting

In your levels you might want both an exterior, lit by a Directional Light (such as the dynamic Day/Night Light used in the DynamicSkyTutorial), along with an interior that is lit by indoors point Lights. You won't want your exterior Directional Light to affect your interior, and you won't want your interior Lights to bleed through the walls into your Exterior. This tutorial covers the steps necessary to keep indoors Lights inside & outdoors Lights outside, on both static Prefabs and dynamic Actors.

Setting Outside & Inside Flags on Lights & Prefabs

Every Light has an 'Outside' boolean Property and an 'Inside' boolean Property. All Actors have these two Properties, 'Inside' and 'Outside', including Prefabs & Dynamic Actors. A Light will only affect an Actor that shares its value for either 'Inside' or 'Outside' (and that shared value must be true). By default, all Lights and Actors have both Inside = true and Outside = true. This means that by default, all Lights will affect all Actors. But you can change these Property values for Lights and Actors to ensure that Lights will selectively ignore certain Actors or Prefabs.

InsideOutsideProperties.jpg

Namely, you'll want to set all your indoor Lights to Outside=false, Inside=true. You'll also want to set all your indoor Prefabs to Outside=false, Inside=true. That will ensure that your indoor Lights only affect your indoor Prefabs. Then you'll want to set all your outdoor Prefabs to Outside=true, Inside=false. The Day/Night SkyLight used in the DynamicSkyTutorial is specifically coded to have Outside=true, Inside = false. If you use your own outdoor Directional Light, you'll want to set Outside=true, Inside=false as well. Thus, your outdoor Prefabs will only get lit by your outdoor Lights. It should be noted that these Inside/Outside states function in addition to the Inclusion/Exclusion lists.

Inside & Outside state of Dynamic Actors

For Dynamic Actors that can in either indoors or outdoors, we need something additional. IndoorVolumes are necessary to specify which sections of the environment are considered "inside", so that when a dynamic Actor enters them he gets Inside=true,Outside=false. In the absence of any IndoorVolumes in a scene, a dynamic Actor has both Inside=true and Outside=true, since it can not be determined whether he is indoors or outdoors.

To add IndoorVolumes to your scene, you should open RealityBuilder's AssetBrowser, goto the Prefabs tab, select the "Models" folder and double-click the "IndoorVolume" icon to add an IndoorVolume to your scene. You can then resize it as necessary to enclose your interiors. Note that you can not rotate it (or, if you do, the volume will only be calculated on an AABB basis), but you can place as many overlapping IndoorVolumes as you need to fully enclose your interiors. Once you're finished placing your IndoorVolumes you may wish to hide them, though in any case they will not be visible outside of the Editor (i.e. in the actual Game).

IndoorVolume_Transform.jpg

Then, when a dynamic Actor that has "m_UpdateIndoorOutdoorState = true" enters the IndoorVolume, it will only be lit by Lights that have Inside=true, and the Sky Light will cease to affect it. You can also set the "IndoorVolumeType" Property of the IndoorVolume and check if a point in space is Inside an IndoorVolume of a specific "IndoorVolumeType" using the function IndoorVolume::IsInVolumeType(World* world, Vector &location, int VolumeType). Using IndoorVolumes of a custom IndoorVolumeType along with that function, you can achieve such effects as rain particles that doesn't enter interiors or outdoor ambient sounds that become muffled inside.

IndoorVolume_Tower.jpg

Indoor-Outdoor Lighting Transition

You may also want to achieve a smooth Lighting transition from inside to outside by adding a Light that is both Inside = true and Outside = true along the transition area. This will allow you to have a Light that affects all nearby Actors & Prefabs. Furthermore, in the EvalKit code you can Insert a SkyColorLight (SkyColorLight.cs), which will dynamically copy the color of the Sky Light. Accordingly you can simulate outdoor light passing through a doorway into the interior. This technique can be particularly effective as a spotlight texture projector, in the shape of the doorway.

SkyColorLightTransition.jpg

Attachment sort Action Size Date Who Comment
IndoorOutdoorLighting.jpg manage 46.1 K 12 Jul 2005 - 10:38 Main.guest  
IndoorVolume_Tower.jpg manage 27.2 K 12 Jul 2005 - 10:06 Main.guest  
IndoorVolume_Transform.jpg manage 238.6 K 12 Jul 2005 - 10:07 Main.guest  
InsideOutsideProperties.jpg manage 80.7 K 12 Jul 2005 - 10:07 Main.guest  
SkyColorLightTransition.jpg manage 42.4 K 12 Jul 2005 - 10:07 Main.guest  

IndoorOutdoorLighting   Edit | Attach | Ref-By | Printable | Diffs | r1.2 | > | r1.1 | More