Lighting Modes in 5.6 Beta 2

Hi all,

We’ve been working hard on addressing issues around mixed lighting and have made the latest iteration of these improvements available in Unity 5.6 Beta 2. The team is looking forward to hearing your feedback on lighting modes so please direct all feedback here in this thread so we can iterate on this together.

The work in progress documentation for this feature can be found here: [5.6 BETA] Light Modes - Google Docs

Overview

The goal we are striving for is to provide a much more robust, intuitive way for Unity users to light their scenes using a mix of baked lightmaps and realtime lighting/shadows. This is being done with the following features in 5.6 Beta 2:

  • The old Realtime, Mixed, Baked modes on lights in Unity have been changed to be Dynamic, Stationary, and Static. See the Lights section below for more details.

  • We have introduced a new set of Stationary Lighting Modes that offer a set of well-defined lighting solutions targeting different use cases and hardware. See the Stationary Lighting Modes section below for more details.

  • The Lighting panel itself has undergone a major overhaul and refresh as well as the Mesh Renderer and Light Component Inspector panes. See the User Interface section below for more details.

  • We have introduced a new editor panel called the Light Explorer which gives users quick access to Lights, Reflection Probes, Light Probes, and Emissive materials. See the Light Explorer section below for more details.

Lights

Lights can now be set to the following Modes:

Dynamic lights cast dynamic light and shadows. They can change position, orientation, color, brightness, and many other properties at run time. These are the most flexible type of lights and can be used for Realtime Global Illumination. Dynamic lights compute direct lighting at run time. They also use realtime shadows via shadow maps. Enabling Realtime Global Illumination in the Lighting panel will cause Dynamic lights to contribute realtime indirect lighting to the scene. Indirect light is from realtime lightmaps and Light Probes updated by Enlighten.

Stationary lights allow a mix of dynamic and baked lighting based on the Stationary Lighting Mode set in the Lighting panel. All Stationary Lighting Modes except for Subtractive compute direct lighting at run time and store indirect lighting in lightmaps and Light Probes. Subtractive mode will compute direct lighting at bake time but only for Static objects. Stationary lights are affected by the Stationary Lighting Mode that is set for the scene. See the next section on Stationary Lighting Modes for more information.

Static lights cannot move or change in any way during run time. All lighting for static objects is baked into lightmaps. Lighting and shadows for dynamic objects gets baked into Light Probes.

Stationary Lighting Modes

Stationary lights can be controlled by scene wide Lighting Modes which instruct the lighting system on how direct lighting, indirect lighting, and shadows get handled by the various lights in your scene. The available modes for Stationary lights are:

  • Baked Indirect
    Stationary lights contribute realtime direct light and use lightmaps and Light Probes for indirect light. Realtime shadows are used up to the Shadow Distance quality setting.

  • Distance Shadowmask
    Stationary lights contribute realtime direct light and use lightmaps and Light Probes for indirect light. Realtime shadows are used up to the Shadow Distance quality setting. Beyond this, Static objects use shadowmasks and Dynamic Objects receive shadows via occlusion from Light Probes.

  • Shadowmask
    Stationary lights contribute realtime direct light and use lightmaps and Light Probes for indirect light. Static objects cast shadows on themselves using shadowmasks. Dynamic objects cast shadows in the scene using realtime shadow maps up to the Shadow Distance quality setting. Dynamic objects receive shadows from statics objects from Light Probes occlusion.

  • Subtractive
    Stationary lights contribute indirect light through lightmaps and Light Probes. Direct light is handled with lightmaps for static objects and dynamic objects are direct lit in realtime. Static objects receive shadows from dynamic objects using approximate realtime shadow maps from the main directional light up to the Shadow Distance quality setting. Dynamic objects receive shadows from themselves using realtime shadows up to the Shadow Distance quality setting. Dynamic objects receive shadows from static objects from Light Probes.

These overview descriptions are presented as information tips in the Lighting panel now to help you get a better idea of the Lighting Modes within the editor context.

User Interface

We have made a lot of changes to the Lighting panel as well as the Inspector for Mesh Renderer and Light components that is outlined below.

Lighting Panel

The Lighting Panel has undergone a complete overhaul to improve the usability and provide a more intuitive approach to lighting going forward. The following changes have been made:

  • The panel has been organized in a way where sections can be collapsed when not needed and all relevant properties for a given section exist within the collapsible frame.

  • Labels and their tooltips have been re-done to be more user-friendly and informative.

  • A new Statistics panel has been integrated into the bottom of the Lighting panel which gives you a quick overview of lighting related statistics in the scene.

  • Lightmaps tab has been renamed to “Global Maps” and now includes maps such as Intensity, Directionality, Shadowmask, etc.

  • The “Object” tab has been refactored and renamed “Object Maps”. This tab shows the currently selected objects baked texture previews. You can pan and zoom around in this view as well as use the ‘f’ hotkey to frame on a selected objects lightmap UVs in the tab. Properties previously found in the “Object” tab have been relocated to their appropriate component Inspector. The following views are available:

  • Charting

  • Albedo

  • Emissive

  • Realtime Intensity

  • Realtime Direction

  • Baked Intensity

  • Baked Direction

  • Baked Shadowmask

Inspector

As part of the Lighting panel overhaul the Objects tab in the Lighting panel was refactored and all lighting related properties were distributed back to the respective components.

Mesh Renderer components now have a foldout section labeled Lighting and all properties that affect how the mesh will interact with the lighting system are stored in there. Enabling the Lightmap Static property will mark the object as Static (same flag in the Static dropdown list) to be used in lightmap calculation. This also exposes the various other properties related to lightmapping.

Light components have also been refactored to include the new light modes (Dynamic, Stationary, Static) and have had a pass to make the labels more user-friendly. We’ve also done a pass over all of the tooltips to make them more informative to users on what a specific property does.

Light Explorer

The Light Explorer is a new interface in Unity 5.6 Beta 2 that allows you to view and edit every light in the scene. This is very useful for large, complex scenes where you may have lights scattered across your hierarchy that you want to tweak. There are four tables in the Explorer that allow you to tweak Lights, Reflection Probes, Light Probes, and Emissive Materials. Each table is searchable to help find specific objects you want to work with and you can also Lock Selection which will maintain the items currently selected in the view even if your scene selection changes. The tables also support multi-editing by selecting multiple items and editing a value which will set the value across all selections in the table.

6 Likes

Wow, those are huge changes. Lots of new UI and lighting model stuff to learn and understand.
Thanks for the continued efforts to make mixed lighting better.

This is HUGE… and welcome… One thing I want to know and how things like baking Lightmaps to prefabs will be handled. I have a lot of geometry that are prefabs and it is important that we somehow get this working…

KRGraphics - could you describe some of the issues you’re seeing with prefabs or toss me a link to investigate?

Is it possible to move stationary lights? For instance, having a stationary moon move in the sky even though its shadow map doesn’t move.

EDIT: Just read the doc. You can.

I’m excited to apply this update - looks like it’ll be much more flexible. Going to start playing around with it, and would love a video tutorial to help everyone get started faster.

Is realtime indirect bounce light/shadowing going to be a part of this project, or is there a timeline for this? I remember during the Unity v5.0 rollout, the inspector stated that it wasn’t “yet” implemented, but I haven’t heard of anything upcoming.

Thank you in advance!

  • S.

Fantastic job on this, guys. Subtractive mode is pretty awesome in particular!
EDIT: Actually, one question. How come ‘lightmappingMode’ is now deprecated, but ‘lightmapBakeType’ generates an error when I go to make a build (as if it’s an editor-only API)? I’ve got a custom lighting system inspired by Valve’s Lab renderer and it relies on checking the bake type of a light. What am I supposed to use for this scenario?

This looks very promising and yes video tutorial would be nice…

Hi all,

Just wanted to follow-up and see how everyone’s experience is with the new lighting modes is going? We have a few questions we were looking for feedback on that I thought I’d post here:

  1. Does the transition to Static, Stationary, and Dynamic light modes make sense to you? Is the terminology accurate or descriptive enough compared to the previous modes?

  2. How is the Light Explorer holding up for you? Does it handle most of your workflows or are we missing anything in there you need?

Any other feedback you have while using this feature is greatly appreciated!

@PhobicGunner - I’ll look into this with our dev team and get you an answer.

@S_Darkwell - Will have a chat with the dev team about this one and get back to you.

This is on the roadmap for sure. We’ve been very busy with lighting modes and progressive lightmapper lately. But once these stabilize we will get back to this among other things.

Cheers,
Jesper

This look great! I have one question.
Is it resolve problem with instantiating baked prefabs?

Hey,

@PhobicGunner - You can use Light.bakedIndex to identify a light’s contribution to a lightmap. That doesn’t output any compilation errors while building the standalone in the latest versions of Unity. Please check the documentation page here: https://docs.unity3d.com/ScriptReference/Light-bakedIndex.html

@MinhDao - Currently, this is a known bug and unfortunately, new lighting modes don’t fix it. However, we will definitely address this issue later.

@MinhDao I couldn’t manage to reproduce this issue on our side (thus, with 3000 static objects and 200 stationary lights), but ensure that you have enough GI cache. If the issue still persists, then please share your project, that would be very helpful to debug.

And as Shawn said, please also provide your feedback about how you find the new lighting workflow.

Thank you!

The new light modes are great, by the way. It’s awesome to be able to have baked distance shadows - it enabled me to use a single cascade and move the realtime shadow distance very close to the viewer for a mobile graphics test I did (http://jetfistgames.com/Files/Videos/MobileGFXTest.mp4). This scenario would have been impossible previously, so very good job!

Bit of a question though - let’s say I wanted to swap out my shadowmaps for projector-style shadows (maybe project them in screen space into a sort of screen-space shadow mask, not unlike deferred decals). In this scenario, are there any pointers for how I might integrate that with either the shadowmask mode or the subtractive mode? Maybe some shader files I should refer to for how those work?

1 Like

It’s good to see mixed mode back and it works very well but the experience with the new lighting modes is confusing with all these options and the info bubble bombarding me with too many words - an image explaining what I’m getting into would be very nice, because, ya know, I’m doing lighting I’m an artist not a genius speed reading nuclear physicist.
Lighting mode: why would I want substractive when shadowmap looks more integrated? (THIS info bubble I can’t read past the 4th word) what do distance shadowmap and baked indirect do? it’s like probes? They look the same.
The GUI of the old lighting panel was a bit clearer, it took quite a few iterations to get there. For example the toggle was in front of the title whereas now it’s below the title so when you fold that title you can’t access activation button or see in one glance what’s on and what’s off. The terminology was also more precise: realtime GI? I wish, better call it what it is: precomputed dynamic GI, also where is realtime resolution? Ah I found all the way below, makes sense.
So global illum get baked even when I have only dynamic lights, from the sky? That’s cool.
use “auto” instead of the ultra verbose “auto generate” less is more yeah?
I’m confused about probe occlusion, does it mean probe now contain shadow information? It’s always been the case isn’t it. What is probe weight? I’d move the probe visu options to gizmos and keep this panel centered around settings that affect lighting.
Segway: since you’re improving the lighting system, why not fixing probe selection as well.

  1. static mixed dynamic was clear because we had two varieties of lighting and so mixed was a precise way to tell us it combined those two, but maybe stationary means more than mixed in the new system? Explain that with a few images.
  2. The light explorer is cute but I can’t see a use for it, I name my lights with what they do and hierarchy search and filters works perfectly. Good candidate for the asset store, IMO.

… one last thing: maybe it’s a good time to fix the behavior of dynamic GI when changing light in the editor, the GI solution has never updated unless auto was on, at runtime it makes sense because GI only updates when you call the GI.Refresh() or whatever it’s called but when I’m not in play mode that doesn’t make sense to enforce that.
… one last thing: dynamic GI isn’t supposed to break lighting is it? ambient mode in realtime does that, why isn’t it reading the skybox?

2903567--213812--Screen Shot 2016-12-31 at 1.36.43 PM.jpg
2903567--213813--Screen Shot 2016-12-31 at 1.36.36 PM.jpg

Subtractive is faster.

Yes, the new system has far more possibilities than the old “mixed” mode did. I can’t be bothered to make images now though :slight_smile:

What are the steps to replicate this? I tried it just now, and it seems to work properly.

Also, here is a quick explanation of the modes.

Baked Indirect means, direct is realtime, indirect is baked into lightmaps.
Shadowmask means, everything static is baked into lightmaps, dynamic object cast realtime shadows that blend properly with static ones.
Distance Shadowmask means : Up to shadow distance it behaves like Baked Indirect, further than that, it switches to Shadowmask.

1 Like

This is good feedback. We don’t tend to put documentation in Unity interfaces but this was an experiment as the Modes do have a lot of stuff going on behind the scenes that’s not apparent from their names to users. I’m not entirely sure an image inside the interface would help much here given the size of the window but I’m curious to know if there’s any value at all to the info boxes or is it just wasted space for people? Is this something you would prefer to have better documentation elsewhere for?

Sounds like we could do a more thorough job explaining these up front with a video overview of the feature set? We bounced around quite a bit with the toggle being on the main menu entry like the old system and figured we’d try the new approach for the beta to see how it measured with users. I’m quite curious to hear more feedback on this change and how people feel about it. For the terminology our attempt here is to move to more human readable terms and away from using acronyms but it sounds like that missed the mark? Interesting point about “Auto” as many users found this to be too assuming - you tick a box that says Auto but there’s no affordance or link to what it is for new users.

The goal is to have a good amount of material out of the gate to help illustrate the changes, show the benefits of the new modes, explain why you would want to use each mode (situation, cost, benefit, etc).

Note taken for the Light Explorer.

Thanks for the feedback and Happy New Year!

1 Like

My opinion is that the info boxes are exactly the right idea here in this interface - I think the problem right now that @laurentlavigne has correctly pointed out is that the content within those boxes, at the moment, is repetitive and opaque. That text is dense with jargon about the “how” of the lighting system instead of being explanatory in terms of the “why” of each choice. Instead of each mode explaining how it’s implemented, it should instead explain its best use cases, as in:

“Use this mode when you need your dynamic objects to properly cast shadows on static objects at all distances, and can afford some overhead. If you’re in a constrained environment such as mobile, consider this other mode instead…” or something.

2 Likes

I think that’s something for the docs though.