In Lesson 6, matrix used to transform normal vector in Darboux frame may be wrong.
Closed this issue · 1 comments
I learned that we need to use normal vector in view space to compute the illumination whereas you computed it in clip space. I think passing (Projection*ModelView).inverse_transpose may be wrong. Instead we should pass ModelView.inverse_transpose to compute the transformed normal vector?
My opinion:
Shader shader(ModelView, (Projection*ModelView).invert_transpose(), M*(Viewport*Projection*ModelView).invert());to
Shader shader(ModelView, (ModelView).invert_transpose(), M*(Viewport*Projection*ModelView).invert());In opengl(see ref), Normal Vector Transformation just transforms a normal vector from object space to eye space.
In my opinion, just MODELVIEW matrix affects the normal vector transformation, not including PROJECTION, VIEWPORT matrix. But in lesson6, it uses (Projection*ModelView).invert_transpose() to get normal transformation to calculate varying_nrm, but not use ModelView.invert_transpose().
Do you have any idea? I don't know why.