I seem to have run into a bit of an Information black hole related to interpreting the light probe returned from the GetInterpolatedLightProbe() function.
there are a couple of threads related to this topic already which i have listed below but there doesn’t seem to be a correct solution to the problem yet.
How do you take the values returned from GetInterpolatedLightProbe() and use them to calculate a light value for a given direction?
under the hood unity seems to be using the code described here
in the UnityCG.include file there is a function called “ShadeSH9(Normal)” that matches the function described in the above publication but the steps described in “StupidSH36” to prepare the coefficients for the “ShadeSH9(Normal)” function don’t work correctly.
my issue is I need to render/calculate multiple direct/dynamic light lights as well as calculate ambient occlusion/light probe data in a single vertex lit pass (no lighting calculations in fragment and no multiple passes).
At the moment my shader uses a LightMode = “Vertex” pass tag to get 8 dynamic light values which unity passes in using the “unity_LightPosition[ ]” arrays. However in LightMode = “Vertex” passes unity does not pass in the spherical harmonics which I need for baked lighting or global illumination/ambient lighting.
My solution to this problem is to get the spherical harmonics using GetInterpolatedLightProbe() and pass it in to the shader manually but I am having trouble decoding the coefficients correctly.
At the moment my shader sort of decodes the spherical harmonics but has issues with colour saturation and brightness.
multiple directional lights using the 8 light values passed in when in LightMode = “Vertex”.
both the dynamic and spherical harmonic lighting can run at the same time provided they are passed in.
particle system being lit by emissive lighting baked into light probes and passed to the material using GetInterpolatedLightProbe().
you can sort of see the errors from my hack of the sperical harmonics here, the colours are off and not transitioning smoothly.
Close up of a particle system being lit from a single directional light.
If anyone knows any additional information about the format of the data returned by GetInterpolatedLightProbe() or how to translate the Spherical Harmonic components into something I can decode in a shader that would be very helpful.

