xem / W

A micro WebGL2 framework with a ton of features
https://xem.github.io/W
330 stars 22 forks source link

Don't transpose the inverse-model matrix on the CPU #1

Closed stasm closed 2 years ago

stasm commented 2 years ago

You can avoid having to transpose the inverse of the model matrix by multiplying the normal from the left of the matrix.

From https://en.wikibooks.org/wiki/GLSL_Programming/Vector_and_Matrix_Operations:

If a vector is multiplied to a matrix from the left, the result corresponds to multiplying a row vector from the left to the matrix. This corresponds to multiplying a column vector to the transposed matrix from the right.

xem commented 2 years ago

woah