I’m having trouble with lightmaps. My game levels are made up of several small tile models which are aligned to each other using vertex snapping. I then proceed to lightmap the entire level using unity’s lightmapping. In the editor everything looks good but on my android device (Samsung Galaxy S) the entire level sort of flickers, the lightmap texture on each tile changes randomly to an incorrect texture. If I change the graphics level to OpenGL ES 2.0 everything looks good on the device but this also causes unacceptable lag. Don’t lightmaps work with OpenGL ES 1.x or am I doing something else wrong?
Well, OpenGL ES 1.x only supports unlit and VertexLit. If you use any other shaders (Diffuse for example), it will fall back.
The OpenGL ES 1.x emulation INSIDE of the editor was always bit bugs and may cause flickering while moving the camera inside of the scene/editor. Just build and push it on your android device to test it under real circumstances, it usally don’t flicker there.
You should use OpenGL ES 2.0, as it supports more than VERY simple shaders. if you scene is to slow, you may have pixel light enabled (Your light source is set to “important” instead of “not important”). Important = Pixel Lighting, “Not Important” = Vertex lighting. Vertex is much faster.
Also make sure that you don’t have more than 1 (ONE) pixel light in your scene. Having more than one will signficantly slow down your game on most smartphones.
Thanks for the reply. My lights are set to auto, I’ll try setting them to not improtant. How big of an impact should using OpenGL ES 2.0 usually have on frame rate? I mean should there be much of a difference between for example OpenGL ES 1.x with VertexLit shaders and 2.0 with diffuse shaders?
From next to zero impact up to huge impact.
It comes down to the shaders. If you use OpenGL ES 2.0 with only Unlit and simple Vertex Shaders, the performance is same as with OpenGL ES 2.0.
OpenGL version has nothing to do with performance, it just allows you to use more complex shaders. More complex shaders costs more CPU cycles. So the more complex a shader is the lower the performance will be. It’s always a quality vs performance question
Okay, so the drop in performance I’m seeing is because I have mobile bumped diffuse shaders which fall back to vertexlit in 1.x but work like they should in 2.0. So if I switch my materials to use VertexLit shader with 2.0 on, I shouldn’t get the performance drop and the lightmaps should work correctly.
Yea. Still keep in mind to use “Non Important” lights. I think OpenGL ES 1.x doesn’t support pixel light (it’s one of the advanced shader features). “Non important” lights are good enough for most uses and there is no nead to use pixel lightning on mobiles.