https://docs.unity3d.com/Manual/LightMode-Realtime.html
real-time lighting
real-time lights are light components which have their mode property set to realtime.
use realtime mode for lights that need to change their properties or which are spawned via scripts during gameplay. unity calculates and updates the lighting of these lights every frame at run time.
then can change in response to actions taken by the player,or events whcih take place in the scene.
for example, u can set them to switch on and off (like a flickering light), change their transfoms (like a torch being carried through a dark room), or change their visual properties like their color and intensity.
real-time lights illuminate and cast realistic shadows on both static and dynamic GameObjects. they cast shadows up to the ShadowDistance (define in Edit->Project Settings, then select the Quality category).
u can also combine real-time lights with realtime global illumination, so that they contribute indirect lighting to static and dynamic GameObejcts.
using real-time lighting with realtime gi
the combination of real-time lighting with realtime gi is the most flexible and realistic lgihting option in unity. to enable realtime gi, open the lighting window (menu: Window->Rendering->Lighting Settings) and tick realtime global illumination.
when realtime gi is enabled, real-time lights contribute indirect into the scene, as well as direct light. use this combination for light sources which change slowly and have a high visual impact on your scene, such as the sun moving across the sky, or a slowly pulsating light in a closed corridor. u do not need to use realtime gi for lights that change quickly, or for special effects, because the latency of the system does not make it worth the overhead.
not that realtime gi uses significant system resources compared to the less complex baked gi. global illumination is managed in unity by a piece of middleware called enlighten, which has its own overheads (system memory and CPU cycles). see documentation on global illumination for more information.
real-time gi is suitable for games targeting mid-level to high-end pc systems, and games targeting current-gen consoles such as the ps4 and xbox one. some high-end mobile devices might also be powerful enough to make use of this feature, but u should keep scenes small and the resolution for realtime light maps low to conserve system resources.
to disable the effect of realtime gi on specific light, select the light gameobject and, in the light component, set the indirect multiplier to 0. this means that the light does not contribute any indirect light. to disable realtime gi altogether, open the light window (menu: Window->Lighting->Settings) and untick realtime global illumination.
disadvantages of using realtime lighting with realtime gi.
increased memory requirements, due to the additional set of low resolution realtime light maps used to store the real-time indirect bounces computed by the enlighten lighting system.
increased shader calculation requirements, due to sampling of the additional set of realtime light maps and probes used to store the real time indirect bounces computed by the enlighten lighting system.
indirect lighting converges over time, so property changes can not be too abrupt. adaptive HDR tone mapping might help u hide this; to lean more, see the Unity Post Processing Stack (Asset Store).
https://assetstore.unity.com/packages/essentials/post-processing-stack-83912
technical details
in the case of realtime lights (that is, light components with their mode set to realtime), the lasr emission (or path segment) from the surface to the light is not precomputed. this means that lights can move around the scene, and change visual properties like color and intensity. see documentation on using enlighten in unity for more information on path segements.
if the light also casts shadows, both dynamic and static gameobjects in the scene are rendered into the light’s shadow map. this shadow map is sampled by the Material Shaders of both static and dynamic GameObjects, so that they cast real time shadows on each other. the shadow distance ( menu: Edit->Project Settings, then select the Quality category, and navigate to the shadow section) controls the maximum distance at which shadows start to fade out and disappear entirely, which in turn affects performance and image quality.
if realtime gi is not enabled, real-time lights only calcualte direct lighting on dynamic and static gameobjects. if realtime gi is enabled, unity uses englighen to precompute the surface-to-surface light paths for static game objects.
precomputed real time gi mode: unity only precomputes surface-to-surface information.
the last path segment (that is, the segment from the surface to the light emitter) is not part of the pre-computation. the only information stored is that if the surface is illuminated, then the following surfaces and probes are also illuminated, and the intensities of the various illuminations. there is a separate set of low-resolution real-time light maps, which enlighten iteratively updates on the cpu ar run time with the information of real-time lights. because this iterative process is computationally intensive, it is split across several frames. in other words, it takes a couple of frames until the light has fully bounced across the static elements in the scene, and the real-time light maps and Light Probes have converge to the final result.
for lights with properties that change slowly (such as light-emitting sun moving across the sky), this does not pose a problem. however, for lights with properties that change quickly (such as a flickering lightbulb), the iterative nature of the real-time gi may prove unsuitable. fast property changes do not register significantly with the bounced light system, so there is no point in including them in including them in the calculations. (对于变化频率很快的光源则不能包含进实时光的计算中)。
there are several ways to address this problem.
one way is to reduce the real-time light map resolution. because this results in less calculation at run time, the lighting converges faster. 光线迅速收敛。
another option is to increase the cpu usage setting for the real-time gi runtime. by dedicating more cpu time, the runtime converges faster. 分配更多的cpu时间。
the tradeoff is course that other systems receive less cpu time to do their work. whether this is acceptable depends on each individual project. note that as this is per-scene setting, u can dedicate more or less cpu time based on the complexity of each individual scene in the project.
even though realtime gi is enabled on a per-scene basis for all real-time lights, it is still possible to prevent individual real-time lights from being considered by realtime gi. to achieve this, set the light component’s mode to realtime and this indirect multiplier to 0, removing all indirect light contributions.