Rasterizer Algorithm Explanation

Поділитися
Вставка
  • Опубліковано 28 лис 2024

КОМЕНТАРІ • 122

  • @pyxelr
    @pyxelr 5 років тому +119

    Great to see more works being done with Manim. It's a pure pleasure watching all the animations.

    • @tomasbernardo5972
      @tomasbernardo5972 Рік тому

      Came here to say that exact thing. I've been trying to setup manim, could you point me in the right direction?

  • @lambichlambrovski9956
    @lambichlambrovski9956 4 роки тому +34

    This is very well done. I've seen many articles that were too technical to understand and too excessive with all of the details. The visuals helped a lot with understanding the algorithm.

  • @anthonypace5354
    @anthonypace5354 Рік тому +5

    Great explanation. I did something like this in high-school, but had to code this just recently. It’s very close to what I was thinking of doing, but watching your vid helped clarify things in my mind to a point I was able to make further optimizations. It is an excellent starting point, and The animation was exactly what I needed. More of these please.

  • @__Bomberman__2460
    @__Bomberman__2460 2 місяці тому +1

    I was so dumb until I watched this. Long time ago I wanted to make a scanline renderer and used some weird complex math to get the texture coordinates, now this is much easier. I'd like to know about perspective correctness for 3D triangles.

  • @swamihuman9395
    @swamihuman9395 10 місяців тому +1

    - Well done. Thx.
    - Clear, concise, engaging.

  • @aevideos5883
    @aevideos5883 5 років тому +71

    Wow this guy has a really nice voice! I wish I was that cool!

  • @luckylukeskywalker
    @luckylukeskywalker 3 роки тому +6

    thank you very much
    your explanation is almost perfect
    and the graphics were very helpul
    unfortunately this is another example of „what can be explained in 8 minutes, what my professor can't explain within around a total of 20 hours“
    i‘m glad there are videos like this

  • @prathmeshrautkar6683
    @prathmeshrautkar6683 3 роки тому +7

    most simple and understandable explanation. Thank you !!!

  • @schmarcel4238
    @schmarcel4238 5 років тому +9

    Such a great explanation and what a nice voice! Perfect 5/7

  • @mingsumsze6026
    @mingsumsze6026 2 роки тому +2

    Just to add to the discussions. Some textbook uses the DDA-based approach and maintain an active edge list which stores all of the edges that crosses the current scanline (I am not able to describe the algorithm in full here bu t just to give you an idea).
    By exploiting the coherence properties of scanline (such that all pixels bounded by the same 2 edges in a scanline must have the same "insideness"), one can efficiently compute all of the "insideness values" of all pixels along the scanline. I am pretty sure that this approach can easily generalise to support color interpolation across scanline as well.
    A distinct advantage of what seemingly to be an inefficient and counter-intuitive approach is that it can handle overlapping polygons. By maintaining also a polygon identifier inside the active edge list, we can effectively perform visibility-testing right at the rasterisation stage (without needing z-buffer) and writes directly to frame buffer.
    I might be wrong here. Please correct me if I am.

    • @mingsumsze6026
      @mingsumsze6026 2 роки тому +1

      After I think about it more I realise the DDA-based approach should turns out to be more space-efficient since the exact pixel coordinates of the lines do not have to be stored. Also, running Bresenham's upfront before the actual scanlining would induce an overhead.
      Given that the primitive is given by the form of an edge list, the DDA-based approach should be a better choice.

  • @ricky12105
    @ricky12105 4 роки тому +8

    Amazing video! Reminds me of 3b1b. keep it up!

    • @katech6020
      @katech6020 3 роки тому

      it is because he is using Manim which is made by 3b1b

  • @Brahvim
    @Brahvim 3 роки тому +1

    Basically, lerp colors between each vertex on a line, then fill lerped colors between each pixel!
    I hope I am right and this helped anyone who wanted a quick explanation ":D!

  • @lancemarchetti8673
    @lancemarchetti8673 Рік тому +2

    This is so interesting! Thanks for making this video. It helps me approach image binary representation without feeling intimidated we I'm trying to code out an idea.

  • @SirusStarTV
    @SirusStarTV Рік тому +1

    Great! manim revolutionazed visual explanation videos.

  • @samarthtandale9121
    @samarthtandale9121 Рік тому +2

    Beautiful video ❣️ truly amazing 💯🔥

  • @LogicEu
    @LogicEu 2 роки тому +3

    Beautiful and simple, thank you for this very helpful and easy explanation.

  • @НиколайКучерявенко-з1ш

    Wow, one of the best explanation I've heard, thank you!

  • @AlexSmolyankin
    @AlexSmolyankin 2 місяці тому

    Great job. BTW wouldn't be more efficient if we skip drawing lines with Bresenham's algorithm and just do scan lines? For example, we find the minimum and maximum of Y for all 3 points. In this case - 1 and 10. Then we do loop from 1 to 10, find the the points on both sides and draw line between this two points. I see only one drawback for this, we need to divide triangle to 2 parts: first will be with left side v1-v2, and second part will be with left side v0-v1. Right side will be the same for both parts. But at the end we need only 1 loop for every point in the triangle and some calculation for each point

  • @beadx6
    @beadx6 Рік тому +1

    Best explanation video.

  • @hmz121fast
    @hmz121fast 3 роки тому +1

    Simplest explanation ever, Big like

  • @karen-7057
    @karen-7057 2 роки тому +1

    Beautifully done. Masterfully explained thanks so much for sharing

  • @Ne1gh_
    @Ne1gh_ 11 місяців тому

    Nice! It would be great to see Bresenham algorithm on the circle.

  • @Alex-op2kc
    @Alex-op2kc 3 роки тому +3

    THANK YOU!!! Great teaching!

  • @Andrew90046zero
    @Andrew90046zero 3 місяці тому

    I wish I found this video a while ago when I was trying to do basically this for a project that uses software rendering.
    I did end up doing somthing similar to this, but at first I was using barycentric coordinates to interpolate. And then it dawned on me: "Why don't I just interpolate the interpolations!? duh!"
    Only thing I did differently was that I tried to avoid the "sorting" that you did here, where I would need to have extra memory to hold that info. But instead I would do the horizontal lines while I was doing the triangles edges. Which did require extra logic to make sure the y-values were lined up, but it worked. Though I'm sure that I coud've made it faster by not doing those checks and simply drawing out the edges and sorting the pixels as you did here.

  • @HongLab
    @HongLab Рік тому +1

    Thank you.

  • @balincarmichael7688
    @balincarmichael7688 4 місяці тому

    Nice, short, sweet video, although I wish you would’ve talked about Bresenham algorithm. I assume it’s just calculating y for every x value and rounding it, where x is a list of whole numbers, but it would’ve been nice to have atleast a high level understanding of it

  • @yasamanasgari2017
    @yasamanasgari2017 2 роки тому +2

    Thanks very much, understandable

  • @EffectEcho
    @EffectEcho 3 роки тому +2

    this made it so clear. thank you so much

  • @francescorizzi2601
    @francescorizzi2601 3 роки тому +7

    Very nice video, i'm just wondering what is exactly the formula for linear interpolation.. How did you use it in order to interpolate colors between vertices? Thanks

    • @gabrielbap1
      @gabrielbap1 3 роки тому +2

      I'm guessing the bresennam algorithm will give you a sorted array of points to represent the line between each two vertices of the triangle. For each position i in this size n array, the color will be (i/n)*color1 + (n-i/n)*color2. Does it make sense?

  • @DmitriyKakaulin
    @DmitriyKakaulin 10 місяців тому +2

    Shouldn't the first linear equation with given point be y=x+2?

  • @perfectionbox
    @perfectionbox Рік тому

    For texturemapped triangles however you need to use perspective divide instead of interpolation

    • @npip99
      @npip99 Рік тому +1

      Perspective divide doesn't have anything to do with interpolation. In 3D graphics pipelines, that occurs in the vertex shader, before the fragment shader ever runs on the interpolated values.

    • @perfectionbox
      @perfectionbox Рік тому

      @@npip99 What I meant is, you need to yeah perspective divide when processing vertices and then interpolate the w component to get the correct texture coord. On PS1 they didn't and just lerped the texture coords xy components instead. Probably too slow to transform vertices into normalized space.

  • @GabrielPiveta
    @GabrielPiveta 4 роки тому +30

    This resembles me 3blue1brown.

    • @AarvAanD
      @AarvAanD 4 роки тому +1

      somebody got inspired

    • @henryzt
      @henryzt 4 роки тому +9

      He did mention It’s made using Manim, an open source animation engine made by 3b1b himself

    • @yuxuanxue4365
      @yuxuanxue4365 4 роки тому +1

      @@henryzt Great open source engine

  • @smit17xp
    @smit17xp Рік тому +1

    Thanks you so much. This very easy to understand!!

  • @VitoxCzechia
    @VitoxCzechia 2 роки тому +1

    Very nice video! Good job.

  • @RenormalizedAdvait
    @RenormalizedAdvait 2 роки тому +1

    Beautiful, thank you and keep it up.

  • @djukicdev
    @djukicdev Рік тому +1

    Great explanation

  • @YOOOOOOOOOOOOOOOOOOOOOOOOOOOO
    @YOOOOOOOOOOOOOOOOOOOOOOOOOOOO 2 роки тому +2

    This video was awesome

  • @ARBB1
    @ARBB1 2 роки тому +2

    Great work

  • @DmitriyKakaulin
    @DmitriyKakaulin 10 місяців тому +1

    Shoouldn't the first linear equation with given point be y=x+2?

  • @anlmaral1762
    @anlmaral1762 2 роки тому +2

    Such an in depth and clear explanation!

  • @niks660097
    @niks660097 Рік тому

    All of this is done by dedicated hardware(ROPs) in sub-milliseconds time, modern GPUs are amazing, if you want to know your GPU's raster speed, check its number of ROPs(and memory bandwidth too)..

  • @Drachenbauer
    @Drachenbauer 4 місяці тому

    1:40 why does the line between the green and blue pixel not resemble a stair of 3 equal steps of 3 length?

  • @vornamenachname8001
    @vornamenachname8001 3 роки тому +2

    nice video, but why isnt the triangle after being projected from worldspace to screen space converted to its parametric form there and then for each pixel it is checked if both parameters are within the 0-1range? im no programmer but solving the same equasion for every pixel seems faster than storing so many things in lists and sorting values.

    • @karen-7057
      @karen-7057 2 роки тому +2

      Well... If you propose to check every pixel you are proposing a brute force quadratic solution (O(n^2)) while sorting algos are way more efficient (O(n logn)).
      Space in a computer is cheap. What you optimize is operations made. check up on dynamic programming to see more examples of the space-operations trade off

    • @saschakehrli2496
      @saschakehrli2496 2 роки тому +1

      yeah his explanation kinds suckzzz

  • @TheShinx317
    @TheShinx317 5 років тому +1

    Very good animation, well done

  • @yaofengwang4509
    @yaofengwang4509 4 роки тому +1

    Nice explanation with great animation thx

  • @muhammedyasinhanyasar539
    @muhammedyasinhanyasar539 3 роки тому +1

    an awesome video.

  • @blue_birb
    @blue_birb 4 місяці тому +2

    passing 3 vertices to the gay peyo

  • @Jespertheend2
    @Jespertheend2 4 роки тому +1

    Thanks! This helped me.

  • @samarthtandale9121
    @samarthtandale9121 Рік тому +2

    Hey, you have outstanding explanation skills (just in case you don't know) ... You should keep uploading new videos, rather start a playlist on some topic 🔥

  • @karim-gb5nx
    @karim-gb5nx 2 роки тому +1

    Well done.

  • @tomasbernardo5972
    @tomasbernardo5972 Рік тому

    Would bresenham's algorithm work for vertical lines?

  • @pulatpulet7202
    @pulatpulet7202 4 роки тому +2

    nice video dude!

  • @nerya4197
    @nerya4197 5 місяців тому

    is this equivalent to using barycentric coordinates?

  • @jwfundsd
    @jwfundsd 4 роки тому

    Excellent!!! Congratulations!!!

  • @slingshot7602
    @slingshot7602 Рік тому +1

    In 3:28 why in y3 why there is two 1??

  • @jhoanmartinezsilva2609
    @jhoanmartinezsilva2609 4 роки тому +2

    Awesomeeee

  • @VanVlearMusic
    @VanVlearMusic Місяць тому

    wow nice triangle

  • @int16_t
    @int16_t 4 роки тому +1

    I believe the image coordinate is wrong in this.
    0, 0 is in the top left corner.

    • @TheBuilder06
      @TheBuilder06 3 роки тому +1

      There is no standard for NDC coordinates. Both are correct.

    • @int16_t
      @int16_t 3 роки тому

      Ok, I get it. I admit defeat. No further comment.

  • @Mauricetz
    @Mauricetz 4 роки тому +1

    Thanks, I'm building a small graphic motor to be implemented in a ESP32 :)

  • @clucie
    @clucie Рік тому +1

    awesome!

  • @yuanperry3443
    @yuanperry3443 2 роки тому +2

    nice! .

  • @dobostristan6244
    @dobostristan6244 Рік тому +1

    Hi, the Github link does not work any more

  • @jonathanmoore5619
    @jonathanmoore5619 4 роки тому +2

    Perfect expo

  • @otesunki
    @otesunki 4 роки тому +3

    3blue1brown fan?

  • @socdfx
    @socdfx 4 роки тому

    Hi. Not clear @3:30 onwards why y[3] repeats the 1 and similar for the y[1] repeats the 9

    • @girardincedric6865
      @girardincedric6865 4 роки тому +1

      same reason as @4:10 the corners have the postion stored twice (also while calculating the linear equation the corners overlap)

  • @therayvenn3482
    @therayvenn3482 2 роки тому +2

    Why'd you delete the source code??? Can you reupload it please?

    • @korigamik
      @korigamik 9 місяців тому

      Yes! Did you hear any response?

  • @chrischoir3594
    @chrischoir3594 4 роки тому +3

    y3 = [1,1,2,9] why 1 twice?

    • @mono9613
      @mono9613 4 місяці тому

      I'd guess it's because drawLine() takes two x-values, so if we end up with more, we need to run the function once per pair within a scanline. Therefore, if we end up having an odd amount of values, we need to duplicate one, so no value is being left out and left unprocessed by drawLine()

  • @tunit6458
    @tunit6458 3 роки тому +1

    Jurgen Klopp EROTIC VOICE
    YOU???
    🤔

  • @rahulshah6119
    @rahulshah6119 Рік тому

    why is y_3=[1 1 2 9] and not [1 2 9]
    same with 7899 not being 789 for y_1
    and 88 not being just 8 for y_10 (although this can kinda make sense?)

    • @girardincedric6865
      @girardincedric6865 Рік тому

      exactly for the reason we have that y_10 is [8,8], when we implement this algorithm we can always guarantee that a y_set has 2 points so we don't have to check every time in the drawLine for an edgecase.
      the reason for y_3 = [1,1, 2, 9] and y_1 = [7,8,9,9] is the overlap of the lines at there endpoints. we leave the overlap intentionally exactly for this case.

  • @ezpz4akash
    @ezpz4akash Місяць тому

    Thank you!

  • @cory99998
    @cory99998 3 роки тому +1

    ty

  • @Johnassu
    @Johnassu 4 роки тому

    Nice video! How did you make the animation?

    • @tuna3977
      @tuna3977 3 роки тому +1

      Manim. It's a mathematical animation engine. You can find it on GitHub

    • @Johnassu
      @Johnassu 3 роки тому

      @@tuna3977 thank you so much

  • @kkadir
    @kkadir 3 роки тому

    Thank you for the video. The link to the source code is broken. Can you fix it? I would like to see the code.

  • @marcjukil300
    @marcjukil300 4 роки тому +3

    Okay let's go, I am going to develop the killer of VulkanAPI ! 👹👹😈😈

  • @florianleuenberger989
    @florianleuenberger989 5 років тому

    Nice backgroundmusic

  • @angelblancorodriguez6972
    @angelblancorodriguez6972 Місяць тому

    This is cool

  • @miccallwang3164
    @miccallwang3164 3 роки тому

    github link can not found ?

  • @vinniciusrosa8284
    @vinniciusrosa8284 9 місяців тому

    Great

  • @AIWIZARDDT
    @AIWIZARDDT 5 років тому

    how did you get manim to render this?

  • @whickervision742
    @whickervision742 3 роки тому

    Pretty video but this algorithm would be extremely slow.

  • @erikthegodeatingpenguin2335
    @erikthegodeatingpenguin2335 4 роки тому +1

    lol are you using 3blue1brown's rendering library?

    • @int16_t
      @int16_t 4 роки тому

      Why did you use the word "LOL"? Is it funny? I find it COOL!!

    • @erikthegodeatingpenguin2335
      @erikthegodeatingpenguin2335 4 роки тому

      @@int16_t Yeah, I am mildly amused at the observation that he is using 3blue1brown's rendering library. It's pretty cool too

  • @creativecraft_mc
    @creativecraft_mc 3 роки тому +1

    this is the new 3blue1brown

  • @jimmoriarty6964
    @jimmoriarty6964 5 років тому +3

    3b1b?

  • @SirusStarTV
    @SirusStarTV Рік тому

    Imagine if gpus used *flood fill* algorithm instead lmao

  • @나두진-j7u
    @나두진-j7u 4 роки тому

    great!

  • @ericsynchrona5495
    @ericsynchrona5495 3 місяці тому

    Rasterization

  • @alexanderthorbrugge6489
    @alexanderthorbrugge6489 4 роки тому +1

    Way to few subscribers :(

  • @z304
    @z304 2 роки тому +1

    Your first equation is wrong

  • @vapourmile
    @vapourmile 4 роки тому +4

    The best thing about this was the graphics. This was otherwise terrible.
    First off, he doesn't show how to implement Bresenham's algorithm. You don't solve the linear equation. That's the whole point of the algorithm. Second, when you do use it, you only use it for wire-frame graphics. For polygon graphics you only need to generate the pixel pairs for each raster, the start and finish. As you can see, this linear equation doesn't achieve that.

    • @girardincedric6865
      @girardincedric6865 4 роки тому +3

      Thx you very much for the feedback!
      Sorry that I didn’t explain the Bresenham's algorithm. The Video was made with the intent that it will serve as an additional explanation for the understanding for our Computer graphics script, in which the Bresenham’s Algorithm is explained in detail. For the point, that i didn't solve the linear equation, I already assume that people who watches this video can solve a linear equation.
      Unfortunately, I don't quite understand what you mean/try to explain in your second point. I applied the scanline algorithm for my own 3D renderer, and it did solve that just fine.
      If you want to see my own 3D renderer, where I use the scanline algorithm for polygons, you can clone my “3D CPU renderer project” on github (C#):
      github.com/cedi-code/VertexProject

  • @blocksrey
    @blocksrey 3 роки тому

    Wow this is slow lmao