How can this be? I think every Android 4 device will support Vertex Lighting, right?
In a new project with a new scene I added some objects and a point light. The shader is set to Mobile/VertexLit. Only exception is the cylinder. It uses the standard shader.
Thing is: on my Android tablet (Android 4), the lighting does not work.
But on my Android phone, it works well.
Used shader is Mobile/VertexLit that ships with Unity.
I found this thread: https://forum.unity3d.com/threads/black-textures-on-some-devices-android-versions.195328/
But none of the solutions worked for me.
Is there some user made shader I could use? I need vertex colors and lighting from a point light. For mobile devices.
Better use regular standard shader and use Shader.globalMaximumLOD = 150 inside some script to get vertex-lit shading. Otherwise I do not know any other solution.
I now wrote a simple surface shader that considers vertex colors.
This works for me, because the point light is calculated on pixel level and the color is added using vertex colors.
BUT: Using this shader Dynamic Batching does not work anymore. It also does not work when I use the Standard shader. Only with Mobile/VertexLit.
And because Batching is the only reason I started with vertex color stuff, this is not really a solution for me.
So in addition to my first question: Why does Dynamic Batching not work with this shader?
Shader "Custom/LambertVertexColors" {
Properties {
_MainTex ("Albedo (RGB)", 2D) = "white" {}
}
SubShader {
Tags { "RenderType" = "Opaque" }
CGPROGRAM
#pragma surface surf Lambert vertex:vert
struct Input {
float2 uv_MainTex;
float3 customColor;
};
void vert (inout appdata_full v, out Input o) {
UNITY_INITIALIZE_OUTPUT(Input,o);
o.customColor = v.color;
}
sampler2D _MainTex;
void surf (Input IN, inout SurfaceOutput o) {
o.Albedo = tex2D (_MainTex, IN.uv_MainTex).rgb;
o.Albedo *= IN.customColor;
}
ENDCG
}
}
Actually, @achimmihca, this IS a unity bug with Vertex-lit combination with Spot light on some Android GPUs.
This issue seems to have started with version 5.3 so it’s been there for a while. Maybe it’s worth upvoting this issue in the link above so unity can get it fixed.