PROBLEM! *iPhone Flickering problem with Lightmap Material *

Hey guys,

We are a few days from submitting to Apple and have not been able to resolve this issue for our current title.

It looks like a material rendering issue from Unity. We are using the Lightmapped only shader from the Starship trooper demo.

When using the lightmap shader, we are getting weird flickering in the shadows areas. We did several test in Unity Maya to resolve the issue. Attached is a screenshot from the driving mode, you can see the type of flickering on the street. Its also part of the smaller environments.

We did several tests including: (Unity / Maya)
•Separate mesh
•Combined mesh
•Only square textures (3 textures / material and 1 lightmap)
•Divided geometry meshes, slightly / medium / heavy (extra geometry for large surface)
•Different camera clipping values (near 0.001 far 3000), (near 5 far 3000: *Antialiasing is a lot better however)
•All UVs within square 1
•Swap texture node order in Maya layered texture, then using “Swap UV” option in Unity
•Testing different texture setting: repeat, clamp and also format 4 bit, etc… mip mapping on / off
•Scale 1 to 1 (instead of 0.1 in Unity)
We really can’t get rid of this problem at all. We don’t have a duplicated mesh, normals are fine etc. We don’t have any transparency in the scenes. No lighting, just using the lightmap shader and an ambient color value from render settings. We are using the latest Beta version of Unity iPhone pro. We are running out of ideas and time.

I was lead 3D artist on several Unity titles including RC Heli, BattlEternal, Vans Sk8 Pool service and Lifeboat. I have never experienced this in the past until recently.

I would really appreciate if anyone could give us ideas to test, or advices if you ran into the same issue in the past.

Thanks,

we had similar problems. The problem was (no idea why) the imported mesh. We have exported a new fbx from maya and the bug has been fixed.
You can also try to enable the mesh setting “calculate Normals”. Maybe it works.

But your problem seems to be another thing

Hi Pat,
I think I have experienced something similar with latest version of unity (1.5 for me), basically the problem was the that UV map (the lightmap one in particular) was imported very badly and new polygons were added to the Uv map creating terrible overlaying of lightmap (having problems to explain it clearly in English…).
You can verify if this is the issue simply by looking at your mesh first with only the color map and after with only the lightmap texture, in this way you will see immediatly if and where there is a problem with the imported UV maps.
Have you tried using an older version of FBX plugin?
What solved it for me was re-exporting the models passing trough a windows software called Unwrap3D. After that no more strange darker tris (basically same thing as in your picture).

Looks like 2 unconnected verts but I could be mistaken. They just often look like that. Or a smoothing group error? if you did not triangulate your mesh inside your 3d app or you didn’t make it quard then maybe it made a guess and cut a funny triangle with messed up smoothing group assignment.

thanks for the tips guys, we did some testing and I dont think it’s a UV issue, we really tested everything. I mean even mapping something on a plain box in the level and it also does it on that box.

We also dont have this issue on the regular color version. This is only with the lightmap applied and it shows in the shadows areas almost all over the level.

The funny thing is that everything works well on a 3GS, we were able to test the device yesterday evening. We don’t have any flickering at all… Something may have change in the latest version of Unity (optimization for 3GS / rendering) and it gives us those artifacts on older devices.

We are in touch with the Unity team and hopefully we can resolve this issue for the game launch.

That really looks like a UV map artifact. I use a lot of models that were created in Maya and have seen this before. The way I fixed it was to open the model in Maya, bring up the UV editor, create a new PSD nework and then import that PSD network into Unity separately. I’ve seen a lot of issues with UV maps getting messed up when importing Maya based models. I haven’t figured out exactly why, but doing the above has fixed the problems I have run into.

Was this issue ever solved?

I started to experience the same thing - models that previously had no problems flickering badly, even parts of them appearing where they should not be visible (i.e. behind other geometry).

The worst thing is, in the editor everything looks absolutely fine. Its only when built to the device (iPhone 3G in this case) that the problem is visible.

I can go back to an older save of my project and the problem vanishes, but that will mean reimporting everything I have since modified.

I am at a loss to know what I have done that caused this.

To triangulate your model before to export to Unity.

Simple example I can give from Maya is you cannot move the invisible edge manually.

Then when you export a model with quads, there are many difference in the way Maya or Unity will triangulate your model for you.

From the screen I can see on the top this issue is about bad conversion of the Quad to Triangle when importing // exporting.

Do you mean convert all Quads to Tris in the mesh?

I use Blender, not Maya.

I’ll try this but think it is unlikely to help.

If I load last week’s backup, everything is fine. But if I load last week’s backup meshes into the current version the glitching occurs. So I think the glitching must be caused by something other than the meshes?

hmm if your lightmap is working under Blender on the same object, this is more a geometry issue.

Lightmap shader do not affect the geometry, it just read the data of your object. (dunno if I can say that like that :roll: )

If you do not have an auto triangulate tool in Blender (I don’t know blender then…), you could try to triangulate some faces with your cut tool where you have the issue.
And then try to do one more export to see if it resolve the problem.

You can also add a screen to your next message with the render in Blender with wireframe and another screen with the render in Unity with wireframe too :stuck_out_tongue:

Thanks for the suggestions but let me explain again -

I don’t think tweaking the model in Blender is the answer because the model is fine in earlier versions of my project.

Something in my new build is making it flicker like crazy. Even the line renderer in the same object is affected, which is not even an imported mesh.

I’m not using a lightmap shader either - just diffuse.

This only happens on the device… I wonder if this is a bug in Unity?

I mean, if the mesh was screwed up, you would be able to see it in the editor right?

Well, I think I will revert to last week’s build and carry on.

I deactivated the affected object and created a new empty object (in the same scene) adding the same flickering mesh and…

it is displays without a glitch. Same Mesh, same Material, same Scene.

So I want to know what is corrupting the original object???

Now, I guess I have done something really stupid and not realized it yet but now I will go through one element at a time and hunt it down…

On closer inspection the problem persists! Or rather it doesn’t - when the object is viewed close up it appears fine. But the further away it gets from the camera the more it starts to break up and flicker / glitch.

Hmmmm… At least I have the issue down to distance now.