ご質問者さんの場合は少々アレンジを加えていらっしゃるようですが、どうやらご提示の「【Unity】【シェーダ】Forward Renderingで複数のライトを取り扱う - LIGHT11 」のシェーダーコードをそのまま使っても同様の現象が起こるみたいですね。
どうもattenuation
が変な値になっているような気がします。UNITY_LIGHT_ATTENUATION
は下記のように定義されており...
HLSL
1 # ifdef POINT
2 sampler2D_float _LightTexture0 ;
3 unityShadowCoord4x4 unity_WorldToLight ;
4 # define UNITY_LIGHT_ATTENUATION ( destName , input , worldPos ) \
5 unityShadowCoord3 lightCoord = mul ( unity_WorldToLight , unityShadowCoord4 ( worldPos , 1 ) ) . xyz ; \
6 fixed shadow = UNITY_SHADOW_ATTENUATION ( input , worldPos ) ; \
7 fixed destName = tex2D ( _LightTexture0 , dot ( lightCoord , lightCoord ) . rr ) . r * shadow ;
8 # endif
9
10 # ifdef SPOT
11 sampler2D_float _LightTexture0 ;
12 unityShadowCoord4x4 unity_WorldToLight ;
13 sampler2D_float _LightTextureB0 ;
14 inline fixed UnitySpotCookie ( unityShadowCoord4 LightCoord )
15 {
16 return tex2D ( _LightTexture0 , LightCoord . xy / LightCoord . w + 0.5 ) . w ;
17 }
18 inline fixed UnitySpotAttenuate ( unityShadowCoord3 LightCoord )
19 {
20 return tex2D ( _LightTextureB0 , dot ( LightCoord , LightCoord ) . xx ) . r ;
21 }
22 # if ! defined ( UNITY_HALF_PRECISION_FRAGMENT_SHADER_REGISTERS )
23 # define DECLARE_LIGHT_COORD ( input , worldPos ) unityShadowCoord4 lightCoord = mul ( unity_WorldToLight , unityShadowCoord4 ( worldPos , 1 ) )
24 # else
25 # define DECLARE_LIGHT_COORD ( input , worldPos ) unityShadowCoord4 lightCoord = input . _LightCoord
26 # endif
27 # define UNITY_LIGHT_ATTENUATION ( destName , input , worldPos ) \
28 DECLARE_LIGHT_COORD ( input , worldPos ) ; \
29 fixed shadow = UNITY_SHADOW_ATTENUATION ( input , worldPos ) ; \
30 fixed destName = ( lightCoord . z > 0 ) * UnitySpotCookie ( lightCoord ) * UnitySpotAttenuate ( lightCoord . xyz ) * shadow ;
31 # endif
32
33 # ifdef DIRECTIONAL
34 # define UNITY_LIGHT_ATTENUATION ( destName , input , worldPos ) fixed destName = UNITY_SHADOW_ATTENUATION ( input , worldPos ) ;
35 # endif
36
37 # ifdef POINT_COOKIE
38 samplerCUBE_float _LightTexture0 ;
39 unityShadowCoord4x4 unity_WorldToLight ;
40 sampler2D_float _LightTextureB0 ;
41 # if ! defined ( UNITY_HALF_PRECISION_FRAGMENT_SHADER_REGISTERS )
42 # define DECLARE_LIGHT_COORD ( input , worldPos ) unityShadowCoord3 lightCoord = mul ( unity_WorldToLight , unityShadowCoord4 ( worldPos , 1 ) ) . xyz
43 # else
44 # define DECLARE_LIGHT_COORD ( input , worldPos ) unityShadowCoord3 lightCoord = input . _LightCoord
45 # endif
46 # define UNITY_LIGHT_ATTENUATION ( destName , input , worldPos ) \
47 DECLARE_LIGHT_COORD ( input , worldPos ) ; \
48 fixed shadow = UNITY_SHADOW_ATTENUATION ( input , worldPos ) ; \
49 fixed destName = tex2D ( _LightTextureB0 , dot ( lightCoord , lightCoord ) . rr ) . r * texCUBE ( _LightTexture0 , lightCoord ) . w * shadow ;
50 # endif
51
52 # ifdef DIRECTIONAL_COOKIE
53 sampler2D_float _LightTexture0 ;
54 unityShadowCoord4x4 unity_WorldToLight ;
55 # if ! defined ( UNITY_HALF_PRECISION_FRAGMENT_SHADER_REGISTERS )
56 # define DECLARE_LIGHT_COORD ( input , worldPos ) unityShadowCoord2 lightCoord = mul ( unity_WorldToLight , unityShadowCoord4 ( worldPos , 1 ) ) . xy
57 # else
58 # define DECLARE_LIGHT_COORD ( input , worldPos ) unityShadowCoord2 lightCoord = input . _LightCoord
59 # endif
60 # define UNITY_LIGHT_ATTENUATION ( destName , input , worldPos ) \
61 DECLARE_LIGHT_COORD ( input , worldPos ) ; \
62 fixed shadow = UNITY_SHADOW_ATTENUATION ( input , worldPos ) ; \
63 fixed destName = tex2D ( _LightTexture0 , lightCoord ) . w * shadow ;
64 # endif
マクロの第3引数には注目点のワールド座標を入力することを期待しているようでした。ですので、シェーダーコード内のUNITY_LIGHT_ATTENUATION(attenuation, i, i.normal);
という部分をUNITY_LIGHT_ATTENUATION(attenuation, i, i.posW);
に変更してみてはいかがでしょうか?