Realtime GI not working in 2018.4.13

Hi,

after upgrading from 2018.4.12 to 2018.4.13 we are having issues with GI in standalone builds. Sometimes in the standalone build GI won’t update. It seems like the converged phase never finished computing. Switching to synchronous mode and setting updateThreshold does nothing. Everything is still dark. Problem is that on some computers it works always, but on some it’s like 50:50 chance whether GI will work after starting the game or not. This was never a problem. Previous builds work always, but since upgrading every build has this GI issue.

We habve simillar problem wil loading scenes additive way, there is problem that some objects are darker.

Our problem could be connected cause we are on the same unity 2018.4.13 version My problem is:

Baking Realtime GI separate way on two scenes and loading it additive way makes objects from one scen are darker.

  1. What happened

When you bake realtime precomputed GI on 2 different scenes separate way For example on 1 scene bake terrain with 1 direct light on secon rock that is on that terrain and load it additeve way Rock will be much darker on indirect preview that terrain, Everything is ok if you bake that scenes previous together. It should be the same effect. Lightning settings window is set exactly the same.

  1. How we can reproduce it using the example you attached

1.Create Scene A with terrain and light create some hill on terrain to see problem better, set baking realtime GI only and bake Light to data asset.
2.Create Scene B with rock 3 model or other shape model, and place it where the hill was on Scene A (to better see result) Set also only to bake realtime GI and bake.
3. Load scenes in editor togheter Scene A and Scene B. Turn On Indirect Debug Preview, you will se that rock is much darker than terrain.

here is how looks indirect preview, Rocks much darker, With my tests I checked taht it works proper way only IF all scenes are baked together, but it works ok with earlier versions. This is for sure bug.

Any info about it from Unity team? This is something crucial for our projects

1 Like

Last week I have filled a bug report, but so far no info.

I reported too last week, waiting for reply, Also I created another threat about gi waiting for reply too. If I may ask, you described that everything in your problem is totally dark? or just darker than everything else?

Realtime GI only works with scenes baked together, as at the time of baking all systems influencing each other need to be known. Individual elements can still come from separate scenes and be additively loaded, but only what was baked together can also influence each other. In other words, even if objects reside in two scenes, in the editor both scenes must be loaded when baking GI. If the scenes are baked separately, they can still be loaded, but they can’t influence each other anymore.

@uy3d Hello I will past then here my question about Lightning data asset, cause We have scenes that are overlaping each other and then loaded additivieley, so We cant bake it together so What exactly can we do? Please check out that topic I will be so greatfull for answer, really there is any way to bake scenes in pairs but with always the same main scene, Cause it already works but there is no api to change lightning data asset on rutnime it works for me when I change it manualy in editor, but how to change it in runtime?

Here I pasted and copy our situation, it seems to be pretty normal situation when loading scenes:

Hello.
I’m using additive scenes that overlaps with Realtime Gi. The problem is that I cant bake it together cause objects in different scenes are overlaping, and I want to load it in different configuration, I have MAIN SCENE and additive change scene SCENE A, SCENE B, SCENE C that scenes are never loaded at the same time I load it in Pairs MAIN SCENE + SCENE A / MAIN SCENE + SCENE B / MAIN SCENE + SCENE C/ I try to bake realtime GI in pairs and it works well then but it is impossible cause during baking unity overide in lightning data scenes that there is always only 2 scenes. So I figure it out that i just can bake it in pairs and then change lightning data asset for main scene and it works, but the problem is that there is no API that I know to change lightnind data asset for scene in runtime? BTW: I tried also to bake every scene separate way, but it seems like there is some bug that I reported that If I separeate bake terrain and spearate rocks od different scenes and then load it additive way, then rocks are darker than terrain but should be. so that solution is not great also because then rocks dont affect terrain etc. So How to change lightnind data asset on runtime or make any similar way? cause it seems like there is no proper workflow with realtime Gi and additive scenes, where scenes are in the same position and have objects in simmilar or the same position overlaping.

Here is a topic where I asked about it you could also answer here to keep things easier to find for other users IS there way to change lightning data asset on runtime?

I really search over all unity forum, I saw like earlier someone asked about changin lightning data asset on rutnime, but without answer. How we could achieve our goal? Best Regards Thanks for reply and I hope you could help

What exactly are you trying to achieve, though? Realtime GI needs to precalculate which surfaces see which other surfaces. If you have main+A loaded, then objects from main will contain information about objects from A. Accordingly, main+B will result in main having info on B. So even if the scene setup for main is the same in both cases, the precalc result is different and not really shareable. The baked lightmap equivalent would be having two lightmaps for main, one containing shadows from A, the other from B. You wouldn’t be able to share or merge those lightmaps.

@uy3d

As I mention I would to have the same MAIN SCENE With Rocks, roads etc, and load additive way scene A or B or C (scenes never will be loaded the same time) So I baked light in pairs MAIN SCENE + SCENE A next MAIN SCENE + SCENE B and next MAIN SCENE + SCENE C, In game this scenes are loaded always only in that pairs, The Problem is that When I bake it with selected MAIN SCENE as active, then when I bake next pair it overrides SCENE A data with SCENE B data etc. So I tested it bake in the same pairs but with set as active SCENE A not MAIN SCENE , SCENE B not MAIN SCENE etc. So I have ligtning datas with both of that scenes, and then If I will manually change lightning data asset of MAIN SCENE, to the proper one it works for example when I load scene A , I load lightning data asset for MAIN SCENE that was baked with that scene, the same with scene B , and SCENE C, and it works this way so it could be dont. But I cant change lightning data asset in runtime cause I dont see any API for that to change lightning data asset it runtime, and that would be something that would make that kind of usage possible.

Second thing that I don understand is that in situation that I describe SCENE A, SCENE B and SCENE C has excactly the same influence from MAIN SCENE, so I understand that MAIN SCENE could have problems with GI but not objects on SCENE A, B and C cause the thing is that if I use lightning data asset for main scene baked with pair MAIN SCENE + SCENE A, and then unload SCENE A and load SCENE B, objects on MAIN SCENE are darker, and there I thing something is wrong. But overall is there any way to change lighning data asset in runtime? Cause it would make like huge possiblity more for the system. Or is there any way to in proper way achieve what I want? To bake scenes in pairs where one of the scene is changing and one is not changing main scene?

The reason WHy I keep my rocks, and other not changing elements on MAIN SCENE is because it give a lot of optimization on Scene Loading time, cause I dont unload and load element unnecessary, and in our game when player change scene often is crucial. So possiblity to change lightning data asset before or after loading scene in runtime like I cant do in editor, is fastest fix, but if there is not that option in runtime (dont understand why) then maybe I could in any way connect Lighninf data asset for my MAIN SCENE to keep data for all my SCENE A, SCENE B, and SCENE C. Or any other way to not override lightning data when baking elements in pair. Will be helpful for any info that Icould achieve that pair baking scenario.

Thanks a lot for reply! Waiting for any info from you :slight_smile:

The lighting data asset is an editor only thing. It’s a container that keeps results of the lighting calculations around. When you build a player, this information is extracted again from the lda. In other words, there is no lighting data asset in the player, hence no API to do any modifications to it. We’re also not providing an API in the editor, the reasons have been stated here: Lighting Data Asset was a mistake

The case that you’re describing with unloading A, loading B, and the main scene getting darker - is it darker than what you saw when baking B+main? Because depending on what’s in A, light could be reflected back on the main scene, making it brighter. Removing those objects when unloading A would also remove the additional bounce lighting coming from A, making objects in main darker.

Yes with unloading A and Loading B Main scene is getting darker than what I see when baking B + main that is what I dont understand cause elements on Main should be affected the same way cause when Baking Main + a and main + b main is always the same. I understand that Unloading A will unload objects that affect main scene, but then I load B scene that should again update main scene and make it brighter. that what I dont understand. cause Main scene is always the same, but if lightning data is keeping objects in both ways connection it could be a problem. I tried to update dynamic gi manually too but it also dont work. It seems like it dont exactly update it proper way.

Thats a pity with that lightning data cause it solves my problem. And there is no way to bake different scene pairs, and keep it in one lightning data not override old lightning data ? So is there any way to bake lightning with scene in pairs these way and load it additive in unity or there is no way of doing that? In my opinion is quite good way of using additive cause then In main scene you keep objects that you wont change for example rocks and roads and on additive loaded scenes you keep elemts for example for seasons of the year, then when chaning season of the year or other elements you dont unload and load again everything, just what is needed, and in this way that dramatically speeded up loading time of our levels

The thing is, when you unload A and load B, you would need to unload the main scene’s realtime GI related parts and replace them with the ones generated when baking main with B. As long as you keep the main scene around, it will only detect that A is missing, but doesn’t know anything about B.
Have you actually tried baking main+A+B+C all together, but only loading main+A?

@uy3d Baking Main + A + B + C cant be done cause elements on A B C are in the simillar positions or could overlap so then you have badly baked GI, so thats impossible to bake it together It would be possible if I could set that objects on A B C dont influence each other GI is that possible?

If that is imposible maybe there is posible to keep some objects still in memory when using UnloadSceneAsynch, to for a moment dont load that assets again to memory cause I see the easiest way will be to keep all meshes on scene A B C, even if they are exactly the same position scale and rotation, but the problem is that when changing scene Unity will probably uload that asset, and then load it again for a moment when I Unload A and Load B, is there any feature in unity that keeps some data contstant loaded to memory during changin scenes asynch way ?

I’m not sure if you have such fine grained control, but you could try to use the SceneManager API. You could try to move the objects you want to keep to a scene you create directly through the API at runtime. If you keep references to materials etc around, reloading the main scene may at least avoid reloading heavy assets like materials, shaders etc. So you end up manually bumping the reference count to most referenced assets.

Hi,

any news on the original post? Because we are still heaving huge issues with GI in builds since the last update. For example this is how it looks in the editor

5302578--532680--editor.PNG
and this is how it looks sometimes in the build. Problem is that this is not always happening, but only some times. So it is extremly hard to make sure that the build is ready for public distribution
5302578--532683--build.JPG

Hi
Would it be possible to file a bug and send us a repo project? And have you tried later versions? I think we still should be able to make a backport to 18.4 but can’t promise anything. But if this issues is still present in newer versions, I think we have to.

We have already filed bug report, but so far no response except automated email. Sending repo would be problem. The project is waaay to big. 100+ GB :confused: Also we are using 3rd party software like granite for texture streaming, which would make it unusable without product key. Also we are in public production ready phase so we can’t switch from 2018 LTS to 2019+

Here are some new discoveries. Triggering manually Renderer.UpdateGIMaterials on all lightmap static objects after the game is loaded prevents the issue with GI, however once the lighting conditions are changed (e.g. different intensity of the directional light, different rotation etc.) then the game starts to be super laggy and this pops up:

Message: Internal: JobTempAlloc has allocations that are more than 4 frames old - this is not allowed and likely a leak. Message: To Debug, enable the define: TLA_DEBUG_STACK_LEAK in ThreadsafeLinearAllocator.cpp. This will output the callstacks of the leaked allocations

This is only happening if the UpdateGIMaterials method was used and lighting conditions were changed.

I’m also interested how is going thing with that bug Cause I think we expected something simillar in build once