Using Light Probes with Graphics.DrawMesh()

Hi,

Is it possible to use light probes with Graphics.DrawMesh()? It seems to work fine with direct and ambient lighting, but doesn’t pick up light probes.

Below scene has no ambient light, and is lit only with a baked directional light and light probes.

Thanks,
Nathan

Try passing in a Material to DrawMesh which has all of the light-probey features enabled.

I’ve tried with the default unity shaders as well as various custom shaders, they all work with mesh renderers but not drawmesh.

Because DrawMesh is explicitly telling the rendering systems to render an object without any of that info calculated. The CPU has to calculate the light probe for that location so it can pass the information to the material. You can manually get the light probe information for that location using Unity - Scripting API: LightProbes.GetInterpolatedProbe but then you have to convert the data in the returned SphericalHarmonicsL2 to the unity_SHA*, unity_SHB*, and unity_SHC values the shader expects. There’s a thread someplace that goes into this on the forum, but I can’t remember where. I had to go through this for a project I was working on with very tall buildings where the top of the building needed a different ambient light color than the bottom.

Thanks bgolus.

Edit: for anyone that stumbles across this thread, this link might be useful