Stuck on custom GI for Surface Shader

Hi,

I would like to gain some fine control over reflection probe strength, lightprobe and lightmap intensity in one of my existing shaders.
I started adapting form this custom GI example here.

However I soon hit some walls:

I broke my shader down to an simple minimal example, any help is greatly appreciated.

Kind regards!

7007126–828704–MinExample.shader (6.15 KB)

You can try looking at the code used by Unity’s own Surface Shaders:

Okay I found the issue by transforming step by step between the example and my MinExample:
inline float4 LightingSkin(SurfaceOutputSkin s, fixed3 lightDir, float3 viewDir, fixed atten , UnityGI gi)
Is not recognized by Unity because of the extra paramters.
It has to be:
inline float4 LightingSkin(SurfaceOutputSkin s, float3 viewDir, UnityGI gi)

  • lightDir can be accessed via gi.light.dir
  • and attenuation seems to be already included in gi.light.color

Thanks for your time guys!