## RE: [Algorithms] Skinning + Tangent vectors

 RE: [Algorithms] Skinning + Tangent vectors From: John Harries - 2002-02-28 14:01:41 Attachments: Message as HTML ```Yes, you need to retransform. Your tangent space is defined by the vectors S, T and SxT. (Where SxT is cross_product(S, T)). Note that SxT is also the vertex normal. S and T should be derived from the texture coordinate derivatives only once. Since S, T, SxT forms an ortho-normal basis you can transform S and your normal and then perform a cross-product to calculate T. Easy in a vertex shader. Does this help? John -----Original Message----- From: gdalgorithms-list-admin@... [mailto:gdalgorithms-list-admin@...]On Behalf Of Adam Moravanszky Sent: Thursday, February 28, 2002 7:33 AM To: Algorithms List Subject: [Algorithms] Skinning + Tangent vectors Hello. I am completely new to mesh deformation with bones, so this may sound naive: If I have a mesh which needs tangent vectors per vertex (for bump mapping, for example) , should these be animated along with the vertex positions and the normals, or can that be avoided? Regenerating them from scratch every frame from the unchanging texture coordinates is too expensive??! P.S: I am doing skinning in software with Cal3D so this need not be hardware friendly. What I would like to avoid is rewriting my shaders to light in any other space than standard tangent space. P.P.S: I saw in the archives that this is supposedly covered in the book "Mathematics for 3D Game Programming & Computer Graphics", but alas, I don't have it. Thanks, Adam ```

 [Algorithms] Skinning + Tangent vectors From: Adam Moravanszky - 2002-02-28 13:34:28 Attachments: Message as HTML ```Hello. I am completely new to mesh deformation with bones, so this may sound = naive: If I have a mesh which needs tangent vectors per vertex (for bump = mapping, for example) , should these be animated along with the vertex positions and the = normals, or can that be avoided? Regenerating them from scratch every frame from the unchanging texture = coordinates is too expensive??! P.S: I am doing skinning in software with Cal3D so this need not be = hardware friendly. What I would like to avoid is rewriting my shaders = to light in any other space than standard tangent space. P.P.S: I saw in the archives that this is supposedly covered in the book = "Mathematics for 3D Game Programming & Computer Graphics", but alas, I = don't have it. Thanks, Adam ```
 RE: [Algorithms] Skinning + Tangent vectors From: John Harries - 2002-02-28 14:01:41 Attachments: Message as HTML ```Yes, you need to retransform. Your tangent space is defined by the vectors S, T and SxT. (Where SxT is cross_product(S, T)). Note that SxT is also the vertex normal. S and T should be derived from the texture coordinate derivatives only once. Since S, T, SxT forms an ortho-normal basis you can transform S and your normal and then perform a cross-product to calculate T. Easy in a vertex shader. Does this help? John -----Original Message----- From: gdalgorithms-list-admin@... [mailto:gdalgorithms-list-admin@...]On Behalf Of Adam Moravanszky Sent: Thursday, February 28, 2002 7:33 AM To: Algorithms List Subject: [Algorithms] Skinning + Tangent vectors Hello. I am completely new to mesh deformation with bones, so this may sound naive: If I have a mesh which needs tangent vectors per vertex (for bump mapping, for example) , should these be animated along with the vertex positions and the normals, or can that be avoided? Regenerating them from scratch every frame from the unchanging texture coordinates is too expensive??! P.S: I am doing skinning in software with Cal3D so this need not be hardware friendly. What I would like to avoid is rewriting my shaders to light in any other space than standard tangent space. P.P.S: I saw in the archives that this is supposedly covered in the book "Mathematics for 3D Game Programming & Computer Graphics", but alas, I don't have it. Thanks, Adam ```
 Re: [Algorithms] Skinning + Tangent vectors From: Adam Moravanszky - 2002-02-28 14:54:51 ```Yes, this does help, as did Tom's reply. I don't agree with S,T and SxT forming an orthonormal basis, though. This is only the case when we have 'perfect' texture mapping coordinates with no distortion -- not very likely. I believe S and T have to follow the texture mapping directions, even if the UV directions are not orthogonal. On the other hand, S cross T is usually (close to) the normal, so the optimization in my vertex shaders is that I leave the normal away, and compute that on the fly as SIGNBIT * (S x T) --Adam ----- Original Message ----- From: John Harries To: Adam Moravanszky ; Algorithms List Sent: Thursday, February 28, 2002 3:01 PM Subject: RE: [Algorithms] Skinning + Tangent vectors Yes, you need to retransform. Your tangent space is defined by the vectors S, T and SxT. (Where SxT is cross_product(S, T)). Note that SxT is also the vertex normal. S and T should be derived from the texture coordinate derivatives only once. Since S, T, SxT forms an ortho-normal basis you can transform S and your normal and then perform a cross-product to calculate T. Easy in a vertex shader. Does this help? John ```
 RE: [Algorithms] Skinning + Tangent vectors From: John Harries - 2002-02-28 14:58:48 ```:-) That should have read: Since S, T, SxT IDEALLY form an ortho-normal basis you can transform S and your normal and then perform a cross-product to calculate T. Easy in a vertex shader. John > -----Original Message----- > From: Adam Moravanszky [mailto:amoravanszky@...] > Sent: Thursday, February 28, 2002 8:53 AM > To: John Harries; Algorithms List > Subject: Re: [Algorithms] Skinning + Tangent vectors > > > Yes, this does help, as did Tom's reply. > > I don't agree with S,T and SxT forming an orthonormal basis, though. This > is only the case when we have 'perfect' texture mapping > coordinates with no > distortion -- not very likely. I believe S and T have to follow > the texture > mapping directions, even if the UV directions are not orthogonal. On the > other hand, S cross T is usually (close to) the normal, so the > optimization > in my vertex shaders is that I leave the normal away, and compute that on > the fly as > SIGNBIT * (S x T) > > --Adam > ----- Original Message ----- > From: John Harries > To: Adam Moravanszky ; Algorithms List > Sent: Thursday, February 28, 2002 3:01 PM > Subject: RE: [Algorithms] Skinning + Tangent vectors > > > Yes, you need to retransform. > > Your tangent space is defined by the vectors S, T and SxT. (Where SxT is > cross_product(S, T)). > > Note that SxT is also the vertex normal. > > S and T should be derived from the texture coordinate derivatives > only once. > > Since S, T, SxT forms an ortho-normal basis you can transform S and your > normal and then perform a cross-product to calculate T. Easy in a vertex > shader. > > Does this help? > > John > > ```
 RE: [Algorithms] Skinning + Tangent vectors From: Kaspar Daugaard - 2002-02-28 14:09:15 Attachments: Message as HTML ```Animate the tangent vectors. Youll probably find its a good idea to blend the bone matrices instead of the transformed vectors as an optimisation. So just use the 3x3 part of the blended matrix to transform the tangents, same way as the normal. Best regards, Kaspar Daugaard http://www.bigbluebox.com -----Original Message----- From: gdalgorithms-list-admin@... [mailto:gdalgorithms-list-admin@...]On Behalf Of Adam Moravanszky Sent: 28 February 2002 13:33 To: Algorithms List Subject: [Algorithms] Skinning + Tangent vectors Hello. I am completely new to mesh deformation with bones, so this may sound naive: If I have a mesh which needs tangent vectors per vertex (for bump mapping, for example) , should these be animated along with the vertex positions and the normals, or can that be avoided? Regenerating them from scratch every frame from the unchanging texture coordinates is too expensive??! P.S: I am doing skinning in software with Cal3D so this need not be hardware friendly. What I would like to avoid is rewriting my shaders to light in any other space than standard tangent space. P.P.S: I saw in the archives that this is supposedly covered in the book "Mathematics for 3D Game Programming & Computer Graphics", but alas, I don't have it. Thanks, Adam ```