// Upgrade NOTE: replaced 'mul(UNITY_MATRIX_MVP,*)' with 'UnityObjectToClipPos(*)' Shader "TripleBrick/DecalBlend" { Properties { _MainTex ("MainTex", 2D) = "white" {} _Strength ("Strength", Range(0, 2)) = 0.7 _DarkBrightBalance ("Dark Bright Balance", Range(0.3, 2)) = 0.3 [HideInInspector]_Cutoff ("Alpha cutoff", Range(0,1)) = 0.5 } SubShader { Tags { "IgnoreProjector"="True" "Queue"="Transparent" "RenderType"="Transparent" } GrabPass{ } Pass { Name "FORWARD" Tags { "LightMode"="ForwardBase" } Blend SrcAlpha OneMinusSrcAlpha ZWrite Off CGPROGRAM #pragma vertex vert #pragma fragment frag #define UNITY_PASS_FORWARDBASE #include "UnityCG.cginc" #pragma multi_compile_fwdbase #pragma multi_compile_fog #pragma exclude_renderers gles3 metal d3d11_9x xbox360 xboxone ps3 ps4 psp2 #pragma target 3.0 uniform sampler2D _GrabTexture; uniform sampler2D _MainTex; uniform float4 _MainTex_ST; uniform float _Strength; uniform float _DarkBrightBalance; struct VertexInput { float4 vertex : POSITION; float2 texcoord0 : TEXCOORD0; }; struct VertexOutput { float4 pos : SV_POSITION; float2 uv0 : TEXCOORD0; float4 screenPos : TEXCOORD1; UNITY_FOG_COORDS(2) }; VertexOutput vert (VertexInput v) { VertexOutput o = (VertexOutput)0; o.uv0 = v.texcoord0; o.pos = UnityObjectToClipPos(v.vertex ); UNITY_TRANSFER_FOG(o,o.pos); o.screenPos = o.pos; return o; } float4 frag(VertexOutput i) : COLOR { #if UNITY_UV_STARTS_AT_TOP float grabSign = -_ProjectionParams.x; #else float grabSign = _ProjectionParams.x; #endif i.screenPos = float4( i.screenPos.xy / i.screenPos.w, 0, 0 ); i.screenPos.y *= _ProjectionParams.x; float2 sceneUVs = float2(1,grabSign)*i.screenPos.xy*0.5+0.5; float4 sceneColor = tex2D(_GrabTexture, sceneUVs); ////// Lighting: ////// Emissive: float4 node_8077 = sceneColor; float4 _MainTex_var = tex2D(_MainTex,TRANSFORM_TEX(i.uv0, _MainTex)); float3 node_925 = (_MainTex_var.rgb*1.0); float node_7948 = 2.0; float3 emissive = clamp((_DarkBrightBalance*lerp((1.0 - (((1.0 - node_8077.rgb)*(1.0 - node_925))*node_7948)),((node_925*node_8077.rgb)*node_7948),round(node_925))),0,1); float3 finalColor = emissive; fixed4 finalRGBA = fixed4(finalColor,pow((_MainTex_var.a*_Strength),(3.0-_Strength))); UNITY_APPLY_FOG(i.fogCoord, finalRGBA); return finalRGBA; } ENDCG } } }