Skip to content

Instantly share code, notes, and snippets.

@y23586
Created August 13, 2018 08:55
Show Gist options
  • Save y23586/e7553ef35aceb62871b400451c38f114 to your computer and use it in GitHub Desktop.
Save y23586/e7553ef35aceb62871b400451c38f114 to your computer and use it in GitHub Desktop.
// Reference: https://qiita.com/ShirakawaMaru/items/e29d95e86add4ec0e3b7
Shader "Custom/PenTransparent" {
SubShader {
Pass {
CGPROGRAM
#pragma vertex vert
#pragma fragment frag
#pragma target 3.0
struct v2f {
float2 uv : TEXCOORD0;
};
v2f vert(float4 pos : POSITION, out float4 wpos : SV_POSITION, float2 uv : TEXCOORD0) {
v2f o;
o.uv = uv;
wpos = UnityObjectToClipPos(pos);
return o;
}
float4 frag(v2f i , UNITY_VPOS_TYPE vpos : VPOS) : SV_TARGET {
float4 col = {1, 1, 1, 1};
int2 xy = vpos.xy / _ScreenParams.x * 100;
col.rgb = ((xy.x+xy.y)&1) ? 1 : ((float) 0xCC / 0xFF);
return col;
}
ENDCG
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment