- Home /
Question by
yellowelephant · Aug 07, 2014 at 04:18 AM ·
shaderalphamask
How to add an alpha mask to this shader ?
I'm running out of ideas and everything I tried so far just causes errors. DAE have an idea of how to add an alpha mask (texture, b/w) to this shader (like a cutout)? I'm starting to lose my mind.
Shader "Void"
{
Properties
{
_MainTex ("Base (RGB)", 2D) = "white" {}
}
SubShader
{
Pass
{
Tags { "RenderType"="Opaque" }
LOD 200
CGPROGRAM
#pragma vertex vert
#pragma fragment frag
#include "UnityCG.cginc"
sampler2D _MainTex;
float4 _MainTex_ST;
struct v2f
{
float4 pos : SV_POSITION;
float4 scrPos;
};
v2f vert(appdata_base v)
{
v2f o;
o.pos = mul(UNITY_MATRIX_MVP, v.vertex);
o.scrPos = ComputeScreenPos(o.pos);
return o;
}
fixed4 frag(v2f i) : COLOR
{
float2 uv = (i.scrPos.xy / i.scrPos.w);
fixed4 c = tex2D(_MainTex, uv);
return c;
}
ENDCG
}
}
FallBack "Diffuse"
}
Comment
Your answer
Follow this Question
Related Questions
Shader problem with 2D fake lighting 1 Answer
Shader mask using greyscale instead of alpha? 0 Answers
shader problem 0 Answers
How would I add an alpha mask to this shader? 1 Answer
Masking shader with alpha Color 1 Answer