Viewing 3 reply threads
  • Author
    Posts
    • #3833 Score: 0
      wffancy
      Participant
      1 pt

      设置完phong_fragment_shader后,渲染的结果并没有文档中模型中光滑的效果(如附图),感觉缺少了镜面光项,已经把q的值调大为150了,但是并没有什么作用,不知道是何处有错。
      texture_fragment_shader是建立在phong_fragment_shader上写的,会报段错误无法正常运行,shader中按要求添加了获取插值后纹理坐标对应的纹理值,以及shading的光照项,找了半天也没找到出错的地方,求教!

    • #3834 Score: 0
      wffancy
      Participant
      1 pt

      phong效果如图

      Attachments:
      You must be logged in to view attached files.
    • #3836 Score: 0
      助教
      Keymaster
      14 pts

      请直接将你现在实现的部分拷贝到更正后的框架中,再次编译运行。框架不止更正 p=150 这一个问题。

      • #3849 Score: 0
        wffancy
        Participant
        1 pt

        助教你好,phong着色器没问题了,可是我想添加texture时还是会报Segmentation fault: 11的错误。。我获取纹理值的方式是:
        return_color = payload.texture->getColor(payload.tex_coords(0), payload.tex_coords(1));
        其余地方应该是没有修改了,还麻烦给予指点

        • #3850 Score: 0
          助教
          Keymaster
          14 pts

          取值方法是正确的,请把完整的代码打包发给我的邮箱 lgz17@mails.tsinghua.edu.cn , 我将详细看看。

          • #3851 Score: 0
            wffancy
            Participant
            1 pt

            已发,麻烦了!

            • #3855 Score: 1
              助教
              Keymaster
              14 pts

              你程序崩溃是因为 get_projection_matrix 中没有将 eye_fov 由角度制化为弧度制,抱歉由于作业一批改进度较慢而无法及时让你们更正这一问题。

              This post has received 1 vote up.
              • #3863 Score: 0
                wffancy
                Participant
                1 pt

                明白了,十分感谢!

            • #3856 Score: 0
              助教
              Keymaster
              14 pts

              由于没化弧度,部分三角函数计算出错导致 tex_coords 变成 nan,进而引发崩溃。

        • #3852 Score: 0
          sublimation
          Participant
          3 pts

          这个我也遇到了,我输出了插值后的纹理坐标,发现超出了[0,1],可能是因为精度误差。解决方法是夹到[0,1]内就行了。

          • This reply was modified 4 years, 1 month ago by sublimation. Reason: typo
          • #3864 Score: 0
            wffancy
            Participant
            1 pt

            嗯嗯,的确是纹理坐标越界了

    • #3844 Score: 0
      wffancy
      Participant
      1 pt

      好的,抱歉未留意到框架更新。问题已解决

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