Instantly share code, notes, and snippets.

Embed
What would you like to do?
// 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