Shader "FX/2bleSidedMatcapBumpedLP" { Properties { _MainTex ("Base (RGB)", 2D) = "white" {} _BumpMap ("Bumpmap (RGB)", 2D) = "bump" {} _MatCap ("MatCap (RGB)", 2D) = "white" {} _LPScale ("Light Probe Influence", float) = 1 } Subshader { Tags { "RenderType"="Opaque" "BW"="TrueProbes"} Fog { Mode Off } Pass { Name "BASE" Cull Back Tags { "LightMode" = "ForwardBase" } CGPROGRAM #pragma vertex vert #pragma fragment frag #pragma fragmentoption ARB_precision_hint_fastest #pragma multi_compile LIGHTMAP_ON LIGHTMAP_OFF #include "UnityCG.cginc" uniform sampler2D _MatCap; uniform sampler2D _MainTex; uniform fixed4 _MainTex_ST; uniform sampler2D _BumpMap; uniform fixed4 _BumpMap_ST; uniform fixed _LPScale; struct v2f { fixed4 pos : SV_POSITION; fixed2 uv : TEXCOORD0; fixed2 uv_bump : TEXCOORD1; fixed3 SHLighting : TEXCOORD3; fixed3 TtoV0 : TEXCOORD4; fixed3 TtoV1 : TEXCOORD5; }; v2f vert (appdata_full v) { v2f o; o.pos = mul(UNITY_MATRIX_MVP, v.vertex); o.uv = TRANSFORM_TEX(v.texcoord, _MainTex); o.uv_bump = TRANSFORM_TEX(v.texcoord, _BumpMap); fixed3 worldNormal = mul((fixed3x3)_Object2World, SCALED_NORMAL); fixed3 shl = ShadeSH9(fixed4(worldNormal, 1.0)); o.SHLighting = shl * _LPScale; TANGENT_SPACE_ROTATION; o.TtoV0 = mul(rotation, UNITY_MATRIX_IT_MV[0].xyz); o.TtoV1 = mul(rotation, UNITY_MATRIX_IT_MV[1].xyz); return o; } float4 frag (v2f i) : COLOR { fixed4 tex = tex2D(_MainTex, i.uv.xy); fixed3 normals = UnpackNormal(tex2D(_BumpMap, i.uv_bump)); fixed2 capCoord = half2(dot(i.TtoV0, normals), dot(i.TtoV1, normals)); fixed4 matcapLookup = tex2D(_MatCap, capCoord * 0.5 + 0.5); matcapLookup.a = 1.0; tex *= matcapLookup * 2.0; tex.xyz *= i.SHLighting; return tex; } ENDCG } Pass { Name "BACK" Cull Front Tags { "LightMode" = "ForwardBase" } CGPROGRAM #pragma vertex vert #pragma fragment frag #pragma fragmentoption ARB_precision_hint_fastest #pragma multi_compile LIGHTMAP_ON LIGHTMAP_OFF #include "UnityCG.cginc" uniform sampler2D _MainTex; uniform fixed4 _MainTex_ST; struct v2f { fixed4 pos : SV_POSITION; fixed2 uv : TEXCOORD0; }; v2f vert (appdata_full v) { v2f o; o.pos = mul(UNITY_MATRIX_MVP, v.vertex); o.uv = TRANSFORM_TEX(v.texcoord, _MainTex); v.normal = -v.normal; return o; } float4 frag (v2f i) : COLOR { fixed4 tex = tex2D(_MainTex, i.uv.xy); return tex; } ENDCG } } FallBack "FX/MatcapDiffuseLP" }