- Home /
vertex panit shader support for android/ios ?
hi everyone,
i work with vertex paint(RGB) and blend by alpha channel so this is shader code that i use
Shader "RGB Vertexcolor Blend by Vertex Alpha"
{
Properties
{
_MainTex ("Texture 1 (vertex A = red)", 2D) = ""
_Texture2 ("Texture 2 (vertex A = green)", 2D) = ""
_Texture3 ("Texture 2 (vertex A = blue)", 2D) = ""
}
SubShader
{
BindChannels
{
Bind "vertex", vertex
Bind "color", color
Bind "texcoord", texcoord
}
Pass
{
SetTexture [_MainTex]
SetTexture [_Texture2] {combine previous lerp(primary) texture}
SetTexture [_Texture3] {combine previous lerp(primary) texture}
}
}
}
it's work well in unity but when i try to plublic on android, some object that use this shader is missing they didn't show correctly texture as i see in unity. i wonder how it's happen? or android/ios not support for vertex paint? any idea? pls help.
thk for share :)
ps. i test on android 2.3.4 with sony ericsson xperia neo-v (cpu 1g hz, ram512 single core)
Answer by SummerLynx · May 25, 2012 at 07:34 PM
Maybe it's a bit too late, but i'll try to answer for anyone there having trouble)
Try to bind texcoord for each SetTexture. Like this:
BindChannels
{
Bind "vertex", vertex
Bind "color", color
Bind "texcoord", texcoord0
Bind "texcoord", texcoord1
Bind "texcoord", texcoord2
}
Worked for me with ICS. But with Gingerbread i'm getting trouble with that. If that does'nt work, try to split your shader in different passes.
Also, check this nice tutorial about ShaderLab: http://www.youtube.com/playlist?list=PL31F6A116DCCC9F61&feature=plcp
It's never too late to answer a question and this one is even from this year :D We have much older questions. This should be a knowledge database so even when the OP never comes back, it should help others with the same problem.
Unfortunately we have way much more people asking question than people answering them. So everyone with knowledge is always welcome ;)
I'm not that familiar with Android, but i guess the problem is that the hardware don't have 3 texture units so i think using 3 passes would fix it. Of course 3 passes means performance loss, but hey, it's a smartphone, not a ga$$anonymous$$g PC ;)