## RE: [Algorithms] Normal space transforms for nonlinear deformatio ns

 RE: [Algorithms] Normal space transforms for nonlinear deformatio ns From: Guillaume Provost - 2002-11-26 14:37:48 ```Ron, This is actually all the help I needed. I'm familiar with Jacobian matrices and I think I can take it from here. Thanks alot! Guillaume. -----Original Message----- From: gdalgorithms-list-admin@... [mailto:gdalgorithms-list-admin@...]On Behalf Of Ron Levine Sent: Tuesday, November 26, 2002 3:42 AM To: gdalgorithms-list@... Subject: Re: [Algorithms] Normal space transforms for nonlinear deformatio ns Guillaume Provost wrote: > > Thought I would have a neat problem for you math freaks. > We have >been deforming meshes in hardware using single axis aligned quadratic >7-point blend >deforms. (You basically take one of the axis and you transform it through a >quadratic). > >I have until now approximated the normal transforms using a standard >rigid body matrix that best averaged this transform, but I'm now facing some >highly >glossy surfaces, and the defects in the shading are showing up. Do any of >you have source >materials/ideas on how I could better approximate the correct normal >transforms in such a case? > >The basic math : > >The Power vector: [x y z 1 xx xy xz] // Quadratic deform along the x axis. > >// where rx ry rz tx is your standard rigid deform (these are vectors) >// and rxx rxy rxz are the quadratic blend factors along the x axis >7 point blend: [rx ry rz tx rxx rxy rxz] > >transformed point = Power vector * (7 Point blend) > >// Currently : >normal = Inverse_Transpose(rx ry rz tx) > > Guillaume. > OK I haven't had the time to figure out your non-linear mapping specification, except to see that it is an analytic non-linear, non-affine (quadratic?) mapping of R^3 to itself. But I will try to steer you in the direction of the theory that will help you, which generally comes under the rubrique "Advanced Calculus" (taught in the second year in US universities). The normal you want to the image (transformed) surface is (or is supposed to represent) the normal to its tangent plane. So you have to figure out what your mapping does to the tangent plane at any point of the source surface (however that may be defined). The tangent plane at any point is spanned by the (vector ) partial derivatives of the vector function of a parametric representation of the surface. So it should not be a surprise that the correct mapping of the tangent plane must involve the the partial derivatives of the mapping you have defined. To make a long story short, the transformation matrix you need is called 'the Jacobian matrix' of your defined non-linear mapping. IF we symbolise your mapping as vector function written out in components (x',y',z') = (x'(x,y,z), y'(x,y,z), (z'(x,y,z)) where (x,y,z) is a general point of the domain of your mapping and (x',y',z') is its image under the mapping, (showing that each of (x',y',z') is a function of (x, y, z)), THEN the Jacobian of the mapping is the 3x3 matrix of all possible partial derivatives of each of (x',y',z') with respect to each of (x, y, z). That is the neatest way I can think of to define the Jacobian in ASCII, (and my distaste for casting math notation into ASCII is one reason I'm not going into more detail) The Jacobian of a linear mapping is just its matrix, and so is constant. The Jacobian of an affine mapping is just the matrix of its linear part. If one understood exactly the definition of your quadratic mapping, computing its Jacobian is a simple exercise in differential calculus of several variables. It will not be constant, but a function of (x,y,z) Now you cannot just apply the Jacobian to the source normal vector to get the image normal vector, because the Jacobian is not likely to be orthogonal and so it will not necessarily preserve cross products. But it will map tangent plane to tangent plane. So, in principle, for any source normal vector at a particular point, you have to get a couple of independent vectors orthogonal to it, apply the Jacobian to them, take the cross product of the result, and normalize. That's all the time I have, maybe someone else will pick up the ball and fill in holes I'm leaving. At least, I hope that's push in a direction you might find rewarding. ------------------------------------------------------- This SF.net email is sponsored by: Get the new Palm Tungsten T handheld. Power & Color in a compact size! http://ads.sourceforge.net/cgi-bin/redirect.pl?palm0002en _______________________________________________ GDAlgorithms-list mailing list GDAlgorithms-list@... https://lists.sourceforge.net/lists/listinfo/gdalgorithms-list Archives: http://sourceforge.net/mailarchive/forum.php?forum_id=6188 ```

 RE: [Algorithms] Normal space transforms for nonlinear deformatio ns From: Guillaume Provost - 2002-11-26 14:37:48 ```Ron, This is actually all the help I needed. I'm familiar with Jacobian matrices and I think I can take it from here. Thanks alot! Guillaume. -----Original Message----- From: gdalgorithms-list-admin@... [mailto:gdalgorithms-list-admin@...]On Behalf Of Ron Levine Sent: Tuesday, November 26, 2002 3:42 AM To: gdalgorithms-list@... Subject: Re: [Algorithms] Normal space transforms for nonlinear deformatio ns Guillaume Provost wrote: > > Thought I would have a neat problem for you math freaks. > We have >been deforming meshes in hardware using single axis aligned quadratic >7-point blend >deforms. (You basically take one of the axis and you transform it through a >quadratic). > >I have until now approximated the normal transforms using a standard >rigid body matrix that best averaged this transform, but I'm now facing some >highly >glossy surfaces, and the defects in the shading are showing up. Do any of >you have source >materials/ideas on how I could better approximate the correct normal >transforms in such a case? > >The basic math : > >The Power vector: [x y z 1 xx xy xz] // Quadratic deform along the x axis. > >// where rx ry rz tx is your standard rigid deform (these are vectors) >// and rxx rxy rxz are the quadratic blend factors along the x axis >7 point blend: [rx ry rz tx rxx rxy rxz] > >transformed point = Power vector * (7 Point blend) > >// Currently : >normal = Inverse_Transpose(rx ry rz tx) > > Guillaume. > OK I haven't had the time to figure out your non-linear mapping specification, except to see that it is an analytic non-linear, non-affine (quadratic?) mapping of R^3 to itself. But I will try to steer you in the direction of the theory that will help you, which generally comes under the rubrique "Advanced Calculus" (taught in the second year in US universities). The normal you want to the image (transformed) surface is (or is supposed to represent) the normal to its tangent plane. So you have to figure out what your mapping does to the tangent plane at any point of the source surface (however that may be defined). The tangent plane at any point is spanned by the (vector ) partial derivatives of the vector function of a parametric representation of the surface. So it should not be a surprise that the correct mapping of the tangent plane must involve the the partial derivatives of the mapping you have defined. To make a long story short, the transformation matrix you need is called 'the Jacobian matrix' of your defined non-linear mapping. IF we symbolise your mapping as vector function written out in components (x',y',z') = (x'(x,y,z), y'(x,y,z), (z'(x,y,z)) where (x,y,z) is a general point of the domain of your mapping and (x',y',z') is its image under the mapping, (showing that each of (x',y',z') is a function of (x, y, z)), THEN the Jacobian of the mapping is the 3x3 matrix of all possible partial derivatives of each of (x',y',z') with respect to each of (x, y, z). That is the neatest way I can think of to define the Jacobian in ASCII, (and my distaste for casting math notation into ASCII is one reason I'm not going into more detail) The Jacobian of a linear mapping is just its matrix, and so is constant. The Jacobian of an affine mapping is just the matrix of its linear part. If one understood exactly the definition of your quadratic mapping, computing its Jacobian is a simple exercise in differential calculus of several variables. It will not be constant, but a function of (x,y,z) Now you cannot just apply the Jacobian to the source normal vector to get the image normal vector, because the Jacobian is not likely to be orthogonal and so it will not necessarily preserve cross products. But it will map tangent plane to tangent plane. So, in principle, for any source normal vector at a particular point, you have to get a couple of independent vectors orthogonal to it, apply the Jacobian to them, take the cross product of the result, and normalize. That's all the time I have, maybe someone else will pick up the ball and fill in holes I'm leaving. At least, I hope that's push in a direction you might find rewarding. ------------------------------------------------------- This SF.net email is sponsored by: Get the new Palm Tungsten T handheld. Power & Color in a compact size! http://ads.sourceforge.net/cgi-bin/redirect.pl?palm0002en _______________________________________________ GDAlgorithms-list mailing list GDAlgorithms-list@... https://lists.sourceforge.net/lists/listinfo/gdalgorithms-list Archives: http://sourceforge.net/mailarchive/forum.php?forum_id=6188 ```