- Home /
Question by
davidhorak · Oct 10, 2013 at 04:09 PM ·
shadershaderstransparencymask
Implement texture masking into simple existing shader
Hello, I have this shader, and I need implement _AlphaTex (black and white texture) as transparent mask for _MainTex.
Shader "Custom/Custom Transparent" {
Properties {
_MainTex ("Base (RGB)", 2D) = "white" {}
_AlphaTex ("Alpha mask", 2D) = "white" {} // I need implement this texture as Transparent mask for _MainText
}
SubShader {
LOD 100
Tags
{
"Queue" = "Transparent"
"IgnoreProjector" = "True"
"RenderType" = "Transparent"
}
Pass
{
Cull Off
Lighting Off
ZWrite Off
Fog { Mode Off }
Offset -1, -1
ColorMask RGB
AlphaTest Greater .01
Blend SrcAlpha OneMinusSrcAlpha
ColorMaterial AmbientAndDiffuse
SetTexture [_MainTex] {Combine Texture * Primary}
}
}
}
Comment
Best Answer
Answer by DarkPixel · Oct 11, 2013 at 12:39 PM
SetTexture[_MainTex] { combine texture }
SetTexture[_AlphaTex] { combine previous, texture }