Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Shader "FX/MatcapDiffuse_Alpha"
- {
- Properties
- {
- _MainTex ("Base (RGB)", 2D) = "white" {}
- _MatCap ("MatCap (RGB)", 2D) = "white" {}
- _Alpha ("Alpha", float) = 0.5
- }
- Subshader
- {
- Blend SrcAlpha OneMinusSrcAlpha
- Tags { "Queue"="Transparent" "IgnoreProjector"="True" "RenderType"="Transparent"}
- Cull Back
- Fog { Mode Off }
- Pass
- {
- Name "BASE"
- 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 fixed _Alpha;
- struct v2f
- {
- fixed4 pos : SV_POSITION;
- fixed2 uv : TEXCOORD0;
- fixed2 cap : TEXCOORD3;
- };
- v2f vert (appdata_full v)
- {
- v2f o;
- o.pos = mul(UNITY_MATRIX_MVP, v.vertex);
- o.uv = TRANSFORM_TEX(v.texcoord, _MainTex);
- fixed2 capCoord;
- capCoord.x = dot(UNITY_MATRIX_IT_MV[0].xyz, v.normal);
- capCoord.y = dot(UNITY_MATRIX_IT_MV[1].xyz, v.normal);
- o.cap = capCoord * 0.5 + 0.5;
- return o;
- }
- float4 frag (v2f i) : COLOR
- {
- fixed4 tex = tex2D(_MainTex, i.uv.xy);
- fixed4 matcapLookup = tex2D(_MatCap, i.cap);
- // matcapLookup.a = tex.a;
- tex *= matcapLookup * 2.0;
- tex.a = _Alpha;
- return tex;
- }
- ENDCG
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement