danielepanozzo / cg-old

43 stars 16 forks source link

Inverse Transformation #38

Closed tomhsu1990 closed 8 years ago

tomhsu1990 commented 8 years ago

Hi, I have a question about inverse transformation. After doing the viewport, projection, and camera inverse transformation of a point on screen, how do we choose its z-value? It is a canonical value. In the 1st assignment, it is artificially set to be -1. But, now the camera is movable. I don't think it can be fixed to -1.

Thanks.

danielepanozzo commented 8 years ago

Hi Tom,

the part of the scene that is viewed by the camera will be mapped in the unit cube. What you want is to make sure that your ray will start "as close as possible" to the viewer, so it should be at z=1 in the unit cube. The inverse transformations will take care of mapping it in the right position in object coordinates.

It is always z=1 since you designed a graphic pipeline that always map the visible scene in the same unit cube, no matter the camera position/orientation.

tomhsu1990 commented 8 years ago

Thank you so much! Finally, solve the problem.