GPU Instancing for Light Probes

Is there a particular reason GPU instancing doesn’t work when light probes are involved? I would think this could be solved with MaterialPropertyBlocks, right? Just pass in each light probe data set to the property blocks and GPU instancing would work.

It is odd also because in my game view before I hit play, I have ~270 draw calls. However when I hit play, it suddenly goes up to over 1000, and the reason it says is that the objects can’t be GPU instanced because they use different light probes. There is no difference in the scene before and after I hit play as far as hierarchy or additional meshes.

Almost like when not playing it can instance them (or atleast it is reporting so), but when playing it cannot.

Any thoughts would be so much appreciated. Thanks!

1 Like

Actually it appears when not in play mode it also gives the reason for using different light probes, it just happens a lot less / is more successful at instancing the renderers.

After further research, it appears the discrepancy before and after hitting play was because of static batching. I had to turn it off for instanced objects.

However I still don’t know why some objects give a reason of not being able to instance when they share the same mesh. It says they are using different light probes, but that doesn’t seem to be a problem other places.

Ah! I think this is a bug. It appears that spot lights break instancing, even if they are baked. Once I disabled them all, the materials instanced fine. I just baked lighting so I don’t see any reason any of them wouldn’t be baked. They were marked to be baked and appear to have taken effect in the lightmaps.

if you think it’s a bug, report it and add the # in this thread so the unity folks can have a look

What about Light Proxies?

Maybe you are in forward mode. Instancing does not support multiple lights in Forward mode.

1 Like

Since GI sub forum is pretty dead people might stumble on this thread so I’ll paste over what’s been found:

objects inside different probe tetrahedra break up in multiple instance batches in builtin.

LPPV is a solution as @Bordeaux_Fox hinted earlier.
Spreading apart probes is another solution.

URP doesn’t break up batches but they’re not instances anyway unless you turn off SRP batching or use the API for direct draw instance.

1 Like