NVlabs / nvdiffmodeling

Differentiable rasterization applied to 3D model simplification tasks
Other
455 stars 30 forks source link

Some doubts about vertex coordinate transformation #34

Closed zouxiaohang closed 1 year ago

zouxiaohang commented 1 year ago

image

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.

JHnvidia commented 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.

zouxiaohang commented 1 year ago

邹晓航已经收到了你发送的邮件~~

zouxiaohang commented 1 year ago

@JHnvidia Thanks for your detailed answer