Closed zouxiaohang closed 1 year ago
Hi @zouxiaohang,
The rendering code is a bit sloppy. The main assumption is that object space = world space. I.e. mtx_in
assumes view*projection
rather than model*view*projection
.
This doesn't affect a lot in the code. You can consider it to be object space rather than world space if you want, but in that case the light_pos
is also given in object space. It's not a big deal as the code is written now, but if you had multiple objects with different transforms light_pos
is constant in world space, but not in object space, so shading is typically done in world space.
邹晓航已经收到了你发送的邮件~~
@JHnvidia Thanks for your detailed answer
I have a question that mesh.v_pos is in object space, but why after the above interpolate code the result gb_pos will be in world space?Shouldn't gb_pos still belong to the object space?
Thank you for your answer.