Lighting algorithm


Looking here

I can see that to get the light direction you need to use the formula

“light direction = light position – vertex position”

The text following this says

“Before we can compute this vector we must apply the View Model matrix (m_viewModel in the shader) to the vertex position.”

The vertex position would not be calculated from the viewModel matrix it would be calculated from the model matrix only.

This tutorial uses the model matrix as I would expect but then has other logic to work out the spec light!Lighting/Basic-Lighting

Can someone say if there is a typo in the first formula or if there is something basic that I haven;t understood which would explain it and also what the difference is between the two tutorials?

Any help would be much appreciated.

(Also posted the same question on