Home Forums GAMES在线课程(现代计算机图形学入门)讨论区 关于作业 2 深度测试结果不显示的问题

  • This topic has 6 replies, 4 voices, and was last updated 4 years ago by Bear.
Viewing 3 reply threads
  • Author
    Posts
    • #3391 Score: 0
      Bear
      Participant
      -11 pt

      我得到的结果如图所示。首先由于框架用的是左手系我把投影矩阵已经改成了左手系;其次根据文档所说 depth_buf 初始化为 inf, 距离视点越远 z 越大,判断条件便为当 z_interpolated 小于 depth_buf 中值时进行 update 和 set_pixel。结果就是这样了。请问有人知道是怎么回事吗?

      • This topic was modified 4 years ago by Bear.
      Attachments:
      You must be logged in to view attached files.
    • #3395 Score: 0
      Angus
      Participant
      23 pts

      插个嘴,请问下左手系和右手系的投影矩阵具体区别在哪一步?

      • #3396 Score: 0
        Bear
        Participant
        -11 pt

        左手系的透视投影矩阵如图。把所有取绝对值的地方不取绝对值就是右手系的透视投影矩阵了

        Attachments:
        You must be logged in to view attached files.
    • #3431 Score: 0
      sublimation
      Participant
      3 pts

      我觉得这个错误看起来像是判断像素是否在三角形内部的函数出了问题?

      • #3451 Score: 0
        Bear
        Participant
        -11 pt

        改了 buffer 的索引方式解决啦。感谢回答

    • #3432 Score: 0
      TuOne_Chan
      Participant
      -1 pt

      这个错误是你在Depth Buffer的索引有问题,像素和depth buffer的索引值不一致导致的
      代码中depth buffer是个vector<float>的数据结构,depth buffer存储(x,y)像素处的z值对应的是个二维数组,你需要计算出(x,y)像素和ector<float>的数据结构的一一对应关系,具体你可以参考一下set_pixcel(point,color)函数中的frame buffer的值是如何一一对应的。

      • #3450 Score: 0
        Bear
        Participant
        -11 pt

        感谢,解决啦。我原先是用得 buffer 初始化时的索引方式

Viewing 3 reply threads
  • You must be logged in to reply to this topic.