I changed the older Mobile/Lightmap/reflective shader slightly to fit my needs. Doesn´t need lightmap, but decals instead. Maintexture needs to be tintable by color. Now, i am wondering whether it is somehow possible to get rid of the 2nd pass for 3GS and newer? Tried already a lot of combinations, but no luck.
While i can simply add one texturestage in the first pass, this one is not controlled by the alpha of the maintexture it seems. its just plain 100% reflection then.
Anybody ideas or a definate DOESNT WORK maybe?
Shader "iPhone/Phantom/ReflectiveDecal" {
Properties {
_Color ("Main Color", Color) = (1,1,1,1)
_SpecColor ("Spec Color", Color) = (1,1,1,0)
_Shininess ("Shininess", Range (0.1, 1)) = 0.7
_MainTex ("Base (RGB) Trans (A)", 2D) = "white" {}
_Reflect ("Reflection", 2D) = "white" { TexGen SphereMap }
_DecalTex ("Decal (RGBA)", 2D) = "black" {}
}
Category {
SubShader {
Material {
Diffuse [_Color]
Ambient [_Color]
Shininess [_Shininess]
Specular [_SpecColor]
}
Pass {
ZWrite On
Alphatest Greater 0
BindChannels {
Bind "Vertex", vertex
Bind "normal", normal
Bind "texcoord", texcoord0 // main uses 1st uv
Bind "texcoord1", texcoord1 // main uses 2nd uv
}
// Wenn ColorMaterial AmbientAndDiffuse gesetzt ist wird die Farbe komplett auf Ambient gesetzt
//ColorMaterial AmbientAndDiffuse
Fog { Mode Off }
Lighting On
SeparateSpecular On
SetTexture [_MainTex] {
combine texture +- primary Double
}
SetTexture [_DecalTex] {
combine texture lerp (texture) previous
}
/*
This doesn´t give the desired result, reflection is 100%
SetTexture [_Reflect] {
//combine one -texture, previous
combine texture +- previous , texture
}
*/
}
// Fetch reflective Strength from mainTex alpha
Pass
{
Name "REFLECT"
ZWrite On
//Offset -1, -1
Alphatest Greater 0
Blend SrcAlpha OneMinusSrcAlpha
BindChannels {
Bind "Vertex", vertex
Bind "normal", normal
Bind "texcoord", texcoord0 // main uses 1st uv
}
SetTexture [_MainTex] {}
SetTexture [_Reflect] {
//combine one -texture, previous
combine texture +- previous , previous
}
}
}
}
}