Shader wants tangents spam (Unity 4.0)

Since Unity 4.0, the innocent “Shader wants tangents, but the mesh doesn’t have them” error, that used to pop up like once, but didn’t seem to cause any harm whatsoever, has turned into a major enemy of the system.

I get several thousand of them per minute (like one per object per frame), and my game runs at a crawl (okay, my game -crawls-).

Now the message neither gives any clues as to which shader causes this, or which mesh is the one in question. In any case, everything renders fine, so wherever the problem is, it doesn’t matter, or rather, it wouldn’t, if Unity could just shut up about it.

So I did identify a few potential culprits (e.g. a mesh that I create and update dynamically at runtime). I also found a script here that calculates the tangents. Obviously it must be more objects than the dynamic one, since the message still shows up thousandfold. But also, the script is several times slower than the script that generates the mesh and uvs and normals in the first place, so it’s close to unusable for me.

I also have a few shaders that could be causing the problem. They’re made with strumpy’s shader editor, and I have no idea what causes a shader to need tangents. I would have suspected doing something with the normals, as a bump shader would do, which I don’t. The closest thing I’m using is the NormalizedScreenPosition, which I doubt causes this.

I’ve been at it since Unity 4 is out and I’m at a loss. So hopefully someone has an idea how to tackle this. (e.g. someone working for Unity, who can just turn off the message and roll out an update :roll_eyes:)

Hello,

Sorry to bump this up, but… for the love of god, someone has an answer for this?
I am working in a project with other teams. Since last time I imported some models of them, I noticed this message “Shader wants tangents, but the mesh doesn’t have them” after finding an error in game (no relation to this). I cannot just take out the models anymore.

But I CANNOT TRACK this damn model (or whatever) with this error.
It messed up all my debug log commands to console for finding errors in my game (because I cannot use “Collapse” command, because of some default messages in my game).

Anybody knows how to disable this??? Or just how to find the problem?
Unity does not point out where the error really is… it is the same of telling me “your car has a problem…find it by yourself”

Thanks in advance.

Your shader is looking for tangent information, usually a normal map to function correctly. You’ll get this information until you resolve that.

Yeah, thanks… I know how to solve, the problem is at this point I cannot check every model for this.
But anyway, I just put some time log on the debugs, so I will not focus on this problem now. Thanks :slight_smile: