Needing help with setting tangents on a procedural mesh

I’m making a sphere procedural, and on all but 4 spots where two meshes(6 curved surfaces make up the cubesphere)

I set the shader to show the normals which I’m also generating manually, and they look perfectly fine (computateNormals on the other hand does not look right.

I’m not sure how I need to have the tangents set. How I have it now is wrong on some of the edges…
If I have the normals, how do I compute the tangents from that? Or do I need more than just the normals?

Anyways, here is a screenshot of the issue made from the resulting lighting, and the package.


625480–22291–$procedural.unitypackage (710 KB)

You’ll find your answer here : http://answers.unity3d.com/questions/7789/calculating-tangents-vector4.html

That C# script seems off.

Assets/Plugins/FixTangents.cs(3,30): error CS0246: The type or namespace name `Mesh’ could not be found. Are you missing a using directive or an assembly reference?

Isn’t “mesh” also a bad name for a variable?

I can probably copy that math though…

Love the graphics in your latest game, by the way.

you need to include UnityEngine at the top.

Why would you say that? I call most of my meshes mesh, and have yet to regret it :stuck_out_tongue:

That script makes it even worse.

Oops. It works after fixing a line as per a comment, but it’s atrociously slow.

My previous method of setting tangents was extremely fast, it just was messed up on the edges.