dacloo
1
Hi!
I am changing all kinds of shaders on this forum to try to get the desired effect, but I can’t get it to work 
I want 2 alpha textures ‘on top’ of eachother.
These should not be affected by lighting in the scene.
Should be easy…right? :shock:
Could anyone help me out a bit? Thank you!
Aras
2
So you want a base texture; and another texture blended on top based on it’s alpha channel? Like the built-in Decal shader, just with no lighting?
…or something else?
dacloo
3
Um… yes, basicly a base texture (alpha), and another one blended on top (also alpha). And then no lighting from the scene indeed.
8)
dacloo
4
Still haven’t been able to find it out 
Aras
5
I’m still not sure how you want the colors or alphas of them combined, so I have several attempts:
If you want to blend first texture and blend the second texture (note that the result will be different if you swap the textures in the material):
Shader "Alpha/TwoTextures Unlit" {
Properties {
_MainTex ("Base (RGB) Trans(A)", 2D) = "white" {}
_MainTex2("Base (RGB) Trans(A)", 2D) = "white" {}
}
SubShader {
Pass {
ColorMask RGB
Blend SrcAlpha OneMinusSrcAlpha
ZWrite Off
SetTexture[_MainTex] { combine texture }
}
Pass {
ColorMask RGB
Blend SrcAlpha OneMinusSrcAlpha
ZWrite Off
SetTexture[_MainTex2] { combine texture }
}
}
}
If you want the colors and the alphas to add together, and then blend over background:
Shader "Alpha/TwoTextures Unlit" {
Properties {
_MainTex ("Base (RGB) Trans(A)", 2D) = "white" {}
_MainTex2("Base (RGB) Trans(A)", 2D) = "white" {}
}
SubShader {
Pass {
ColorMask RGB
Blend SrcAlpha OneMinusSrcAlpha
ZWrite Off
SetTexture[_MainTex] { combine texture }
SetTexture[_MainTex2] { combine texture + previous }
}
}
}
If you want the colors and alphas to multiply together, change “texture + previous” in the last example to “texture * previous”. And so on 
seon
6
Is that all there is to writing shaders?
You can obviously get way more complicated but, yes, they’re just text files.
Pixel shaders are hard (at least, to me). You can download the source for all the shaders and see how they are made.
–Eric
dacloo
9
Hi Aras,
Thanks!
Unfortunately they don’t seem to work as they miss the _color property…
Aras
10
Well, you did not say you need the color as well… so I just went the easiest way
How you want the color to be combined with the textures?
Don’t you also need
SubShader {
Tags {Queue=Transparent}
Otherwise 3D geometry probably covers it up?
–Eric
dacloo
12
Hehe okay…thanks for helping me man!
The idea is this:
I have a transparent PNG (a chat ‘balloon’).
I have a render-to-texture which contains text.
The text (with transparent background) needs to go on top of the transparent balloon. Basicly the text is ‘stamped’ on the balloon.
This material is then placed on a plane which faces the camera.
Aras
13
Ah, ok. So that would be like (note that I’m not actually testing this, just typing from my head :)):
Shader "Alpha/TwoTextures Unlit" {
Properties {
_Color ("Main Color", Color) = (1,1,1,1)
_MainTex ("Base (RGB) Trans(A)", 2D) = "white" {}
_MainTex2("Base (RGB) Trans(A)", 2D) = "white" {}
}
SubShader {
Tags { "Queue" = "Transparent" }
Pass {
ColorMask RGB
Blend SrcAlpha OneMinusSrcAlpha
ZWrite Off
Color [_Color]
SetTexture[_MainTex] { combine texture * primary }
}
Pass {
ColorMask RGB
Blend SrcAlpha OneMinusSrcAlpha
ZWrite Off
Color [_Color]
SetTexture[_MainTex2] { combine texture * primary }
}
}
}
Eric5h5: yeah, I forgot the Queue tag.
dacloo
14
Aaah I had to tweak some stuff but the shader itself did a wonderful job. Thanks guys. Lemme know if I can help you out some time…