Viewing 3 reply threads
  • Author
    Posts
    • #5217 Score: 0
      water
      Participant
      2 pts

      投影的代码拷到PA3,就只能看到奶牛的背面,去掉负号,改成
      p2o(2, 3) = n * f;
      就成正面了,想不通

      This post has received 1 vote up and 1 vote down.
      Attachments:
      You must be logged in to view attached files.
    • #5222 Score: 1
      water
      Participant
      2 pts

      我代码贴错了,应是下面这个,不过效果都一样。
      我做的时候始终按照课件的,朝向-z轴,公式也是代入。

      想不通为什么会多一个z轴的对称变换,哭死

      This post has received 1 vote up and 1 vote down.
      Attachments:
      You must be logged in to view attached files.
    • #5226 Score: -1
      刘道明
      Participant

      缩放应该是2/(f-n)

      This post has received 1 vote down.
      • #5227 Score: -1
        water
        Participant
        2 pts

        感谢回应,但我理解这里的z轴的缩放系数应该是个正数的,而n > f的。应该不是这个问题吧

        This post has received 1 vote down.
        • #5230 Score: 1
          刘道明
          Participant

          [n,f]->[-1,1],坐标系问题

          This post has received 1 vote up.
    • #5235 Score: 2
      water
      Participant
      2 pts

      好像想明白了,投影变换后,-z的方向看过去,图像其实还是奶牛的正面,但是代码里渲染像素时,x扩展到图像的width,y扩展到图像的height,而且z是vert.z() * f1 + f2,也是正的,差值算出的zp也在这个范围内,所以虽然-z轴看奶牛依然是正面的,但是判断远近是zp,离远点越小越近,所以渲染成了奶牛的背面。

      要是渲染像素时,z拓展到负的区间,再对应改z-buf,此时是朝-z轴看了,那应该就是正面了

      This post has received 1 vote up.
Viewing 3 reply threads
  • You must be logged in to reply to this topic.