Enlighten: deleting the static meshes from the scene nullifies realtime GI

We are trying to make a server-based game that should load on the player’s device as fast as possible. To achieve this we are using gltf format for our models with draco compression as well as custom texture compression.

We are now researching ways we can introduce Realtime GI into our game. We plan on building the level on the server, specifying static meshes programmatically, baking Realtime GI using Unity Editor and, finally sending the empty level to the user with as little data attached to it as possible.

In theory it should be doable: I just need to specify three parameters in my MeshRenderer to make GI work on a newly loaded mesh:

  1. realtimeLightmapIndex;
  2. realtimeLightmapScaleOffset;
  3. enlightenVertexStream (which can be reconstructed by taking a sharedMesh from the newly loaded mesh’es MeshFilter and injecting uv3 in it from, say, a compressed JSON file).

However, no matter what I try, I can’t make Enlighten GI work in a scene where the static meshes were removed and then loaded again from Streaming Assets. As far as I can see, unless the scene has actual static meshes present in it at the time of the build, the Enlighten GI will fail. Moreover, even changing the sharedMesh in each static GameObject to supply a simple mesh does not work as resulting GI calculations will be incorrect (use the wrong mesh) in this case.

Is there any way I can solve this problem?

The Enlighten data needed in the player is generated by the Editor based on the lightmap static MeshRenderers, Light Probes, Terrains, build settings etc… It isn’t enough to just recreate realtimeLightmapIndex, realtimeLightmapScaleOffset and the enlightenVertexStream for a MeshRenderer. You have to make sure all the data needed by Enlighten is present, like instanceHash and geometryHash (This is stored in EnlightenSceneMapping at build time and the hash files are added to the build output so they can be loaded by the Enlighten runtime manager).
Global data like Enlighten systems, probe sets, terrain data, atlassing info and some lookup structures are also built, so I think you will have a difficult time putting all this together, as it isn’t explained in the documentation how all this fits together.

Did you consider that a completely different GI approach would be easier to fit into a procedural level game like this method Screen Space Global Illumination | High Definition RP | 10.2.2 (unity3d.com)?