Viewing 4 reply threads
  • Author
    Posts
    • #4789 Score: 0
      zsw
      Participant
      -2 pt

      请问我求生成光线的方式是对的吗? 为什么 渲染出来的还是一片蓝= =
      x = i-scene.width/2;
      y = j-scene.height/2;
      x*=scale*imageAspectRatio;
      y*=scale;

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

      和我一样 我还加了一个0.5的像素中心 也是一片蓝

    • #4795 Score: 0
      zhishao
      Participant
      2 pts

      我感觉应该是图里这样的,(x,y)和(i,j)分别在两个平面上,所以你应该按照比例先把后面的平面移动到前面的平面上,而不是直接用i和j去乘。我是这么想的·不一定对,你可以参考一下。

      Attachments:
      You must be logged in to view attached files.
    • #4798 Score: 0
      夏莉莉
      Participant

      我试了楼主的代码和后来给出建议修改的代码,图片是修改过后的代码,可是都还是一片蓝色,没有图案

      Attachments:
      You must be logged in to view attached files.
      • #4801 Score: 0
        YY
        Participant
        1 pt

        x*=scene.wietd/2 改成x/=scene.wietd/2
        y 也改

    • #4809 Score: 3
      Angus
      Participant
      23 pts

      嗯,可能楼主想的太复杂了。其实只是蛮简单的几个映射:

      假设成像的x-y平面在z=-1处。
      最开始,让 x=(i+0.5)/width,y=(j+0.5)/height,把 x,y映射到[0, 1]

      接着,把x,y映射到屏幕空间[-1, 1]

      剩下的就是怎么把这个[-1, 1]映射到世界坐标了,首先x,y都乘上scale确定在世界坐标系下的成像平面(这时是个正方形)的高度,然后再给x乘上aspectRatio变为复原到矩形的成像平面。

      This post has received 3 votes up.
      • #4861 Score: 0
        zsw
        Participant
        -2 pt

        多谢 明白了

      • #8425 Score: 0
        菜鸡互啄
        Participant

        大佬 问下吧,为啥不乘以camera2world matrix啊

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