ssloy / tinyrenderer

A brief computer graphics / rendering course
https://github.com/ssloy/tinyrenderer/wiki
Other
20.73k stars 1.99k forks source link

Question about transformation of normal vectors in Lesson5 #123

Closed TravisRoad closed 1 year ago

TravisRoad commented 1 year ago

Instead of multiplying by the matrix itself, the proper method is to use the transpose of the matrix’s adjoint.

$(adj(M))^T$

I'm reading Real-Time Rendering 3rd, and I saw this line in the section 4.1.7 Normal Transform. It's different from the content of the lesson5.

There is a widely-known fact:

  • If we have a model and its normal vectors are given by the artist AND this model is transformed with an affine mapping,then normal vectors are to be transformed with a mapping, equal to the transposition of the inverse matrix of the original mapping matrix

Could u explain the difference between the above and yours? Thanks in advance.

ssloy commented 1 year ago

Adjugate and inverse matrices are the same up to a multiplication by a determinant. Which, in its turn, does no action in homogeneous coordinates, so it is really the same thing in our settings.

TravisRoad commented 1 year ago

Thank you ;D.