I have a situation where I need to have the following:
One main ARGB texture.
One ARGB decal on top of that.
One ARGB decal on top of those.
Double sided
Emissive
Lighting On
The shader I hacked together does the job, but I’d like to know:
A. How can I get rid of the halo that’s showing up around the second decal texture (see screen shot at end of post)? If I play around with things in the shader I can get the halo to go away, but then I lose things like semi-transparency. Note: The texture is a PNG and there is no halo around it in the actual texture.
B. Is this code ok? Is there anything in there that will make it have problems? It works on my system and when I try some different graphics emulation settings, but can it be improved?
Here is my current code:
Shader "Transparent/Clothes" {
Properties {
_Color ("Main Color", Color) = (1,1,1,1)
_Emissive ("Emissive Color", Color) = (.1,.1,.1,.1)
_MainTex ("Bottom (RGB) Trans(A)", 2D) = "white" {}
_DecalTex ("Top (RGBA)", 2D) = "black" {}
_DecalTex2 ("OverTex (RGB) Trans(A)", 2D) = "white" {}
}
Category {
Tags {Queue=Transparent}
Alphatest Greater 0
ColorMask RGB
Offset -1, -1
SubShader {
Cull Off
Material {
Diffuse [_Color]
Ambient [_Color]
Emission [_Emissive]
}
Pass {
Lighting On
ZWrite On
Blend SrcAlpha OneMinusSrcAlpha
SetTexture [_MainTex] { combine texture }
SetTexture [_DecalTex] {combine texture lerp (texture) previous}
SetTexture [_DecalTex2] {combine texture lerp (texture) previous}
SetTexture [_MainTex] {combine previous * primary DOUBLE, previous * constant constantColor [_Color]}
}
}
}
}
Ignore the weird outfit thing in this shot, I just did this to better show what I mean about the halo.