- Home /
Mobile: Flickering on animated skinned meshes
I've noticed flickering lighting on some animated meshes. The scene has 1 directional light and meshes have Mobile/Diffuse shader applied.
One of my animations is a spinning sphere, and as it spins spikes grow in and out. The spikes will be lit up when they are small, but as they grow they will get darker. Other animations are simple idles, like a NPC rocking back and forth. When he rocks, some polygons get lit up and others not, flickering based on the angle of the light? There's no in between like the spikes.
Happens to both 1-sided and 2-sided polygon faces. But not the whole mesh, just parts of the mesh or specifics faces.
Can be seen while I run build on Android device. Also can be seen in the Unity Editor if graphics emulations is set to OpenGL ES 1.x (Player build settings are set to 2.0 though).
I haven't changed the scaling of anything in the Editor, but I know some of the animations use scaling, like the growing spikes. Could this be an issue for the mesh hierarchy?
My current theory is that when a part of the mesh scales, somehow the normals or UV lose their precision or values, but I have no proof to back this. My current solution is to replace the shader to an Unlit one... Does anyone know the cause of this flickering issue or have any ideas how to fix it?
Answer by Paulius-Liekis · Oct 29, 2012 at 09:39 AM
If you have multiple meshes, then the first thing I would try: disable batching. Does that help?
Thanks for the reply, it does help. When I disable dynamic batching, the flickering goes away. I'm just trying to think of a way to keep dynamic batching on but disabled for specific objects. I could slightly change the scale on the objects or add additional material instances to stop them from batching, or maybe use a multi-pass shader. Any suggestions here?
No not really. Do you really need batching? i.e. are you having problems with performance from draw-call count point of view? In most cases I find that it's ok simply to disable batching on my projects. There is not considerable slowdown on small projects.