Search Unity

Question Lightning dense 1km x 1km open world map in HDRP?

Discussion in 'High Definition Render Pipeline' started by John_Leorid, Nov 11, 2020.

  1. John_Leorid

    John_Leorid

    Joined:
    Nov 5, 2012
    Posts:
    650
    With 1/3 of the Game done, we reached the point where baking lights seems just impossible. No matter how I tweak the paramters, it won't complete at all and the amount of maps will fill the RAM at runtime endlessly.

    The map looks like this:
    upload_2020-11-11_23-11-3.png

    There are lots of culled objects in the base on the right side of the picture and theres a full second underground level below the base filled with rooms, needed in the story.
    My "Count Scene Objects Script" says: "You have 47461 objects in your scene, 33284 are renderers"
    Total Triangle Count is 26 673 892, Verts: 29 333 837.

    InGame this is fine, because the OnScreen-Tris-Count is about 3M max and with baked lightning (before we created the last ~7 rooms) it was running fine.
    But now, without baking, performance as well as graphics becomes a problem.

    Any Ideas how to solve this? Sometimes it feels like the engine is just not capable of handling this kind of game - in that case, we would need a loading-gate between our areas to have seperate levels which can have their own lightmaps .. but I'd really like to have a seamless experience of the game, seamless open world.
     
  2. jjejj87

    jjejj87

    Joined:
    Feb 2, 2013
    Posts:
    1,116
    I will give you my honest opinion.
    If you expect "Bake Lightmap" button to be your one stop lighting solution in Unity, then you are mistaken...like by few weeks :)
    A map size of yours will take about 2 weeks to bake. Just simply out of question.

    Another thing you can do is optimize objects for lightmap baking.
    1. Select few big objects to be lightmap baked at super low res.
    2. Small or insignificant stuff bakes to lightprobes and not lightmaps
    3. The rest is lit by light probes
    4. Terrain or big stuff is just not included (not realistic or possible, just give it up)

    Provided you did the above, you should be able to bake in 6~7 hours.
    It is not going to look pretty. But accept the reality.
    That is pretty much the best scenario you can expect with a 4 core CPU. You might be able to cut a few hours off with more cores.

    BTW, GPU baker is going to 100% crash mid bake (maybe 2~3 hours in) so don't waste your time and hope there.



    Or just get Bakery.
     
  3. John_Leorid

    John_Leorid

    Joined:
    Nov 5, 2012
    Posts:
    650
    I have bakery but the setup is quite heavy, also exporting (which it does everytime a new bake is started) takes about 5 minutes on it's own, just to see how many lightmaps he wants to create = to see if the settings are ok
    Also it crashed a lot of times and I switched over to using unitys lightning solution as I did before... until now..

    2 weeks baking is not feasable. Even 7h sounds horrible - because we basically baked the lightning every day. A few weeks ago it was done within 25min, low settings, not to be used for a release Version, but internally we got a feeling for the lightning Situation + the scene view is running fluidly.
    Non-Baked lights (no matter if they are set to mixed or baked) are rendered in realtime in the Editor, when the lightning isn't baked. With a scene of this size, many indoor areas, many lights, this is extremly laggy in the Editor.

    Bakery is maybe one solution, but we only have two more months to finish the first one-third of the map. Setting up the scene for bakery, getting it running, then readjusting some lights sounds like it'd take up 2 months on it's own. Oo

    And graphics isn't the only thing I do, I am the programmer of this project and we have to add more behaviour to the AI, Save&Load Data and improve the Terminal-UI.

    What happens with the lightning if it was baked for one scene and the scene is loaded additively? Will this work? I could create fake geometry to mimic whatever needed from other scenes and thus split up the bake into manageable chunks - but somehow I have the feeling this approach won't work in unity..
     
  4. jjejj87

    jjejj87

    Joined:
    Feb 2, 2013
    Posts:
    1,116
    Loading scene additively works, but it is a workload on its own. Have you looked at UPGEN on the asset store? Might be of help.

    TBH mate, Unity is not ready for an open world environment. The lighting system in general is...well lets just say that they are not. It is doable - but will not be easy and will probably look horrible. I had my fair share of nightmares using Unity + GI so I wish you the best. Honestly there is no solution at the moment other than writing your own...which is sort of out of 99% of Unity user's reach.

    If you are still willing to work with Unity's GI, then I suggest the following

    1. Disable all flags related to lightmap for every art asset.
    2. Enable one by one, starting with big ones.
    3. Don't get greedy and dream of mapping small ones
    4. Somewhere along the 1~3 loop, you will notice one asset that causes this issue.
    5. Look into UV and lightmap setting for that asset, most preferably make it probe based so that it does not get baked
    6. Carry on until your baking time drops to acceptable range.

    Again, this method is crazy but pretty much the only way, unless you are thinking complete additive scenario, by the, other things might become a huge problem (AI and such) so think ahead for this move.

    Another approach is to forget lightmapping and try to handle the whole thing with post processing. Playing around with diffuse intensity and lightprobes and reflection probes can get you quite far. It is going to look mediocre but hey, better to finish the project than to wreck it baking maps...your choice mate.

    Hope this helps.
     
  5. John_Leorid

    John_Leorid

    Joined:
    Nov 5, 2012
    Posts:
    650
    Yes this was very helpful advice ^^
    Thanks a lot.

    Writing my own GI would probably be doable, but it'd be a 1-year project on it's own and I don't have time for this, as said, I have to get it done within ~2 Months.

    Disabling everything and enabling it back on, one by one seems to be a very common approach when it comes to graphics. I had to do this once, to find a GPU performance problem (it was the trees on the terrian, they dropped our framerate from 75fps to <15fps)

    We already have our Game split up into ~21 different scenes, each area consisting of StaticGeo (all objects that don't move), DynamicGeo (all objects that do move, doors, enemies, rigidbody crates, elevators, items) and Logic (a specified scene for our puzzles).
    The navmesh can be baked for all of them in the _Shared Scene (which is always present, as long as one other scene is loaded) and lightning for each static geo scene.

    Lets see how good this works..

    The only other option we have, if this approach fails, is to build loading gates between the areas and make every Area of the map a seperate level.
    Would be a shame because it'd destroy the flow of the game quite a bit I guess.

    And yes, Unity not providing any kind of realtime GI, but providing a very unstable Lightmapper with a limited feature set is not nice. But because of C# and the inspector, I don't want to switch to UE4 or CryEngine. I tried UE4 a lot of times but it doesn't seem to fit my workflow.

    After the cruch is over and I have some time to rest .. maybe I come back here and report how it went and which solution we choose. ^^

    Again, thanks for your input, very appreciated. :D
     
  6. jjejj87

    jjejj87

    Joined:
    Feb 2, 2013
    Posts:
    1,116
    It is my pleasure. I am in the same boat as you, since I am also making an open world game.

    I have about 6~8 months before Early Access, and my map is 8km x 8km, so I really get how you feel. I am praying everyday that Probe Volume will arrive latest mid March 2021.
    Wish u the best mate!
     
    John_Leorid likes this.