Viewing 2 reply threads
  • Author
    Posts
    • #4056 Score: 0
      chihiro
      Participant

      请问有人遇见这种高光位置不对的情况吗

      Attachments:
      You must be logged in to view attached files.
    • #4059 Score: 0
      安安
      Participant
      -1 pt

      我的也不对,只有头上有高光

      Attachments:
      You must be logged in to view attached files.
      • #4062 Score: 0
        戴皓天
        Participant
        9 pts

        因为光源有两个,所以他们的光照计算结果要叠加,应该是result_color+=ambient+diffuse+specular,而不是用赋值,用赋值的话对第二个光源的计算结果会把第一个的覆盖掉

        • This reply was modified 4 years, 1 month ago by 戴皓天.
        • #4069 Score: 0
          安安
          Participant
          -1 pt

          谢谢,改了以后就可以了

        • #4074 Score: 0
          sublimation
          Participant
          3 pts

          请教一下大佬,为什么环境光要加两次?

          • #4162 Score: 0
            戴皓天
            Participant
            9 pts

            不好意思之前没考虑这个问题,查了点资料,你说的是对的。对于多光源,ambient确实不应该重复叠加,谢谢提醒!

            • #4188 Score: 0
              sublimation
              Participant
              3 pts

              多谢回复,因为看到很多个po代码的同学都这样做的,助教也没有说有错,所以就问了一下。

    • #4064 Score: 0
      戴皓天
      Participant
      9 pts

      你这个应该是第一个光源出来了但第二个光源没出来,按框架light的顺序,第二个光源是从小牛侧边打过来的,第一个光源是打在脸上,你看下对最终颜色的赋值是不是搞错了

      • #4070 Score: 0
        chihiro
        Participant

        谢谢,我好了(v单位化的时候少了个括号orz

      • #4083 Score: 0
        MXang
        Participant

        能不能帮忙看一下我这是什么问题…

        Attachments:
        You must be logged in to view attached files.
        • #4116 Score: 0
          aybny
          Participant

          我终于发现这是投影矩阵的问题,phong的代码并没有错。
          我抄了https://github.com/shajieChen/ComputerGraphicReview/blob/master/%E7%BA%B9%E7%90%86%E4%B8%8E%E5%85%89%E7%85%A7/main.cpp#L71-L78″的代码发现就行了

          • #4119 Score: 0
            MXang
            Participant

            我也找到了,我竟然是 rasterize_triangle 里面有个地方写错了。。。
            十分感谢

            • #4448 Score: 0
              cjbhz
              Participant

              hi,你说的rasterize_triangle的错误是哪里错了呢,我得到的结果和你一样,但是我还没有找到错误的地方

              • #4482 Score: 1
                YY
                Participant
                1 pt

                可能因为在高光计算过程中的半程向量算错了,半程向量本来是求向量(方向)v和l的角平分线,如果v和l不等长,用公式h=(v+l)/|v+l|计算得到的h不是角平分线方向,而是平行四边形对角线方向,这样高光位置会有偏移,所以v和l必须都单位化。

                This post has received 1 vote up.
                • #4483 Score: 0
                  YY
                  Participant
                  1 pt

                  也有可能是rasterize_triangle里面,插值计算法向量的时候没有单位化。

          • #4185 Score: 0
            sQ
            Participant
            1 pt

            都不顺手点个star么 😏

          • #4452 Score: 1
            Angus
            Participant
            23 pts

            这是谁的repo,老师不是在第一节课拜托大家不要公开实验代码吗😥

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