// Shader created with Shader Forge v1.26 
// Shader Forge (c) Neat Corporation / Joachim Holmer - http://www.acegikmo.com/shaderforge/
// Note: Manually altering this data may prevent you from opening it in Shader Forge
/*SF_DATA;ver:1.26;sub:START;pass:START;ps:flbk:,iptp:0,cusa:False,bamd:0,lico:1,lgpr:1,limd:0,spmd:1,trmd:0,grmd:0,uamb:True,mssp:True,bkdf:False,hqlp:False,rprd:False,enco:False,rmgx:True,rpth:0,vtps:0,hqsc:True,nrmq:1,nrsp:0,vomd:0,spxs:False,tesm:0,olmd:1,culm:0,bsrc:0,bdst:1,dpts:2,wrdp:True,dith:0,rfrpo:True,rfrpn:Refraction,coma:15,ufog:True,aust:True,igpj:False,qofs:0,qpre:1,rntp:1,fgom:False,fgoc:False,fgod:False,fgor:False,fgmd:0,fgcr:0.5,fgcg:0.5,fgcb:0.5,fgca:1,fgde:0.01,fgrn:0,fgrf:300,stcl:False,stva:128,stmr:255,stmw:255,stcp:6,stps:0,stfa:0,stfz:0,ofsf:0,ofsu:0,f2p0:False,fnsp:False,fnfb:False;n:type:ShaderForge.SFN_Final,id:9361,x:33209,y:32712,varname:node_9361,prsc:2|custl-6614-OUT;n:type:ShaderForge.SFN_Color,id:2943,x:32587,y:32901,ptovrint:False,ptlb:HighLight,ptin:_HighLight,varname:_HighLight,prsc:2,glob:False,taghide:False,taghdr:False,tagprd:False,tagnsco:False,tagnrm:False,c1:0.3602941,c2:0.3602941,c3:0.3602941,c4:1;n:type:ShaderForge.SFN_Color,id:5129,x:32576,y:32684,ptovrint:False,ptlb:LowLight,ptin:_LowLight,varname:_LowLight,prsc:2,glob:False,taghide:False,taghdr:False,tagprd:False,tagnsco:False,tagnrm:False,c1:0.7132353,c2:0.7132353,c3:0.7132353,c4:1;n:type:ShaderForge.SFN_Lerp,id:6614,x:32890,y:32938,varname:node_6614,prsc:2|A-5129-RGB,B-2943-RGB,T-1023-OUT;n:type:ShaderForge.SFN_Tex2d,id:7481,x:31875,y:33749,ptovrint:False,ptlb:GradienceMap,ptin:_GradienceMap,varname:_Gradience,prsc:2,glob:False,taghide:False,taghdr:False,tagprd:False,tagnsco:False,tagnrm:False,tex:cb89da7e1100944499f9783f8a750859,ntxv:0,isnm:False|UVIN-2380-UVOUT;n:type:ShaderForge.SFN_TexCoord,id:2380,x:31564,y:33766,varname:node_2380,prsc:2,uv:0;n:type:ShaderForge.SFN_Add,id:4392,x:32094,y:33110,varname:node_4392,prsc:2|A-4708-OUT,B-8125-OUT;n:type:ShaderForge.SFN_Lerp,id:8125,x:31852,y:33157,varname:node_8125,prsc:2|A-8573-RGB,B-714-OUT,T-288-OUT;n:type:ShaderForge.SFN_RemapRange,id:714,x:31618,y:33221,varname:node_714,prsc:2,frmn:0,frmx:1,tomn:1,tomx:0|IN-8573-RGB;n:type:ShaderForge.SFN_Tex2d,id:8573,x:31147,y:33174,ptovrint:False,ptlb:TimeMap,ptin:_TimeMap,varname:_TimeNode,prsc:2,glob:False,taghide:False,taghdr:False,tagprd:False,tagnsco:False,tagnrm:False,tex:b8f1d2aab7a1ed0478705fbbbbffde97,ntxv:0,isnm:False|UVIN-1982-UVOUT;n:type:ShaderForge.SFN_TexCoord,id:1982,x:30920,y:33087,varname:node_1982,prsc:2,uv:0;n:type:ShaderForge.SFN_ComponentMask,id:4482,x:32305,y:33086,varname:node_4482,prsc:2,cc1:0,cc2:-1,cc3:-1,cc4:-1|IN-4392-OUT;n:type:ShaderForge.SFN_Code,id:1023,x:32714,y:33346,varname:node_1023,prsc:2,code:IABmAGwAbwBhAHQAIAByAGUAdABWAGEAbAA7AA0ACgAgACAAIAAgACAAIAAgACAAIAAgAA0ACgAgAGYAbABvAGEAdAAgAHQAIAA9ACAAKAAoAEkAbgBwAHUAdAAgACsAIABTAGwAaQBkAGUAcgApAC8AKAAyACoAUwBsAGkAZABlAHIAKQApADsADQAKACAAcgBlAHQAVgBhAGwAIAA9ACAAbABlAHIAcAAgACgAMAAsADEALAB0ACkAOwANAAoAIAAgACAAIAAgACAAIAAgACAAIAAgACAADQAKACAAcgBlAHQAdQByAG4AIABjAGwAYQBtAHAAIAAoAHIAZQB0AFYAYQBsACwAIAAwAC4AMAAsACAAMQAuADAAKQA7AA==,output:0,fname:CieltoGrad,width:384,height:187,input:0,input:0,input_1_label:Input,input_2_label:Slider|A-5345-OUT,B-3076-OUT;n:type:ShaderForge.SFN_Slider,id:4708,x:31020,y:32871,ptovrint:False,ptlb:TimeNode,ptin:_TimeNode,varname:node_4708,prsc:2,glob:False,taghide:False,taghdr:False,tagprd:False,tagnsco:False,tagnrm:False,min:-1,cur:-0.6582282,max:1;n:type:ShaderForge.SFN_ToggleProperty,id:288,x:31690,y:33410,ptovrint:False,ptlb:InvertMap,ptin:_InvertMap,varname:node_288,prsc:2,glob:False,taghide:False,taghdr:False,tagprd:False,tagnsco:False,tagnrm:False,on:True;n:type:ShaderForge.SFN_Clamp01,id:5345,x:32503,y:33211,varname:node_5345,prsc:2|IN-4482-OUT;n:type:ShaderForge.SFN_Clamp01,id:5374,x:32066,y:33749,varname:node_5374,prsc:2|IN-7481-R;n:type:ShaderForge.SFN_RemapRange,id:3076,x:32297,y:33684,varname:node_3076,prsc:2,frmn:0,frmx:1,tomn:0.001,tomx:1|IN-5374-OUT;proporder:2943-5129-7481-8573-4708-288;pass:END;sub:END;*/

Shader "Shader Forge/BackGroundEffect" {
    Properties {
        _HighLight ("HighLight", Color) = (0.3602941,0.3602941,0.3602941,1)
        _LowLight ("LowLight", Color) = (0.7132353,0.7132353,0.7132353,1)
        _GradienceMap ("GradienceMap", 2D) = "white" {}
        _TimeMap ("TimeMap", 2D) = "white" {}
        _TimeNode ("TimeNode", Range(-1, 1)) = -0.6582282
        [MaterialToggle] _InvertMap ("InvertMap", Float ) = 1
    }
    SubShader {
        Tags {
            "RenderType"="Opaque"
        }
        Pass {
            Name "FORWARD"
            Tags {
                "LightMode"="ForwardBase"
            }
            
            
            CGPROGRAM
            #pragma vertex vert
            #pragma fragment frag
            #define UNITY_PASS_FORWARDBASE
            #include "UnityCG.cginc"
            #pragma multi_compile_fwdbase_fullshadows
            #pragma multi_compile_fog
            #pragma exclude_renderers gles3 metal d3d11_9x xbox360 xboxone ps3 ps4 psp2 
            #pragma target 3.0
            uniform float4 _HighLight;
            uniform float4 _LowLight;
            uniform sampler2D _GradienceMap; uniform float4 _GradienceMap_ST;
            uniform sampler2D _TimeMap; uniform float4 _TimeMap_ST;
            float CieltoGrad( float Input , float Slider ){
             float retVal;
                      
             float t = ((Input + Slider)/(2*Slider));
             retVal = lerp (0,1,t);
                        
             return clamp (retVal, 0.0, 1.0);
            }
            
            uniform float _TimeNode;
            uniform fixed _InvertMap;
            struct VertexInput {
                float4 vertex : POSITION;
                float2 texcoord0 : TEXCOORD0;
            };
            struct VertexOutput {
                float4 pos : SV_POSITION;
                float2 uv0 : TEXCOORD0;
                UNITY_FOG_COORDS(1)
            };
            VertexOutput vert (VertexInput v) {
                VertexOutput o = (VertexOutput)0;
                o.uv0 = v.texcoord0;
                o.pos = mul(UNITY_MATRIX_MVP, v.vertex );
                UNITY_TRANSFER_FOG(o,o.pos);
                return o;
            }
            float4 frag(VertexOutput i) : COLOR {
////// Lighting:
                float4 _TimeMap_var = tex2D(_TimeMap,TRANSFORM_TEX(i.uv0, _TimeMap));
                float node_5345 = saturate((_TimeNode+lerp(_TimeMap_var.rgb,(_TimeMap_var.rgb*-1.0+1.0),_InvertMap)).r);
                float4 _GradienceMap_var = tex2D(_GradienceMap,TRANSFORM_TEX(i.uv0, _GradienceMap));
                float3 finalColor = lerp(_LowLight.rgb,_HighLight.rgb,CieltoGrad( node_5345 , (saturate(_GradienceMap_var.r)*0.999+0.001) ));
                fixed4 finalRGBA = fixed4(finalColor,1);
                UNITY_APPLY_FOG(i.fogCoord, finalRGBA);
                return finalRGBA;
            }
            ENDCG
        }
    }
    FallBack "Diffuse"
    CustomEditor "ShaderForgeMaterialInspector"
}
