Xiaolin Wu's Line Algorithm - Rasterizing Lines with Anti-Aliasing

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

КОМЕНТАРІ • 30

  • @roboltamy
    @roboltamy День тому +17

    Ok now this is some timing. I was watching your video on Bresenham per a friend's recommendation and now that I'm trying to understand Xaiolin Wu you post a video on it.

    • @Sloimay
      @Sloimay День тому +1

      Funnily enough I was checking out the HLP discord yesterday on a whim and saw your status. I immediately looked it up and now the goat makes a video on it XD

  • @joeeeee8738
    @joeeeee8738 День тому +7

    Can't wait for the next videos of this series!

  • @roboltamy
    @roboltamy День тому +7

    I'd really appreciate a video on AA lines with thickness

  • @wWvwvV
    @wWvwvV 23 години тому +3

    There is also the probably more efficient DDA algorithm. It also uses floating point arithmetic. DDA stands for "digital differencial analyzer". The derivatives are predetermined. Add the correct slope/derivative to get to the next integer pixel. The difference to Xiaolin Wu is, only the pixels the line goes through are considered/affected.

  • @ai_outline
    @ai_outline 22 години тому

    This channel has so much potential!! Amazing ❤️

  • @CartoType
    @CartoType День тому +8

    There are two debatable assumptions here: first, that Bresenham looks worse than Xiaolin Wu (in my opinion Bresenham looks better); and more importantly, that it is worthwhile to draw single-pixel-wide lines. With modern displays having three or four hundred dots per inch, you can’t see a line one pixel wide.
    A better approach is to draw lines that have a zero-width centre line and a non-zero width, by stroking a path using a circular or sometimes non-circular pen. Graphics systems compute the envelope of the line, which is the Minkowski sum of the pen and the zero-width line, and then fill it using a suitable anti-aliasing system.

    • @tbird81
      @tbird81 День тому +3

      With modern displays you'd use a GPU. But it's useful to know vaguely how this algorithm works.

    • @HoSza1
      @HoSza1 День тому +4

      And how do you think gpus draw antialiased lines?

    • @tbird81
      @tbird81 23 години тому +3

      @@HoSza1 In the fragment shader, usually using a distance function, and fract for the opacity. They don't use bresenham! A loop is exactly what you'd avoid!

    • @HoSza1
      @HoSza1 16 годин тому

      @@tbird81 The essence of this algorithm is not a loop, but to determine the proportion of the areas created by the line segment in the two pixels. You can do that in paralel without ever using a loop.

  • @Odod4000
    @Odod4000 8 годин тому

    im making a graphics library rn your videos really help

  • @aidennwitz
    @aidennwitz День тому

    fantastic series

  • @blackwatch4471
    @blackwatch4471 День тому +1

    Are you using something/some program to represent those pixels or are they just edited in?

  • @gulyasgyorgy
    @gulyasgyorgy День тому

    amazing, hidden gem

  • @Wolf-if1bt
    @Wolf-if1bt День тому +4

    Can we improve this algorithm to work only with integers?

    • @ivankramarenko
      @ivankramarenko День тому +3

      i think yes, if alpha in range 0..255 then we can multiplie all distances by 255. ex. x = 255 as 1, 512 as 2, 1024 as 4... and fast calc this use rightshift x = 512 >> 8

    • @Wololo123abc
      @Wololo123abc День тому +3

      ​@@ivankramarenkoFixed point instead of Floating point

  • @0memega
    @0memega 19 годин тому

    Still waiting for the Digital Differential Analyzer, or DDA, it could also be used with floats. It's most popular application would be in psuedo 3D, raycasting, present in Wolfenstein 3D and other games when they weren't powerful enough to render true 3D

  • @FadkinsDiet
    @FadkinsDiet 22 години тому

    this method uses approximate distances from the lune to rhe center of the pixel. There's going to be less distortion for a line that is nearly zero slipe compared to a line that is nearly diagonal. I wonder how better it would look to do a proper perpendicular distance from the line to the center point of the cell.

  • @tenburger
    @tenburger День тому

    olm kanalını daha bugün gördüm ne kadar az video var diye üzüldüm ya allahu teala sesimi duymuş demek ki

  • @Lespati-wy9dy
    @Lespati-wy9dy День тому

    Love it!

  • @kestergreen3844
    @kestergreen3844 9 годин тому

    Amazing video. One tip though when explaining math... use allot of pauses to allow the words to transform from noise to comprehension in our minds. For example at this point: ua-cam.com/video/f3Rs20k-hcI/v-deo.html when you say "the change in y" add a pause and then continue to say "for one step in x". These two pieces of information are seperate and have different meaning. Allow your listeners and viewers a chance to recognise the distinct meaning of each piece of information your conveying.

  • @Z3rgatul
    @Z3rgatul 11 годин тому

    0:15 is this really "perfectly anti-aliased" line?
    It seems like a good approximation. Perfectly anti-aliased should calculate orthogonal distance to the line, and not just delta X or Y. This requires more compute power

  • @typicwhisper6569
    @typicwhisper6569 21 годину тому

    I think there is something wrong with the opacity and blending, causing dark spots on the line. the alpha should be A^(1/2.2) (or 1-(1-A)^2.2 idk), where A is the original alpha from 0 to 1.

  • @Wololo123abc
    @Wololo123abc День тому

    Hello!

  • @pebbleschan6085
    @pebbleschan6085 8 хвилин тому +1

    What a load of BS! 🎉