0
Under review
Lightmaps + Light colour node: Too many interpolators Part 10: The revenge
Go im getting this bug when trying to use the light color node on a shader with a lightmap + emission:
Shader error in 'Shader Forge/Water': Too many interpolators used (maybe you want #pragma glsl?) at line 79Below is my Shader's code:
Keywords: DIRECTIONAL, LIGHTMAP_ON, DIRLIGHTMAP_OFF, SHADOWS_OFF
// Shader created with Shader Forge Beta 0.20 // Shader Forge (c) Joachim 'Acegikmo' Holmer // Note: Manually altering this data may prevent you from opening it in Shader Forge /*SF_DATA;ver:0.20;sub:START;pass:START;ps:lgpr:1,nrmq:0,limd:0,blpr:0,bsrc:0,bdst:1,culm:0,dpts:2,wrdp:True,uamb:False,mssp:True,ufog:False,aust:True,igpj:False,qofs:0,lico:0,qpre:1,flbk:,rntp:1,lmpd:True,lprd:False,enco:False,frtr:True,vitr:True,dbil:False,rmgx:True,hqsc:True,hqlp:False,fgom:False,fgoc:False,fgod:False,fgor:False,fgmd:0,fgcr:0.227451,fgcg:0.2470588,fgcb:0.2745098,fgca:1,fgde:0.0075,fgrn:0,fgrf:125.7,ofsf:0,ofsu:0;n:type:ShaderForge.SFN_Final,id:1,x:32128,y:32735|normal-21-OUT,emission-678-OUT;n:type:ShaderForge.SFN_Color,id:7,x:33024,y:32401,ptlb:Water Colour,c1:0.08131487,c2:0.1142346,c3:0.2352941,c4:1;n:type:ShaderForge.SFN_Lerp,id:8,x:32763,y:32350|A-568-RGB,B-7-RGB,T-591-OUT;n:type:ShaderForge.SFN_Tex2d,id:17,x:32948,y:33084,tex:8477367974111f04cb55f0e0f483bebb,ntxv:3,isnm:True|UVIN-563-OUT,TEX-608-TEX;n:type:ShaderForge.SFN_TexCoord,id:18,x:33459,y:33177,uv:0;n:type:ShaderForge.SFN_Multiply,id:19,x:33271,y:33177|A-18-UVOUT,B-546-OUT;n:type:ShaderForge.SFN_Lerp,id:21,x:32567,y:33215|A-22-OUT,B-24-OUT,T-674-OUT;n:type:ShaderForge.SFN_Vector3,id:22,x:32779,y:33184,v1:0,v2:0,v3:1;n:type:ShaderForge.SFN_Add,id:24,x:32779,y:33286|A-17-RGB,B-25-RGB;n:type:ShaderForge.SFN_Tex2d,id:25,x:32958,y:33440,tex:8477367974111f04cb55f0e0f483bebb,ntxv:3,isnm:True|UVIN-565-OUT,TEX-608-TEX;n:type:ShaderForge.SFN_Multiply,id:26,x:33271,y:33376|A-18-UVOUT,B-550-OUT;n:type:ShaderForge.SFN_Distance,id:51,x:33459,y:32707|A-53-XYZ,B-52-XYZ;n:type:ShaderForge.SFN_FragmentPosition,id:52,x:33642,y:32777;n:type:ShaderForge.SFN_ViewPosition,id:53,x:33642,y:32650;n:type:ShaderForge.SFN_Divide,id:54,x:33115,y:32707|A-466-OUT,B-518-OUT;n:type:ShaderForge.SFN_Subtract,id:466,x:33282,y:32707|A-51-OUT,B-467-OUT;n:type:ShaderForge.SFN_Vector1,id:467,x:33459,y:32827,v1:1;n:type:ShaderForge.SFN_ComponentMask,id:469,x:32774,y:32707,cc1:0,cc2:-1,cc3:-1,cc4:-1|IN-484-OUT;n:type:ShaderForge.SFN_Clamp,id:484,x:32935,y:32707|IN-54-OUT,MIN-485-OUT,MAX-486-OUT;n:type:ShaderForge.SFN_Vector1,id:485,x:33115,y:32827,v1:0;n:type:ShaderForge.SFN_ValueProperty,id:486,x:33115,y:32893,ptlb:Max Fog,v1:0.9;n:type:ShaderForge.SFN_Lerp,id:492,x:32584,y:32350|A-8-OUT,B-524-RGB,T-469-OUT;n:type:ShaderForge.SFN_ValueProperty,id:518,x:33282,y:32827,ptlb:Fog Distance,v1:152;n:type:ShaderForge.SFN_Color,id:524,x:32774,y:32528,ptlb:Fog Color,c1:0.02745098,c2:0.06666667,c3:0.1019608,c4:1;n:type:ShaderForge.SFN_Vector4Property,id:545,x:33644,y:33356,ptlb:Bump Tiling (RG=1 BA=2),v1:200,v2:200,v3:15,v4:15;n:type:ShaderForge.SFN_ComponentMask,id:546,x:33462,y:33317,cc1:0,cc2:1,cc3:-1,cc4:-1|IN-545-XYZ;n:type:ShaderForge.SFN_Append,id:550,x:33462,y:33462|A-545-Z,B-545-W;n:type:ShaderForge.SFN_Time,id:557,x:33644,y:33187;n:type:ShaderForge.SFN_Multiply,id:558,x:33271,y:33017|A-561-OUT,B-557-T;n:type:ShaderForge.SFN_Vector4Property,id:560,x:33644,y:33017,ptlb:Bump Speed (RG=1 BA=2),v1:0.015,v2:-0.0005,v3:0.001,v4:0.0015;n:type:ShaderForge.SFN_ComponentMask,id:561,x:33459,y:33017,cc1:0,cc2:1,cc3:-1,cc4:-1|IN-560-XYZ;n:type:ShaderForge.SFN_Append,id:562,x:33462,y:33606|A-560-Z,B-560-W;n:type:ShaderForge.SFN_Add,id:563,x:33115,y:33084|A-558-OUT,B-19-OUT;n:type:ShaderForge.SFN_Add,id:565,x:33118,y:33440|A-26-OUT,B-566-OUT;n:type:ShaderForge.SFN_Multiply,id:566,x:33271,y:33507|A-562-OUT,B-557-T;n:type:ShaderForge.SFN_Tex2d,id:568,x:33494,y:32159,ptlb:ReflectionTex,tex:8ec59a57815d76344b440981de8367b4,ntxv:0,isnm:False|UVIN-574-OUT;n:type:ShaderForge.SFN_ScreenPos,id:570,x:33999,y:32159,sctp:0;n:type:ShaderForge.SFN_RemapRange,id:572,x:33836,y:32159,frmn:-1,frmx:1,tomn:0,tomx:1|IN-570-UVOUT;n:type:ShaderForge.SFN_Add,id:574,x:33659,y:32159|A-572-OUT,B-575-OUT;n:type:ShaderForge.SFN_Multiply,id:575,x:33836,y:32317|A-576-OUT,B-577-OUT;n:type:ShaderForge.SFN_ValueProperty,id:576,x:33999,y:32317,ptlb:Reflection Distortion,v1:0.1;n:type:ShaderForge.SFN_ComponentMask,id:577,x:33999,y:32370,cc1:0,cc2:1,cc3:-1,cc4:-1|IN-24-OUT;n:type:ShaderForge.SFN_NormalVector,id:585,x:33493,y:32465,pt:True;n:type:ShaderForge.SFN_ViewVector,id:586,x:33493,y:32342;n:type:ShaderForge.SFN_Dot,id:587,x:33339,y:32401,dt:0|A-586-OUT,B-585-OUT;n:type:ShaderForge.SFN_Clamp01,id:588,x:33184,y:32401|IN-587-OUT;n:type:ShaderForge.SFN_Power,id:591,x:33024,y:32538|VAL-588-OUT,EXP-673-OUT;n:type:ShaderForge.SFN_DepthBlend,id:604,x:32527,y:32864|DIST-605-OUT;n:type:ShaderForge.SFN_Vector1,id:605,x:32715,y:32911,v1:1;n:type:ShaderForge.SFN_Tex2dAsset,id:608,x:33118,y:33255,ptlb:Bump,tex:8477367974111f04cb55f0e0f483bebb;n:type:ShaderForge.SFN_ValueProperty,id:673,x:33184,y:32585,ptlb:Fresnel Power,v1:0.2;n:type:ShaderForge.SFN_ValueProperty,id:674,x:32779,y:33425,ptlb:Bump Amount,v1:0.1;n:type:ShaderForge.SFN_LightColor,id:677,x:32584,y:32480;n:type:ShaderForge.SFN_Multiply,id:678,x:32397,y:32429|A-492-OUT,B-677-RGB;n:type:ShaderForge.SFN_Vector1,id:679,x:32415,y:32788,v1:1;proporder:7-545-560-524-518-486-576-568-608-673-674;pass:END;sub:END;*/ Shader "Shader Forge/Water" { Properties { _WaterColour ("Water Colour", Color) = (0.08131487,0.1142346,0.2352941,1) _BumpTilingRG1BA2 ("Bump Tiling (RG=1 BA=2)", Vector) = (200,200,15,15) _BumpSpeedRG1BA2 ("Bump Speed (RG=1 BA=2)", Vector) = (0.015,-0.0005,0.001,0.0015) _FogColor ("Fog Color", Color) = (0.02745098,0.06666667,0.1019608,1) _FogDistance ("Fog Distance", Float ) = 152 _MaxFog ("Max Fog", Float ) = 0.9 _ReflectionDistortion ("Reflection Distortion", Float ) = 0.1 _ReflectionTex ("ReflectionTex", 2D) = "white" {} _Bump ("Bump", 2D) = "bump" {} _FresnelPower ("Fresnel Power", Float ) = 0.2 _BumpAmount ("Bump Amount", Float ) = 0.1 } SubShader { Tags { "RenderType"="Opaque" } Pass { Name "ForwardBase" Tags { "LightMode"="ForwardBase" } Fog {Mode Off} CGPROGRAM #pragma vertex vert #pragma fragment frag #define UNITY_PASS_FORWARDBASE #include "UnityCG.cginc" #include "AutoLight.cginc" #include "Lighting.cginc" #pragma multi_compile_fwdbase_fullshadows #pragma exclude_renderers gles xbox360 ps3 flash #pragma target 3.0 uniform float4 _TimeEditor; #ifndef LIGHTMAP_OFF sampler2D unity_Lightmap; float4 unity_LightmapST; #ifndef DIRLIGHTMAP_OFF sampler2D unity_LightmapInd; #endif #endif uniform float4 _WaterColour; uniform float _MaxFog; uniform float _FogDistance; uniform float4 _FogColor; uniform float4 _BumpTilingRG1BA2; uniform float4 _BumpSpeedRG1BA2; uniform sampler2D _ReflectionTex; uniform float4 _ReflectionTex_ST; uniform float _ReflectionDistortion; uniform sampler2D _Bump; uniform float4 _Bump_ST; uniform float _FresnelPower; uniform float _BumpAmount; struct VertexInput { float4 vertex : POSITION; float3 normal : NORMAL; float4 tangent : TANGENT; float4 uv0 : TEXCOORD0; float4 uv1 : TEXCOORD1; }; struct VertexOutput { float4 pos : SV_POSITION; float4 uv0 : TEXCOORD0; float4 posWorld : TEXCOORD1; float3 normalDir : TEXCOORD2; float3 tangentDir : TEXCOORD3; float3 binormalDir : TEXCOORD4; float4 screenPos : TEXCOORD5; LIGHTING_COORDS(6,7) #ifndef LIGHTMAP_OFF float2 uvLM : TEXCOORD8; #endif }; VertexOutput vert (VertexInput v) { VertexOutput o; o.uv0 = v.uv0; o.normalDir = mul(float4(v.normal,0), _World2Object).xyz; o.tangentDir = normalize( mul( _Object2World, float4( v.tangent.xyz, 0.0 ) ).xyz ); o.binormalDir = normalize(cross(o.normalDir, o.tangentDir) * v.tangent.w); o.posWorld = mul(_Object2World, v.vertex); o.pos = mul(UNITY_MATRIX_MVP, v.vertex); o.screenPos = o.pos; #ifndef LIGHTMAP_OFF o.uvLM = v.uv1.xy * unity_LightmapST.xy + unity_LightmapST.zw; #endif TRANSFER_VERTEX_TO_FRAGMENT(o) return o; } fixed4 frag(VertexOutput i) : COLOR { float3x3 tangentTransform = float3x3( i.tangentDir, i.binormalDir, i.normalDir); float3 viewDirection = normalize(_WorldSpaceCameraPos.xyz - i.posWorld.xyz); /////// Normals: float4 node_560 = _BumpSpeedRG1BA2; float4 node_557 = _Time + _TimeEditor; float2 node_18 = i.uv0; float4 node_545 = _BumpTilingRG1BA2; float3 node_24 = (UnpackNormal(tex2D(_Bump,TRANSFORM_TEX(((node_560.rgb.rg*node_557.g)+(node_18.rg*node_545.rgb.rg)), _Bump))).rgb+UnpackNormal(tex2D(_Bump,TRANSFORM_TEX(((node_18.rg*float2(node_545.b,node_545.a))+(float2(node_560.b,node_560.a)*node_557.g)), _Bump))).rgb); float3 normalLocal = lerp(float3(0,0,1),node_24,_BumpAmount); float3 normalDirection = mul( normalLocal, tangentTransform ); // Perturbed normals #ifndef LIGHTMAP_OFF float4 lmtex = tex2D(unity_Lightmap,i.uvLM); #ifndef DIRLIGHTMAP_OFF float3 lightmap = DecodeLightmap(lmtex); float3 scalePerBasisVector = DecodeLightmap(tex2D(unity_LightmapInd,i.uvLM)); UNITY_DIRBASIS half3 normalInRnmBasis = saturate (mul (unity_DirBasis, normalLocal)); lightmap *= dot (normalInRnmBasis, scalePerBasisVector); #else float3 lightmap = DecodeLightmap(tex2D(unity_Lightmap,i.uvLM)); #endif #endif i.screenPos = float4( i.screenPos.xy / i.screenPos.w, 0, 0 ); i.screenPos.y *= _ProjectionParams.x; ////// Lighting: ////// Emissive: float3 emissive = (lerp(lerp(tex2D(_ReflectionTex,TRANSFORM_TEX(((i.screenPos.rg*0.5+0.5)+(_ReflectionDistortion*node_24.rg)), _ReflectionTex)).rgb,_WaterColour.rgb,pow(saturate(dot(viewDirection,normalDirection)),_FresnelPower)),_FogColor.rgb,clamp(((distance(_WorldSpaceCameraPos.rgb,i.posWorld.rgb)-1.0)/_FogDistance),0.0,_MaxFog).r)*_LightColor0.rgb); float3 finalColor = emissive; /// Final Color: return fixed4(finalColor,1); } ENDCG } } FallBack "Diffuse" CustomEditor "ShaderForgeMaterialInspector" }
Customer support service by UserEcho
Anyhow, I just noticed that there is one special interpolator I haven't used yet!
I might also be able to use a single interpolator for both UV0 and UV1
Made a simpler shader just in case it helps.
Turns out I didn't get the effect I was after anyway (lightmaps affecting other things)