Home Forums GAMES在线课程(现代计算机图形学入门)讨论区 关于bump和displacement shader里h(u,v)和position p的理解

Viewing 2 reply threads
  • Author
    Posts
    • #3818 Score: 1
      cmc233
      Participant
      6 pts

      bump和displacement shader里h(u,v)是指payload.texture->getColor(payload.tex_coords(0), payload.tex_coords(1))(0)吗?由于color是个三维向量,所以这里我直接取了第一维的值,bump得到了和作业说明里一样的图

      displacement里的position p是指payload.view_pos吗?这里试了好多,得到的图都和作业说明不一样orz

      This post has received 1 vote up.
      Attachments:
      You must be logged in to view attached files.
    • #3821 Score: 0
      助教
      Keymaster
      14 pts

      h(u,v) 指的就是 payload.texture->getColor(payload.tex_coords(0), payload.tex_coords(1))(0),既可以取第一维也可以取 norm.

      displacement 的 p 指的是 point, 也就是 payload.view_pos.

      我猜测你将取第一维改成 norm 就可以解决问题,不过我认为你的结果已经是可以接受的。

      • This reply was modified 4 years, 8 months ago by 助教.
      • #3824 Score: 0
        cmc233
        Participant
        6 pts

        谢谢助教,我把所有的改成norm,并且把Position p = p + kh * n * h(u,v)改成了Position p = p + kn * n * h(u,v)后得到了和作业说明里一模一样的图。(这里你代码里的注释好像笔误了,如果不把kh改成kn,结果就是一团灰噗噗的orz)

    • #3826 Score: 1
      助教
      Keymaster
      14 pts

      嗯,补充更正:将 main.cpp 187行的注释修改为 // Position p = p + kn * n * h(u,v)

      This post has received 1 vote up.
      • #3950 Score: 0
        o_o_o_o_o
        Participant
        -1 pt

        感谢,我也是发现了这里有个笔误

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