Home Forums GAMES在线课程(现代计算机图形学入门)讨论区 作业三phong光照模型计算坐标系问题

Viewing 4 reply threads
  • Author
    Posts
    • #4015 Score: 1
      Shouheng Li
      Participant
      1 pt

      通过代码框架的阅读,发现在读取三角形时,view_pos 变换到了View相机坐标系(view * model * t->v[0]),法线也是如此(Eigen::Matrix4f inv_trans = (view * model).inverse().transpose();
      Eigen::Vector4f n[] = {
      inv_trans * to_vec4(t->normal[0], 0.0f),

      传入shader中payload.view_pos 值即为插值之后的view_pos,那么在进行phong模型计算时,猜测给出的光源方向、观察视线方向也都为相机坐标系下的值。

      This post has received 1 vote up.
    • #6461 Score: 0
      dzy
      Participant

      感觉是这样

    • #6607 Score: 0
      Dan
      Participant

      感觉有点问题,相机坐标系下计算观察方向应该用坐标原点(0,0,0),不应该用eye_pos(0,0,10)吧

    • #6758 Score: 0
      不要熬夜
      Participant

      嗯,同感,我也是这么觉得的

    • #7926 Score: 0
      waqia
      Participant
      2 pts

      请问法线为啥要乘以(view * model).inverse().transpose(),为啥要.inverse().transpose()

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