Home Forums GAMES在线课程(现代计算机图形学入门)讨论区 ViewportTransform中关于z轴的变化

Viewing 1 reply thread
  • Author
    Posts
    • #3579 Score: 0
      feixiaku
      Participant

      在做viewport transform的时候,理解x/y轴从NDC空间[-1, 1]变化到屏幕空间的[0,width],[0, height],但是不明白z轴的变换时怎么得来的,希望可以解惑!

      • This topic was modified 4 years, 8 months ago by feixiaku.
      Attachments:
      You must be logged in to view attached files.
    • #3635 Score: 1
      Shi YuChen(助教)
      Keymaster
      4 pts

      这里只是单纯的将z的值平移加放缩到正数。另外对于本次的作业,如果是按闫老师的推到过程得到的透视投影矩阵(右手系),应将此句改为vert.z()=-vert.z()*f1+f2,或者初始化depth-buffer时初始化为负无穷。

      This post has received 1 vote up.
      • #6032 Score: 0
        chenzhekl
        Participant

        我有个问题,f1 和 f2 的值是如何选取的呢?因为做完 MVP 之后 z 的范围是 [-1, 1],似乎没有必要做这么大的平移和缩放。

        • This reply was modified 4 years, 7 months ago by chenzhekl.
Viewing 1 reply thread
  • You must be logged in to reply to this topic.