Problem copying real time lighting Data

Hello,
I post a question here because i can’t find an answer in the forum, it may be a bug or there is something i’m missing.

I want to bakeGlobal illumination on my scene and then i want to instanciate an object and copy lighting information on it.

When i do it with mixed lighting (regular lightmap) whith theses two simple lines it work perfect

copiedRenderer.lightmapIndex = sourceRenderer.lightmapIndex;
copiedRenderer.lightmapScaleOffset = sourceRenderer.lightmapScaleOffset;

But when i try to do the same with real time lightmap with enlighten :

copiedRenderer.realtimeLightmapIndex = sourceRenderer.realtimeLightmapIndex;
copiedRenderer.realtimeLightmapScaleOffset = sourceRenderer.realtimeLightmapScaleOffset;

It does not work properly, it look like that lightmap are applied but somehow it do not do it the right way, it look like Uvs are at a wrong scale or mixed up.

But i can’t get where do the problem comme from:
When i compare the Vector Lightmap offset / scale and the lightmap Index it’s the same on both meshes .
When i look the Uv2 coordinate by script on both meshes it also stays the same, in addition i do not check" optimize lightmap Uv" on any objects.
When i look the scene with the frame debuger enabled i see that the same keyword are applied on both objects, so its also the correct shader variant that the material work with.
(Directional, shadow screen, Dirlightmap_combined, dynamic lightmap on, glossy reflection of, specular hightlight off)

I attached several screenshot showing the different result i can get.
First the scene without any GI baked, then Lightmaped, and the result of instancing the cube
Then the result with real time Gi and with the instanced cube

The last two are Real time Gi, and i placed a small but bright blue point light to see how the real time GI react, it work fine on the baked object.

The goal of all this is to have the real time indirect lighting working on the terrain to have nice day-night cycle and some fx that can apply light to the surrounding.
And i want to make a copy of the terrain mesh with identical lighting, but with a different shader with a geometry shader to generate grass blades
We were able to have a better framerate than with the gpu instancing or the static batching with that technique.
I tried to make the "grass"mesh dynamically lit by light probe and light proxy volume but the result is not always close enough, mainly in shadows aera.

Thank in advance for the help and suggestion !

edit: Here’s a link with better resolution

Nobody had this issue ? or have an idea about what is the problem ?

I had same problem, but resolve if I build it. This issue has only in editor.

Oh … i need to test that !

1 Like

Hi. did you test that?