Rouben Rostamian wrote:
>
> Brian, re your message:
>
> > > When we transform the space with an arbitrary linear mapping
> > > P : R^3 > R^3, i.e., y = P x, normals to surfaces transform
> > > according to:
> > >
> > > N'(y) = P' N(x)
> > >
> > > where N(x) is the old normal, N'(y) is the new normal, and
> > >
> > > P' = inverse of transpose of P
> > >
> > > Does GL_NORMALIZE apply this formula correctly?
> >
> > Yes, that's what the OpenGL spec calls for.
> >
> > I believe the transpose is just a technicality of whether you
> > represent normals as row or column vectors in the expression.
>
> That's correct. With row vectors the transpose goes away.
> But then the order of multiplication reverses, that is, N
> muptiplies P^1 from the left.
>
> > It's been a long time since I worked through the arithmetic but
> > I seem to recall that transforming the normal by the transpose
> > of the modelview's inverse still isn't good enough to correctly
> > transform a surface normal when the modelview matrix has a non
> > uniform scale.
> >
> > That is, the transformed normal may not be exactly perpendicular to
> > the surface, as it was before the scale.
>
> There may be an angle (pun! hehe) within Mesa's implementation
> which I am not aware of. But the formula N' = P' N given above
> is easily derived  it's a matter of applying the chain rule of
> differentiation  and gives the /exact/ normal to the transformed
> surface for ay arbitrary linear transformation P.
Yup, you're right. I did the arithmetic for myself. I don't know
why I had it in my head that this didn't always work...
Brian
