Skip to content

Instantly share code, notes, and snippets.

@hadashiA
Created March 30, 2017 05:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hadashiA/c8876f9823bacfd2f7699ab46f012b52 to your computer and use it in GitHub Desktop.
Save hadashiA/c8876f9823bacfd2f7699ab46f012b52 to your computer and use it in GitHub Desktop.
Shader "ShaderDrill/0327/Subtractive"
{
Properties {
_MainTex ("Base (RGB) Trans (A)", 2D) = "white" {}
_Color ("Tint", Color) = (1,1,1,1)
}
SubShader
{
Tags
{
"Queue"="Transparent"
"IgnoreProjector"="True"
"RenderType"="Opaque"
}
Cull Back
Blend SrcAlpha One
BlendOp RevSub
Pass
{
CGPROGRAM
#pragma vertex vert
#pragma fragment frag
#pragma target 2.0
#include "UnityCG.cginc"
struct appdata_t
{
float4 pos : POSITION;
float2 uv : TEXCOORD0;
};
struct v2f
{
float4 pos : SV_POSITION;
half2 uv : TEXCOORD0;
};
sampler2D _MainTex;
sampler2D _MaskTex;
float4 _MainTex_ST;
fixed4 _Color;
v2f vert(appdata_t v)
{
v2f o;
o.pos = UnityObjectToClipPos(v.pos);
o.uv = TRANSFORM_TEX(v.uv, _MainTex);
return o;
}
fixed4 frag(v2f i) : SV_Target
{
return tex2D(_MainTex, i.uv) * _Color;
}
ENDCG
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment