Home Forums GAMES在线课程(现代计算机图形学入门)讨论区 大佬请帮帮忙,作业七还在理解 shade(p, wo) 函数

Tagged: 

Viewing 7 reply threads
  • Author
    Posts
    • #5533 Score: 0
      o_o_o_o_o
      Participant
      -1 pt

      问题主要就是 wo, x, ws, NN 如何理解?

      – wo: 方向, 可以理解是眼睛 p 指向 👁 的位置?
      – N : p 点的 normal?
      – x : 光的位置
      – ws : x – p ?
      – NN : x处的光的 normal
      – L\_dir = L\_i * eval(wo, ws, N) * dot(ws, N) * dot(ws, NN) / |x-p|^2 / pdf_light,看课程 slides 难道最后一项的dot(ws, NN)不需要添加一个负号给 ws 么? 不应该是 dot(-ws,NN)么?

      
      shade(p, wo)
      	// p 位置, Vector3f
      	// wo 方向,Vector3f ,	
      	sampleLight(inter, pdf_light)
      	Get x, ws, NN from inter
      	// 这样我们sample了光, x, NN 来自光源,
      	Shoot a ray from p to x
      	// 从 p 点产生一条 ray 照向光
      	If the ray is not blocked in the middle
      	// 如果这条 ray 中间没有被挡住,那么就说这应该使用直接光照
      		L_dir = L_i * eval(wo, ws, N) * dot(ws, N) * dot(ws, NN) / |x-p|^2 / pdf_light
      	// 上面这一部分是求直接光照
      
      	L_indir = 0.0
      	Test Russian Roulette with probability RussianRoulette wi = sample(wo, N)
      	Trace a ray r(p, wi)
      	If ray r hit a non-emitting object at q
      		L_indir = shade(q, wi) * eval(wo, wi, N) * dot(wi, N) / pdf(wo, wi, N) / RussianRoulette
      	Return L_dir + L_indir
      
      This post has received 1 vote up and 1 vote down.
    • #5534 Score: 0
      助教
      Keymaster
      14 pts

      实际计算过程中,确实是 dot(-ws,NN)

      This post has received 1 vote up and 1 vote down.
      • #5535 Score: -1
        戴皓天
        Participant
        9 pts

        谢谢助教!昨晚搞了半天,一次渲染都要十几分钟,结果东改改西改改渲染几次图出来都是全黑的😂
        原来是这里疏漏了,改了就好了,太粗心了😂

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

          请问这位大佬orz,是所有的ws都需要取负吗?

          This post has received 1 vote up.
          • #5546 Score: 0
            戴皓天
            Participant
            9 pts

            不是,这个你画个图就知道了,要判断具体是取正取负你得搞清楚各个物理量的含义

            This post has received 1 vote up and 1 vote down.
            Attachments:
            You must be logged in to view attached files.
    • #5536 Score: -1
      戴皓天
      Participant
      9 pts

      顺便提一句,用castRay的参数ray获取它打到的物体之后记得判断一下Scene::intersect的返回值的happened是否是0,是0的话代表没打到任何物体直接返回Vector3f(0.0f)就行了
      不然会报段错误,因为材质是null的话用Material::eval和Material::sample的时候会出错

      ps:楼主的理解是对的

      This post has received 1 vote down.
      • This reply was modified 4 years, 7 months ago by 戴皓天.
      • #5561 Score: -1
        o_o_o_o_o
        Participant
        -1 pt

        感谢大佬, ღ( ´・ᴗ・` )比心

        This post has received 1 vote down.
      • #5694 Score: -1
        Songsong
        Participant
        4 pts

        大佬 想请问一下给的几个intersect函数具体应该使用哪个?想判断测试光线与内部是否有交点感觉不知道该使用哪个。。

        This post has received 1 vote down.
        • #5726 Score: -1
          o_o_o_o_o
          Participant
          -1 pt

          就 scene 里面的 intersect ray

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

      你好,想问一下wo是不是就是ray的direction取反??

      This post has received 1 vote down.
      • #5549 Score: -1
        戴皓天
        Participant
        9 pts

        对的

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

          再请问一下www,判断相交物体是否发光是不是用的intersection对象的emit参数为000?

          This post has received 1 vote up.
          • #5564 Score: -1
            戴皓天
            Participant
            9 pts

            我用的办法比较笨,是直接对材质里的一个属性进行判断的,你说的这个我具体不记得了,不过应该也是可以的吧:)

            This post has received 1 vote down.
    • #5565 Score: -1
      Songsong
      Participant
      4 pts

      想请问一下,采样出的x存在哪个参数里?对结构还是不太熟悉

      This post has received 1 vote down.
      • #5567 Score: 1
        o_o_o_o_o
        Participant
        -1 pt

        我以为是 sampleLight(inter, pdf_light) 然后x存在inter里面

        This post has received 1 vote up.
        • #5572 Score: 1
          Songsong
          Participant
          4 pts

          好的 感谢哈

          This post has received 1 vote up.
    • #5596 Score: -1
      安安
      Participant
      -1 pt

      请问一下depth变量是用来做什么的呀

      This post has received 1 vote down.
      • #5630 Score: -1
        禹鹏(助教)
        Keymaster
        9 pts

        因为是递归算法,所以我们的光线可能弹射很多次,除了俄罗斯轮盘赌的方法来停止光线弹射外,我们也设置了最大的弹射此处,也就是depth。

        This post has received 1 vote down.
        • #5634 Score: -1
          助教
          Keymaster
          14 pts

          啊不,我一直没提示是因为希望他们自己意识到这件事,depth 不是用来判停的,而是用来辅助让光源不要全黑的。

          This post has received 1 vote down.
          • #5636 Score: 2
            禹鹏(助教)
            Keymaster
            9 pts

            哦哦,确实是这样。是我理解错了。

            This post has received 1 vote up.
            • #5641 Score: -1
              Bear
              Participant
              -11 pt

              我和你理解一样,depth 是另一个递归终止条件。。。

              主要是我没用到 Depth 也让光源发光了,用的方法比较朴素

              This post has received 1 vote down.
    • #5651 Score: -1
      o_o_o_o_o
      Participant
      -1 pt

      哈哈哈哈哈~~~感恩各位大佬

      至少我的直接光照写出来蛮对的,原来之前在计算中一直犯了一个该死的小错误(这该死的温柔,o(╯□╰)o)

      This post has received 1 vote down.
    • #6545 Score: 2
      DoubleQ
      Participant
      2 pts

      有个疑问,x是光的位置,那么光的位置为什么可以通过sampleLight函数得到?光的位置难道不是事先就固定好的吗

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