Jump to content

  • Log In with Google      Sign In   
  • Create Account


Problem computing tangent on a vertex (with changing texture direction)


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
3 replies to this topic

#1 GFalcon   Members   -  Reputation: 366

Like
0Likes
Like

Posted 20 June 2012 - 02:55 AM

Hi,

First here is a picture to present my problem :

Tangent.png

I have two triangles (A, B, D) and (B, C, D) with the following texture coordinates (red arrows illustrate the texture "direction") :

A = (0, 0)
B = (1, 0)
C = (0, 0)
D = (1, 1)

I am calculating the tangent vector for these four vertices, for which i find (W used to store information about handedness) :

Tangent at A = (1, 0, 0, 1)
Tangent at B = (0, -1, 0, -1)
Tangent at C = (-1, 0, 0, -1)
Tangent at D = (0, -1, 0, -1)

(I am using the method described at http://www.terathon....de/tangent.html)

My problem is for B and D vertices. I understand why I found these tangent vectors (because of the changing direction of the texture at these vertices my tangents), but how can I resolve this issue. Do I have to "split" B vertex into B1 and B2 (and D vertex also) so that they can each have a correct tangent vector ? Or is there another solution (maybe I am missing something here ?).

(The objective is to do normal mapping, I have it working quite well but problems appear on those vertices where texture is changing direction. I am using Sponza Atrium model from CryTek).

Attached Thumbnails

  • Tangent.png

--
GFalcon
0x5f3759df

Sponsor:

#2 Ashaman73   Crossbones+   -  Reputation: 7122

Like
2Likes
Like

Posted 20 June 2012 - 03:17 AM

Yes, mirrored textures are a common problem and some engines even don't handle this case (udk3?). Best to split your vertices along the mirrored edge, you will most likely already split vertices when you don't share the same uv or encounter hard edges.

#3 GFalcon   Members   -  Reputation: 366

Like
0Likes
Like

Posted 20 June 2012 - 03:24 AM

Thanks for the reply. That is what I thought ... well ... time to review my mesh reader then, to split those vertices ;)

By the way thanks for the link in your signature (on transparency in deferred shader), I'll soon need it I think :)
--
GFalcon
0x5f3759df

#4 MJP   Moderators   -  Reputation: 10917

Like
1Likes
Like

Posted 20 June 2012 - 12:50 PM

Yeah what our engine will do is generate tangents on the expanded vertices (3 unique vertices per triangle), then try to merge them when it's finished. In most cases they will merge fine and you'll end up with shared verts, but in a case like this one where the tangents will point away from each other we'll end up leaving them unique which essentially splits the vertex.




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS