Viewing 3 reply threads
  • Author
    Posts
    • #5842 Score: 0
      condyy
      Participant
      2 pts

      单纯测试光源照射的结果,运行出来以后是全黑的。借鉴了论坛大佬的指正,还是没对。raycast代码见图1。有可能是因为什么?
      ps:前几次作业的结果是对的。triangle.hpp里面更新参数更新成了图2,我觉得应该没问题。

      顺便问一下,看了大佬们的描述也没懂的是,怎么调所谓的background使它出现颜色?

      Attachments:
      You must be logged in to view attached files.
    • #5845 Score: 0
      condyy
      Participant
      2 pts

      更新了判别光线是否穿过p的方法:

      Attachments:
      You must be logged in to view attached files.
    • #5848 Score: -1
      arc
      Participant
      5 pts

      1. 浮点运算是有误差的,直接等于的话大概率会判定为不穿过 p。
      2. 为什么要判定光线是否穿过一个法向量?

      This post has received 1 vote down.
    • #5854 Score: 0
      condyy
      Participant
      2 pts

      错了错了,刚刚那个的确有不少地方不对,但这次结果也有点奇怪:请见图,我怀疑是判断光线与p相交条件没选好,我写的是

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

        浮点数用相等真的好么? o(╯□╰)o

        • #5858 Score: 0
          condyy
          Participant
          2 pts

          我也觉得欠妥orz所以应该写成很长一段那种delta判断大小的形式吗orz有木有简易写法呢?

          • #5860 Score: 0
            tk100p
            Participant

            怎么就很长了,(点p-被光线照到的点).norm()求出两点之间的欧几里得距离不就行了吗,另外做判断的时候不要做的太过精确,不然还会出现和你发的图的情况

            • #5872 Score: 0
              condyy
              Participant
              2 pts

              我知道,我当时想的是另一种方法。但是精度规定到多少会比较好?0.1貌似会全黑,我是这么写的:

              Attachments:
              You must be logged in to view attached files.
Viewing 3 reply threads
  • You must be logged in to reply to this topic.