Hey,
while developing a game for a client we came across a problem:
I tried to assemble the hand shader from snippets I found but since I suck at shaders I cannot seem to fix the problem
The hand icon is supposed to be always on top of everything. But when the transparent material overlays with the hand it is below.
This is the code for the experimental onTop Shader:
Shader "EXP/Alpha_Unlit_AlwaysInFront"
{
Properties
{
//_Color ("Main Color", Color) = (1,1,1,1)
_MainTex ("Base (RGB)", 2D) = "white" {}
}
SubShader
{
Tags { "Queue"="Transparent" "IgnoreProjector"="True" "RenderType"="Transparent" }
Lighting Off Cull Off ZTest Off ZWrite Off Fog { Mode Off }
Pass
{
Name "BASE"
Alphatest Off
Blend SrcAlpha OneMinusSrcAlpha
SetTexture [_MainTex] {
}
}
}
}
and this is the code for the transparent , look through objects.
Shader "Mobile/Transparent/Vertex Color" {
Properties {
_Color ("Main Color", Color) = (1,1,1,1)
_SpecColor ("Spec Color", Color) = (1,1,1,0)
_Emission ("Emmisive Color", Color) = (0,0,0,0)
_Shininess ("Shininess", Range (0.1, 1)) = 0.7
_MainTex ("Base (RGB) Trans (A)", 2D) = "white" {}
}
Category {
Tags {"Queue"="Transparent" "IgnoreProjector"="True" "RenderType"="Transparent"}
ZWrite Off
Alphatest Greater 0
Blend SrcAlpha OneMinusSrcAlpha
SubShader {
Material {
Diffuse [_Color]
Ambient [_Color]
Shininess [_Shininess]
Specular [_SpecColor]
Emission [_Emission]
}
Pass {
ColorMaterial AmbientAndDiffuse
Fog { Mode Off }
Lighting Off
SeparateSpecular On
SetTexture [_MainTex] {
Combine texture * primary, texture * primary
}
SetTexture [_MainTex] {
constantColor [_Color]
Combine previous * constant DOUBLE, previous * constant
}
}
}
}
}
This can’t be too hard to fix, right?
What am I doing wrong?
And, are these shaders expensive when thinking about mobile use?
Help very, very much appreciated.
Simon