Notifications
Clear all

[Closed] Find flipped UV's

I’m looking for a way to check the uv’s of an object for any that are flipped. I thought I could compare the order of UV verts with the order of mesh verts in the same face, but that doesn’t seem to work. The order of UV verts is the same whether the UV face is flipped or not.

5 Replies
 eek

could you check if the face normal is in the right direction? ive not dont much with UV stuff… just thinking out loud here.

cheers,

Hey

The right direction for the UVWs est more a concept than a reality.
Nobody can be certain about what wants the user…

However, you can suppose that the user places his textures according to axes (the views).
So you find the normal of a group of faces (by experience i found that a UV cluster is more significant than each face)
Then you find the closest axis (the smallest angle between 2 vectors).
According to the direction of the normal, you can deduct the view.
And then the orientation which the user could want.
The last thing to do is to compare the orientation of the view and the U and V in the world space.

Well… it is not easy but that is what I have done for my script morphMap.

Hey Arketip, funny that you should reply to my question because it directly relates to MorphMap. I’ve been using it a lot lately, and what I’ve done is add an option to relax the UV’s at the end of the morphMap process. So I added a checkbox called “relax_osd” and then the line, “if relax_osd.checked do (objUnwrapMod.relaxByFaceAngle 1 0 1 false)” in the morphMapUVWLauncher function.

This works really great on geometry where the ends are angled, like a trapezoid, and you don’t want the UV’s to be perfectly aligned to the UV grid, but to match the geometry.

So the problem is that when UV’s are flipped, and you try to relax them, the first thing that happens is that they will start folding in on themselves to become unflipped. So in that sense flipped UV’s is a reality and not just a concept. Same thing happens with pelt mapping. But if you manually flip the UV’s before relaxing or pelting, the process is much quicker and more accurate. That’s why I want to be able to determine whether or not they’re flipped so that I can unflip them before relaxing.

You’re explanation of testing the UV against the view sounds promising, as well as Eek’s.
The idea of a UV face having a normal seems strange at first, but makes sense. But I don’t see anything in the reference on how to retrieve a UV face’s or cluster’s normal. The only thing I can find is “selectFaces(Cluster)ByNormal”. Any ideas on how to get the normal?

Oh, you too I had also added a similar function in a version which I have never published.

Yes it is true but the main goal of morphMap is to create UVs which matches a square. It is a typical task for low poly mapping, where each pixel is precious.
If I want mapping coordinates which follow the geometry, I use Unfold3D

Ok. Is it possible that will be in relation to the order of the vertex in polygons ?

It is ‘geometrical’ faces which have a normal vector but I use UVs to find the clusters first. You see ? I separate the UVs in severals elements and after I calculate a normal for the orientation of each element.
In fact It seems that your problem is not directy related with my first answer.
I thinks the problem could be in relation with mirored objects ? Or not ?
Or that happens also when UV themselves are flipped ?

if by ‘correct’ you mean that if a texture had an arrow from left to right, then it’s displayed going from left to right on the 3D mesh? …so, it’s not flipped

Determining this shoud be easy, that is what tangents and bi-normals are for. Their vectors define which way the U and V values increase.

Found this which may help: http://www.gamedev.net/community/forums/topic.asp?topic_id=347799

First off: How do you detect if a tangent/bitangent needs to be flipped? At http://www.terathon.com/code/tangent.html they show how to calculate the “handedness” of the vector, which is simply:

tangent[a].w = (Dot(Cross(n, t), tan2[a]) < 0.0F) ? -1.0F : 1.0F;