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

      做了msaa之后确实是不在坑坑洼洼了
      但是有黑线问题
      对于黑线问题 维护一个samplebuffer 就行了
      但是我处理了黑线问题之后 有些边界没有抗锯齿了。。
      我是这样处理的 当前颜色= k(4个点有几个在三角形里面)*color+outcolor(通过samplebuffer得到的)*(1-k)

      Attachments:
      You must be logged in to view attached files.
    • #3458 Score: 1
      Angus
      Participant
      23 pts

      不知道你的outcolor是怎么写的。不过你既然也维护了一个四倍大小的sample_frame_buf和sample_depth_buf的话,我可以跟你说说我的思路,不保证对,但我最后的效果是没有问题的,然后你对照一下看看你的问题出在哪。

      在方法内,我首先对四个sample分别进行采样,然后记录在sample_frame_buf和sample_depth_buf内。

      如果有多于一个sample采集到有效样本的话(至少有一个sample在三角形内)
      就更新这个像素的
      frame_buf = (sample_frame_buf(index)+sample_frame_buf(index+1)+sample_frame_buf(index+2)+sample_frame_buf(index+3)) / 4

      This post has received 1 vote up.
      • #3459 Score: 0
        xuyonglai
        Participant
        3 pts

        感觉我们思路差不多,但我的结果是这样,这说明那一步有问题?

        Attachments:
        You must be logged in to view attached files.
        • #3461 Score: 1
          Angus
          Participant
          23 pts

          没代码的话我还真不好猜😄
          你可以试试分别把四个样本的sample_frame_buff当作最终值,用setcolor()赋给像素,看看单个样本是否出了问题👌

          This post has received 1 vote up.
        • #3470 Score: 0
          BlueLine
          Participant
          1 pt

          这种情况可能是在处理蓝色三角形时 四个采样点中有几个在绿色的三角形中,经过深度判断以后得知这几个采样点不能赋值为蓝色三角形的颜色但是需要赋值成绿色三角型的颜色。可能是这一步没有处理导致有黑色混进去了。

      • #3469 Score: -1
        MrPhD
        Participant
        1 pt

        你这样的本质,不就是把分辨率提高了吗?

        This post has received 1 vote down.
        • #3471 Score: -1
          zsw
          Participant
          -2 pt

          对啊 我也在想这个问题 加了一个4倍大小的depthbuffer 不就是相当于多处理的了4倍吗

          This post has received 1 vote down.
        • #3472 Score: 1
          BlueLine
          Participant
          1 pt

          并没有提高分辨率,四个采样点属于同一个像素,虽然在处理的时候四个采样点有不同的颜色,但是在最后是将四个采样的的颜色求平均,然后用平均颜色给这个像素填了色。

          This post has received 1 vote up.
        • #3482 Score: 0
          Angus
          Participant
          23 pts

          回复见楼下。

      • #3473 Score: 0
        zsw
        Participant
        -2 pt

        不,我没有sample_frame_buffer 我直接算的color
        一个像素分成4块,然后每个子像素判断在不在三角行里面,如果在 那么k++;
        如果不在,那么就取出sampledepthbuffer中的最前面的一个颜色,就是outsidecolor,
        然后在setpixel的时候set_pixel(Vector3f(i,j,z_interpolated),t.getColor()*k+outsidecolor*(1-k));

        This post has received 1 vote up and 1 vote down.
        • #3481 Score: 1
          Angus
          Participant
          23 pts

          Supersampling Antialiasing本身就是要为每一个子样本维护一个 color buffer和 depth buffer,并且每个子采样点都会做深度测试。

          具体可以参考文刀秋二前辈的知乎回答:
          https://www.zhihu.com/search?type=content&q=SSAA

          以及闫老师在课程8的35:14处也说了这么一句话:

          「大家已经做了这次作业,就应该已经知道,我们会维护每一个fragment或者说sample,对应的深度和颜色,最后再把它拼成一个图,就不会拼出三角形的黑边。」

          This post has received 1 vote up.
          • This reply was modified 4 years, 1 month ago by Angus.
        • #3490 Score: 1
          sublimation
          Participant
          3 pts

          这样做是有问题的。
          如果是在边界之前的颜色应该会混合有黑色,但是如果新加入的图形将黑色挡住,那么应该不再混有之前的黑色了。如果这里也维护一下,我觉得也可以实现。不过我觉得比较麻烦,如果有三、四种颜色混合(三个不同颜色图形+黑色),就不太容易维护了。

          ps:k要/4

          This post has received 1 vote up.
          • This reply was modified 4 years, 1 month ago by sublimation.
    • #3494 Score: 0
      zsw
      Participant
      -2 pt

      我想明白了,其实老师说的很清楚了,不用两个buffer,其实要维持的就是一个4倍大小的像素颜色值的一个sampleList,这个sampleList包括的就是每4X采样时的像素值,然后在每个点采样的时候,将在三角形里的颜色值给加到对应的点上,然后在设置颜色的时候取每个这个点对应的samplelsit的4个的平均值。

      Attachments:
      You must be logged in to view attached files.
      • #3496 Score: 0
        Angus
        Participant
        23 pts

        你使用这个四倍大小的像素颜色值的samplelist后,还需要一个四倍大小的子样本深度buffer吗?

      • #3497 Score: 0
        Angus
        Participant
        23 pts

        如果你只需要一个4倍大的buffer,即如果你只需要维护样本的color buffer就可以实现的话,那当我上面的话全都没说吧😥。
        我还是继续相信闫老师第八节课里说的话👌。

        • #3506 Score: 0
          zsw
          Participant
          -2 pt

          我也不知道是不是对的了= = 现在脑壳又糊涂了

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