I’m using the following shader to simulate a window shade. It requires 2 textures, one for the material, one the mask. Testing it, I pic any material, and an image that know has a working alpha channel for the mask. So far so good. Well, the mask was actually a image I was using as a decal for a basket ball court. But if fill in the rest of the image, is should work. Nope. It’ll let me edit it to a point, but if i fill it with the paint tool. it stops working or reverses how it masks. I’ve had trouble with alpha channels in the past, in part because I was using an old version of paint shop pro. Anyway, what do I need to know about alpha channels to make them work reliably? Thanks.
Shader "Custom/Window"
{
Properties
{
_Color ("Main Color", Color) = (1,1,1,0.5)
_MainTex ("Base (RGB) Trans (A)", 2D) = "white" {}
_Mask ("Mix Mask (A)", 2D) = "white" {}
}
SubShader {
// ZWrite Off
// Alphatest Greater 0
Tags {Queue=Transparent}
Lighting Off Cull Off ZTest Always ZWrite Off Fog { Mode Off }
Blend SrcAlpha OneMinusSrcAlpha
Pass
{
// Lighting On
Material {
Diffuse [_Color]
// Ambient [_Color]
// Emission [_PPLAmbient]
}
SetTexture [_MainTex] {
constantColor [_Color]
combine texture * constant, texture * constant
}
SetTexture [_Mask] {
combine previous, texture
}
SetTexture [_MainTex] {
combine previous * texture
}
}
}
FallBack " VertexLit", 1
}
