Skip to content

Instantly share code, notes, and snippets.

@jkrup
Created October 15, 2012 16:45
Show Gist options
  • Save jkrup/3893540 to your computer and use it in GitHub Desktop.
Save jkrup/3893540 to your computer and use it in GitHub Desktop.
Mask shader for Unity3d
Shader "Custom/bitmask"
{
Properties
{
//_MainTex ("Base", 2D) = "black" {}
_Mask ("Culling Mask", 2D) = "" {}
_Cutoff ("Alpha Cutoff", Range(0,1)) = 0
}
SubShader
{
Lighting Off
ZWrite On
Tags {"Queue" = "Geometry"}
//Blend OneMinusSrcAlpha DstAlpha
blend srcalpha dstalpha
Pass {
AlphaTest LEqual [_Cutoff]
//SetTexture [_Mask] { combine texture }
SetTexture [_Mask] { combine texture alpha } //Uncomment to see white
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment