Search Unity

Your opinion on lighting in build-up simulation?

Discussion in 'General Discussion' started by NekrosArts, May 10, 2020.

  1. NekrosArts

    NekrosArts

    Joined:
    Nov 3, 2019
    Posts:
    18
    Hi folks, we are working on a build-up simulation similar to Dungeons or Prision Architect, where the player can build basically everything.
    upload_2020-5-10_20-26-55.png
    Now this raises some questions and I'd love to hear your opinion on how to handle such a game.

    1. Lighting
    Currently there is just one directional light, which casts no shadow. I baked the environment settings in the lighting setting and raised the environment lightning multiplier to get some ambient light everywhere. This is obviously pretty performant, but I want to add small lightsources for example to each wall in the picture below. upload_2020-5-10_20-34-46.png
    This would be way less performant, especially since the player might create many many rooms with a continuos growing count of lights. Do you have an idea how to handle many lightsources efficiently? Another thread suggested using deferred rendering path.

    2. Occlusion Culling
    I read the docs. Obviously OC is impossible if the player places and creates structures. Do you know any similar technic that would work? Maybe from the asset store? I couldn't find anything so far.

    3. Realtime GI
    Does realtime GI work for structures that the players created during the game? I'm unsure.

    Do you guys have any experience with this kind of game, you would want to share?
    I would be very grateful for any ideas, tips and look forward to a nice discussion. Thanks in advance!
     

    Attached Files:

  2. unit_dev123

    unit_dev123

    Joined:
    Feb 10, 2020
    Posts:
    989
    You could try something like prebaked prefabs, but it could cause more problem. Realtime gi although not true would be better. Maybe add something called ambient occulusion for better results.
     
    NekrosArts likes this.
  3. Murgilod

    Murgilod

    Joined:
    Nov 12, 2013
    Posts:
    10,160
    Deferred rendering will be a big boost here (provided you don't run into any buffer issues, but that's really not a suuuper big problem on modern hardware), but I suppose a question is whether or not your light sources will be affecting objects around them or if you could get away with an emissive texture situation, maybe with the emissive strength being a material property.

    If you're not really dealing with them being actual lights, it's really just another bit of data to add that'd still be really performant.
     
    NekrosArts likes this.
  4. neginfinity

    neginfinity

    Joined:
    Jan 27, 2013
    Posts:
    13,573
    Deferred is a good possibility, but the engine will down scale lighting complexity if there are too many lights.
    You can also use glowing objects with postprocessing stack with screen space reflections and bloom enabled. While it won't light up the level, it can provide enough details.

    You'll need to write your own.occlusion system. Given that you're basically using a grid, this would be easier than if your objects were a poly soup.

    It doesn't. Realtime GI in unity requires baking and static geometry. Because you're building structures on the fly, there's no static geometry.

    In theory you could possibly connect something like NVidia VXGI, as it doesn't depend on baking, but this won't be easy.
     
    NekrosArts likes this.
  5. Ryiah

    Ryiah

    Joined:
    Oct 11, 2012
    Posts:
    21,205
    Check out SEGI (Sonic Ether's Global Illumination). It's a fully dynamic voxel-based global illumination system. It went open source a few years ago and hasn't been updated since so your mileage may vary.

    https://github.com/sonicether/SEGI
     
    NekrosArts likes this.
  6. JoNax97

    JoNax97

    Joined:
    Feb 4, 2016
    Posts:
    611
    Ryiah and NekrosArts like this.
  7. NekrosArts

    NekrosArts

    Joined:
    Nov 3, 2019
    Posts:
    18
    The room walls in the example pic above already use emissive materials. However the effect is not really visible though.. maybe post-processing could improve that?
     
  8. Murgilod

    Murgilod

    Joined:
    Nov 12, 2013
    Posts:
    10,160
    Yeah, if you toss a bloom on an emissive (even a mild bloom), it can really help bring things out
     
    NekrosArts likes this.
  9. NekrosArts

    NekrosArts

    Joined:
    Nov 3, 2019
    Posts:
    18
    Thanks for this detailed answer! I'll try your suggestion for pps + bloom. If I remember correctly, reflections probes should be more peformant than the screen space reflection effect usually. But placing a real time reflection probe per tile, even with good performance settings might be to much? I'll test that and compare using the profiler.
     
  10. NekrosArts

    NekrosArts

    Joined:
    Nov 3, 2019
    Posts:
    18
    That's interesting. I'll check that out. Thanks
     
  11. JoNax97

    JoNax97

    Joined:
    Feb 4, 2016
    Posts:
    611
    Definitely too much, Each real-time RP is an additional 2 cameras rendering. (one for each hemisphere of the probe).

    I would recommend you make a system to detect when there's an important lighting change in a tile and update the probe only on those occasions. If that creates fps spikes, limit the updates to N probes per frame and use a queue. Also, if you don't plan on having extremely smooth and reflective surfaces, you can get away with lower resolution probes.
     
  12. neginfinity

    neginfinity

    Joined:
    Jan 27, 2013
    Posts:
    13,573
    I'm not talking about reflection probes, I'm talking about screen space reflection effect from effect stack.

    https://unity3d.com/how-to/image-effects-with-post-processing-stack
    https://github.com/Unity-Technologies/PostProcessing/wiki/Screen-space-Reflections

    Screen space reflections are not reflection probes, work on any geometry, and can liven your scene up. They require deferred lighting, though.


    ^^^ See the reflections on floor? That's screen space reflection.

    You can acquire effect stack from package manager, I believe.

    You CAN, of course place reflection probes at runtime in your scene as well in critically important places, if you really want to, but like you said, there will be a performance penalty.
    -----

    A good practical example is "Satifactory" game (not a unity tilte though). They allow massive base construction and in practice they only have very small number of lights in the scene. Most of the time there is only one light - sun. Occasionally there are two lights in the scene - player flaslight and the sun. That's because of MASSIVE amount of player-placed objects in the game. Scene objects that glow do that using emissive textures, and the glow doesn't light the scene up.

    However, they can do this:
    sat1.jpg

    As far as I'm aware, stuff on the ground is not a reflection probe, but screen space reflection.

    Similar approach is used in subnautica below zero (Unity title this time). In this game, floors have reflective surfaces, and reflection is done using screen space reflection tehcnique.
     
    NekrosArts likes this.
  13. unit_dev123

    unit_dev123

    Joined:
    Feb 10, 2020
    Posts:
    989
    When you building game you do not need to have everything lit up correctly. It could be like a 'blue print.'

    That way when u play the game the realtime light penalty does not incur, because you are loading level with occulusion culling. My friend Warthos recommend something called SECTR.

    Best solution is realtime gi, but to date no reliable one for unity. SE and successors are no way productuion viable i feel, raytraced solutions and vsgi still too new i feel.

    Also do not feel SSR is useful inside 'dungeon'.
     
    Last edited: May 11, 2020
    NekrosArts likes this.
  14. OCASM

    OCASM

    Joined:
    Jan 12, 2011
    Posts:
    328
    Image based lighting is a good option. It's basically just cubemaps that can be used for both reflections and diffuse lighting.
     
    NekrosArts likes this.