- Home /
iPhone 3G Vertex Color and Lighting
I'm using a shader that has vertex coloring and when I tried turning on vertex lighting, it looks bright on iPhone 4 and 3GS but on the iPhone 3G it appears very dark.
Is this something that can be done on the iPhone 3G?
Here is the shader i'm using:
Shader "Vertex Color/Lighting" {
Properties { _MainTex ("Texture", 2D) = "" }
SubShader { Pass { Lighting On ColorMaterial AmbientAndDiffuse SetTexture [_MainTex] { Combine texture * primary DOUBLE } } } }
in script i'm setting the mesh vertex colors to 50% grey
Post the shader. Unless you have Cg code that doesn't match ShaderLab results, I suspect it's because you have two ConstantColors defined, which will be broken on the old iOS GPU.
Answer by Jessy · Dec 06, 2010 at 04:31 AM
When you use ColorMaterial AmbientAndDiffuse on the MBXlite GPU, the Ambient Component is ignored and set to zero. I don't know if this is a limitation of the hardware, or a Unity bug, but I'm reporting it right now.
This is irritating to me, because work was specifically put into this area for Unity 3. (The end of this statement is just offensive to me. As if anyone can decide what is useful for you... >:-O ):
Removed ColorMaterial Ambient, Diffuse, Specular support (ColorMaterial AmbientAndDiffuse & Emission left). Support for the removed ones varied a lot depending on the platform causing confusion; and they didn't seem to be very useful anyway.
You'd think that the original iOS devices would still be an important ones to test, with all this, but apparently not. You're out of luck for now, if you actually need vertex coloring*. However, you say that you're scripting all the colors to be the same, so if that's all you're doing, you don't actually need vertex coloring. Let me know if you don't really need vertex coloring, and I'll write you a shader here if you need it.
*I can also write you a multi-pass vertex-colored shader if the ambient lighting is important enough to warrant it.
I was hoping that wasn't it, I was just trying some ways out of making objects flash certain colors, and work snappy on all iphone versions... and changing the vertex colors seemed like a good idea. I switched to just flipping the material color in a coroutine and it's giving an ok effect so it's not necessary. Thanks though!
Your answer