- Home /
When doing two passes on different alphas, shader gets overwritten.
When I do two passes and apply either a red or green texture to the pixel depending on if the alpha is over or under 0.5 using SetTexture, I get a shader in full red or full green, but not half-red/half-green, even though half of the texture is under 0.5 alpha and the other half is over 0.5 alpha. Here is my code:
Shader "Examples/Self-Illumination 3" {
Properties {
_MainTex ("Main texture", 2D) = ""
_Red ("Red texture", 2D) = ""
_Green ("Green Texture", 2D) = ""
}
SubShader {
Pass {
AlphaTest GEqual 0.5
Lighting On
SetTexture [_Red] {
}
}
Pass {
AlphaTest Less 0.5
Lighting On
SetTexture [_Green] {
}
}
}
}
PS In my second pass, when I set the texture back to my main texture, I get half red and half of my main texture, so it works. However, I want it to be half red and half green.
Your answer
Follow this Question
Related Questions
Creating a shader that overlaps a diffuse with a TexGen ObjectLinear cutout 0 Answers
Combine Alphatest and AlphaBlending in shaderlab 1 Answer
Is there a way to create an fading alpha-cutoff effect? 0 Answers
Alpha textures? -1 Answers
Rewrite simple alphamask fixed function shader to surface or cg shader 2 Answers