You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In the normal mapping part of lesson 6,when we calculate nl, why uniform_M is ProjectionModelView and uniform_MIT is (Projection*ModelView).invert_transpose(), I think it should be ModelView and ModelView.invert_transpose() . since Projection matrix is non-linear, doing calculation in clip space confusing me a lot, maybe we should just calculate it in world or view space?
the code responds is follow:
`
struct Shader : public IShader {
mat<2,3,float> varying_uv;
mat<4,4,float> uniform_M; // ProjectionModelView, why? I think it should be ModelView
mat<4,4,float> uniform_MIT; // (ProjectionModelView).invert_transpose(), why? I think it should be ModelView.invert_transpose()
virtual bool fragment(Vec3f bar, TGAColor &color) {
Vec2f uv = varying_uv*bar;
Vec3f n = proj<3>(uniform_MIT*embed<4>(model->normal(uv))).normalize();
Vec3f l = proj<3>(uniform_M *embed<4>(light_dir )).normalize();
float intensity = std::max(0.f, n*l);
color = model->diffuse(uv)*intensity;
return false;
}
`
My English is not so well, but I still want to thank you for your starting this project, I figure out many questions that have puzzled me a long time :)
The text was updated successfully, but these errors were encountered:
I think light vector nl can be calculated in both world or view space. But if we choose one space, then the normal vector must be calculated in the same space, the dot between the n and nl are the same for different spaces.
In the normal mapping part of lesson 6,when we calculate nl, why uniform_M is ProjectionModelView and uniform_MIT is (Projection*ModelView).invert_transpose(), I think it should be ModelView and ModelView.invert_transpose() . since Projection matrix is non-linear, doing calculation in clip space confusing me a lot, maybe we should just calculate it in world or view space?
the code responds is follow:
`
struct Shader : public IShader {
mat<2,3,float> varying_uv;
mat<4,4,float> uniform_M; // ProjectionModelView, why? I think it should be ModelView
mat<4,4,float> uniform_MIT; // (ProjectionModelView).invert_transpose(), why? I think it should be ModelView.invert_transpose()
}
`
My English is not so well, but I still want to thank you for your starting this project, I figure out many questions that have puzzled me a long time :)
The text was updated successfully, but these errors were encountered: