Search Unity

Question Best approach for believable real-time indoor lighting?

Discussion in 'General Graphics' started by PascalTheDog, Nov 12, 2022.

  1. PascalTheDog

    PascalTheDog

    Joined:
    Mar 16, 2015
    Posts:
    86
    Hey,

    I'm working on a light/shadow-themed 3D adventure game that takes place entirely in an underground bunker. That is, there are no outdoor scenes; all lighting is "artificial".

    Manipulating artificial sources of light — lamps, torches, projectors, neon signs, signal flares, etc — in real time to completely rethink how a room is (un)lit constitutes a significant component of both the game design and the art direction. Baked lightmaps won't cut it; I do need real-time lighting in one way or another.

    For instance, a bunker room might have four fluorescent tube-style lamps hanging from the ceiling as lighting and nothing else. Their impact on the environment ought to be reasonably realistic when it comes to light diffusion and shadow projection. More importantly, each of those lamps ought to be individually manipulable to some degree in position, intensity, range, and/or color — with the change being reflected in real time in the environment.

    Of course, one big issue with lights and shadows is performance. At the end of the day, you can only have *so* many real-time light sources in your scene. I'll definitely need tips on optimization. But my biggest issue so far is how those lights look.

    I've tried playing around with point lights and spot lights, and the results weren't exactly impressive. It looked nothing like a room being lit by actual lamps, and more like a room with random burst of light tearing through the space-time continuum. I suppose emission is a lot better at simulating the light emitted by lamps — but AFAIK those can't cast shadows.

    By the way, I'm using URP. Maybe HDRP could help, but I doubt my current setup can handle it.

    Any assistance would be greatly appreciated. Cheers!
     
  2. joshuacwilde

    joshuacwilde

    Joined:
    Feb 4, 2018
    Posts:
    727
    Baked lighting + realtime lighting is your best bet.

    To be more precise, you need baked indirect lightmaps + light probes + reflection probes + realtime direct lighting. This is all best done in deferred rendering mode. This will all get you decently far.

    There are definitely fancier things you can do. Unity's lighting model for baked directional lighting is not the best and can be improved, but that requires more shader knowledge.

    Modern games like call of duty use all of the above plus fancier directional lighting like I mentioned.

    Screen space techniques like bloom (if done in a physically accurate way) can also help really sell the lighting. Tonemapping also really helps to improve how colors are interpreted. Idk what tonemapping is available for URP because I don't use URP.
     
    Last edited: Nov 14, 2022
  3. wwWwwwW1

    wwWwwwW1

    Joined:
    Oct 31, 2021
    Posts:
    767
    If your scene is not very large, you can use Enlighten Precomputed Real-time GI (with high settings) for indirect lighting.

    This is the only real-time GI solution that Unity provides to non-HDRP users.

    If most of the lights cannot be baked, I suggest switching to HDRP because there's a feature called cached shadow.

    They seem to have plans to add it for URP, but I don't think it will come soon.

    URP's shadowmap is a bit small (4096x4096), this may be not enough for scene with complex real-time lighting.

    I think HDRP's IES profile can be helpful if you need interesting artificial lighting.

    Lights with IES Profile:
    IESProfile1.jpg

    You will have to use Light Cookie (not as convenient as IES profile) instead if creating it in URP.

    Lights with Light Cookie:
    LightCookie1.jpg

    (Yes, they are basically similar things.)

    They said that URP IES profile support should be added in the future (SRP coexistence), but nobody knows when.

    * Indirect lighting is important for fully interior scenes.

    Switching to HDRP will obviously be helpful, but with some performance costs.

    I think it depends on your project, you can try and compare the differences if possible.
     
  4. wwWwwwW1

    wwWwwwW1

    Joined:
    Oct 31, 2021
    Posts:
    767
    You should try to see if it's possible to use a Directional Light (with light cookie?) in your (URP) project. (disable it when outside a "room")

    The Main Light in URP has the highest shadow quality because it uses a separate shadowmap.
     
  5. c0d3_m0nk3y

    c0d3_m0nk3y

    Joined:
    Oct 21, 2021
    Posts:
    666
    You can go fully dynamic, but some features are HDRP only. These are your options in Unity:

    Indirect diffuse:
    • Ambient Light Probe
      • Static or dynamic
      • Just for environment lighting
    • Light Maps
      • Requires static geometry and static light positions
      • Requires baking
      • Slow iteration times
      • Best performance
      • Best quality
    • Light Probes
      • Requires static geometry and static light positions
      • Requires baking but bakes fast
      • Requires manual placement (tedious)
      • Lighting only per object, not per pixel - which rules them out for large objects like world geometry. Usually used for dynamic objects in combination with light maps
    • Adaptive Probe Volumes
      • Requires static geometry and static light positions
      • Requires baking but bakes fast
      • Does not require manual placement
      • Lighting per pixel
      • Can be used for both static and dynamic objects
    • Enlighten
      • Geometry needs to be static but light positions can be dynamic
      • Needs baking
      • Deprecated
    • Screen Space Global Illumination (optionally raytraced)
      • Fully dynamic (both geometry and lights can be dynamic)
      • Worst run-time performance
      • The raytraced option is slightly laggy
    Indirect specular:
    • Ambient Reflection Probe
      • Just of environment reflections
    • Reflection probes
      • Can be static and dynamic but dynamic ones are expensive
      • Have to be manually placed
      • Supports box projection (in HDRP also oriented)
    • Screen Space Reflections (optionally raytraced)
      • Fully dynamic
      • Worst run-time performance
    Regarding shadows:
    • Baked shadows (light maps)
    • Cascaded shadow map
    • Point light shadows (expensive!)
    • Contact Shadows
    • Ray Traced Shadows
    Hope, I didn't forget something. Wrote this from the top of my head.

    PS: Or course, there are also post-processing effects that you can apply on top of that like ambient occlusion or bloom.
     
    Last edited: Nov 14, 2022
  6. burningmime

    burningmime

    Joined:
    Jan 25, 2014
    Posts:
    845
    Really accurate lighting is kinda HDRP's thing. You can set light values in Lux and even download IES profiles provided by light manufacturers. So if you want to replicate the look of some specific lightbulb or lighting fixture, you can get all the data directly from the light manufacturer's website, import it into Unity, and it'll look like that specific light.