|
|
|
|
|
|
// If lightmap is not defined than we evaluate GI (ambient + probes) from SH |
|
|
|
// We might do it fully or partially in vertex to save shader ALU |
|
|
|
#if !defined(LIGHTMAP_ON) |
|
|
|
#ifdef SHADER_API_GLES |
|
|
|
#if defined(SHADER_API_GLES) || (SHADER_TARGET < 30) || !defined(_NORMALMAP) |
|
|
|
#else |
|
|
|
#elif defined(SHADER_API_MOBILE) && !defined(NICEST_QUALITY) |
|
|
|
// Otherwise evaluate SH fully per-pixel |
|
|
|
#endif |
|
|
|
|
|
|
|
#ifdef LIGHTMAP_ON |
|
|
|
|
|
|
// mixed or fully in pixel. See SampleSHVertex |
|
|
|
half3 SampleSHPixel(half3 L2Term, half3 normalWS) |
|
|
|
{ |
|
|
|
#ifdef EVALUATE_SH_MIXED |
|
|
|
#if defined(EVALUATE_SH_VERTEX) |
|
|
|
return L2Term; |
|
|
|
#elif defined(EVALUATE_SH_MIXED) |
|
|
|
half3 L0L1Term = SHEvalLinearL0L1(normalWS, unity_SHAr, unity_SHAg, unity_SHAb); |
|
|
|
return max(half3(0, 0, 0), L2Term + L0L1Term); |
|
|
|
#endif |
|
|
|