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:
- realtimeLightmapIndex;
- realtimeLightmapScaleOffset;
- 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?