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 cant use a void Lighting<Name>_GI function like in the example or Unity will complain (and have no clue what to actually return there): Shader error in 'Skin/MinExample': Surface shader lighting model 'Skin' is missing a forward or deferred function (Skin) at line 22 - As soon as I add the UnityGI gi parameter to my Lighting<Name> function the output color will be black - I am general confused how the Lighting<Name> and Lighting<Name>_GI function will interact: Do I need the UnityGI gi parameter in Lighting<Name>? Do I have to add it manually to the resulting color like c.rgb += gi.indirect.specular; Do I need to call Lighting<Name>_GI somewhere in my code? At the moment it seems like it does nothing. I broke my shader down to an simple minimal example, any help is greatly appreciated. Kind regards!
You can try looking at the code used by Unity's own Surface Shaders: https://github.com/TwoTailsGames/Unity-Built-in-Shaders/blob/master/CGIncludes/Lighting.cginc#L71 https://github.com/TwoTailsGames/Un...master/CGIncludes/UnityPBSLighting.cginc#L114
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!