Procedural Graphics in C (Voronoi Ep.01)

แชร์
ฝัง
  • เผยแพร่เมื่อ 23 พ.ย. 2024

ความคิดเห็น • 64

  • @stewartzayat7526
    @stewartzayat7526 2 ปีที่แล้ว +12

    1:26:40 I think it's probably because of cache locality actually. With the 'interesting' approach you keep iterating over the whole image, whereas in the 'naive' one you iterate over the seeds array instead. The seeds array fits into the cache no problem, so that's the better solution in terms of cache hits.

  • @rubensrensen197
    @rubensrensen197 2 ปีที่แล้ว +16

    Very interesting way to generate Voronoi diagrams, looking forward to the shader implementation.
    To get the encoding and decoding of positions and colors essentially for free, you could maybe put them in a union, something like this:
    typedef union {
    struct {
    uint16_t x, y;
    };
    uint32_t color;
    } Point32;

  • @wijiler5834
    @wijiler5834 2 ปีที่แล้ว +76

    Zozing zession 😊

    • @alpers.2123
      @alpers.2123 2 ปีที่แล้ว +17

      Haw abaut dat

    • @alpers.2123
      @alpers.2123 2 ปีที่แล้ว +5

      Rather interesting

    • @loryon
      @loryon 2 ปีที่แล้ว +5

      @@alpers.2123 I bet you didn't expect that sh*t to happen!

    • @alpers.2123
      @alpers.2123 2 ปีที่แล้ว +4

      @@loryon Welcome to the epic coding club

  • @modolief
    @modolief 2 ปีที่แล้ว +5

    Tsoding: Outside of Linus, you are my favorite hacker on the planet.

  • @cyanmargh
    @cyanmargh 2 ปีที่แล้ว +5

    Когда-нибудь я смогу попасть на стрим вовремя...

  • @mrdixioner
    @mrdixioner ปีที่แล้ว

    Долго искал информацию по программированию графики на Си, наконец то нашёл!!! Подписался, будем посмотреть :)

  • @Mozartenhimer
    @Mozartenhimer 2 ปีที่แล้ว +6

    The traditional method could be done in fragment shader with a shader storage buffer. Nonetheless, this is a very interesting method.

  • @hahamartin6595
    @hahamartin6595 2 ปีที่แล้ว +3

    wonderful,can u pack the series of olive.c into playlist ? that is also popular and interesting

  • @zhvrnkov6842
    @zhvrnkov6842 2 ปีที่แล้ว +5

    It would be interesting if you’ll try compute shaders that are available even in webgl as far as I know

    • @BalintCsala
      @BalintCsala 2 ปีที่แล้ว

      Compute shaders aren't in webgl, they were going to add them but decided to move back on that idea when they realized it's better to define webgpu

  • @CD4017BE
    @CD4017BE 2 ปีที่แล้ว +2

    You can actually use for loops and ifs inside fragment shaders. And as long as all control flow only depends on constants and uniforms (so all pixels will go through the same control flow path), they won't even cause performance penalties.
    Branching in shaders is only a problem when nearby pixels that run on the same SIMD unit need to go through different paths of the branch. Then the GPU has to go through both paths in sequence and do complicated SIMD lane masking to perform the computations only on the pixels that need it.

  • @matthias916
    @matthias916 2 ปีที่แล้ว +2

    Is there a specific reason you chose to store the the seeds' x and y position in the color as opposed to its index into the seeds array? Storing it's color would take less space which might leave space to store it's distance the current pixel so you wouldn't have to recalculate that as often

  • @c4llv07e
    @c4llv07e 2 ปีที่แล้ว +3

    tscoding, have you heard about the farbfeld image format? It's similar to pbm, but with more colors and without EOLs.

    • @superscatboy
      @superscatboy 2 ปีที่แล้ว +1

      The P6 variant of PPM supports up to 16 bits per channel (although very few applications can read it).
      IIRC in the ASCII version the newlines aren't required - only a whitespace character is required, and by convention people use spaces between values and newlines (which are a valid whitespace character) at the end of each scanline. This simplifies reading the file one scanline at a time, and on occasion I've found it useful for debugging as it's quite human-readable.
      The binary format doesn't require any padding between values and is generally preferable as it produces significantly smaller files anyway

  • @Anubis10110
    @Anubis10110 ปีที่แล้ว +1

    You are an epic programmer

  • @alexandrohdez3982
    @alexandrohdez3982 2 ปีที่แล้ว +1

    Love your videos I learn a lot 👏👏👏👏. Regards.

  • @koktszfung
    @koktszfung 2 ปีที่แล้ว +4

    It is indeed interesting

  • @stewartzayat7526
    @stewartzayat7526 2 ปีที่แล้ว +2

    0:30 tv actually stands for Tuvalu

    • @dokerb3d60
      @dokerb3d60 2 ปีที่แล้ว +2

      moreover, Tuvalu lives on the money paid by companies that wants to use their domain space because it looks like an abbreviation for television

  • @unmeinks5907
    @unmeinks5907 2 ปีที่แล้ว

    this man is speed incarnate

  • @Forbiiden
    @Forbiiden 2 ปีที่แล้ว +14

    Tsoding are you still working on porth?

    • @DuskyDaily
      @DuskyDaily 2 ปีที่แล้ว +2

      Last commit on 4th Feb 2022. I'm taking about the gitlab repo.

    • @Bobbias
      @Bobbias 2 ปีที่แล้ว +5

      @@DuskyDaily he stopped updating the repo, but he did say he was going to work on it in private.

    • @bigmistqke
      @bigmistqke 2 ปีที่แล้ว

      🙏 porth 😇

  • @RenderDragon
    @RenderDragon ปีที่แล้ว

    1:09 I am actually doing like that, bc I love your content :)
    Привет

  • @bunpasi
    @bunpasi 2 ปีที่แล้ว

    I'm enjoying the video so far. You can use `std::numeric_limits` for checking the ranges of numeric types. This way you don't need to remember those macros. Whatever you prefer.

    • @wiktorwektor123
      @wiktorwektor123 2 ปีที่แล้ว +1

      Yeah, in C++, this is C

    • @bunpasi
      @bunpasi 2 ปีที่แล้ว

      @@wiktorwektor123 I watched the video in multiple parts and completely forgot about that 😅. I realized it while watching part 2 and came to remove the comment but you beat me to it.

    • @wiktorwektor123
      @wiktorwektor123 2 ปีที่แล้ว +1

      @@bunpasi No problem m8, everyone can make mistake. It was just friendly reminder :)

  • @Dududuqwe
    @Dududuqwe 2 ปีที่แล้ว +1

    Is all this crazy editing/multiwindowing etc just Emacs functionalities?

    • @tissuepaper9962
      @tissuepaper9962 2 ปีที่แล้ว

      You can do this many ways. Emacs is one. Neovim is another. A tiling window manager could give you the same thing.

  • @juanmacias5922
    @juanmacias5922 2 ปีที่แล้ว +1

    1:21:30 what do you mean by branches? Thanks for the video. :)

    • @AlexxxMurkin
      @AlexxxMurkin 2 ปีที่แล้ว +2

      It's 'branchless' (computing/programming).

    • @wiktorwektor123
      @wiktorwektor123 2 ปีที่แล้ว

      This means there are no assembly jump instructions in code that can cause cache misses in CPU. CPU can safely assume which part of code will be executed next and have it preloaded to the lowest level of cache.

  • @leffivanov3127
    @leffivanov3127 2 ปีที่แล้ว +1

    Btw try out Odin, if you like C, very interested if you like it or not.

  • @puniat
    @puniat 2 ปีที่แล้ว +5

    Impossible. Nobody writes c in 2022. You are a maniac.

  • @obitouchiha-fl7od
    @obitouchiha-fl7od 2 ปีที่แล้ว

    23:35 won't uint8_t bytes auto shift

  • @smuecke
    @smuecke 2 ปีที่แล้ว +2

    Which font are you using in your terminal?

    • @c4llv07e
      @c4llv07e 2 ปีที่แล้ว +1

      It is Iosevka

  • @jonas_badstuebner
    @jonas_badstuebner ปีที่แล้ว

    0:30 *nerd-mode-on* '.tv' does not actually stand for "television", if that is what you wanted to say. It is the country specific TLD (Top Level Domain) of Tuvalu. TV itself stands for television, of course, but the domain ending is only a*used for representing this. *nerd-mode-standby*

  • @mobod6822
    @mobod6822 2 ปีที่แล้ว

    when is using farbfeld instead of ppm?

  • @petecoleman5748
    @petecoleman5748 2 ปีที่แล้ว

    Maybe next time get a dedicated mic for the keyboard as it was still possible to hear some of what you said above the key bashing. Is it a normal keyboard or is each key 25cm2, and you type with fists not fingers like a sort of coding whack-a- mole?

  • @atlantic_love
    @atlantic_love 2 ปีที่แล้ว

    Any books that teach graphic programming in C or even C++?

    • @tissuepaper9962
      @tissuepaper9962 2 ปีที่แล้ว

      "3D Game Engine Design" by David Eberly

    • @atlantic_love
      @atlantic_love 2 ปีที่แล้ว

      @@tissuepaper9962 I'm talking about GUI programming, building GUI apps and games. Not interested in graphic engine building.

    • @tissuepaper9962
      @tissuepaper9962 2 ปีที่แล้ว +1

      @@atlantic_love then you're looking for "UI programming", not "graphics programming". The most common way people write GUI in C and C++ is to use an external windowing library like Qt. Qt is super powerful and there are tons of people using it online so you should be able to find information about it easily. If you want to make really beautiful UI then you're better off writing an Electron-based app in JavaScript.

    • @atlantic_love
      @atlantic_love 2 ปีที่แล้ว

      @@tissuepaper9962 Okay. I'll check them out.

  • @mohamedamineayadi7290
    @mohamedamineayadi7290 2 ปีที่แล้ว +2

    your emacs config?

    • @c4llv07e
      @c4llv07e 2 ปีที่แล้ว +1

      Remix on github

  • @muhanadissa
    @muhanadissa ปีที่แล้ว

    it dose not work ???

  • @etbilu6265
    @etbilu6265 ปีที่แล้ว

    i don´t undertand .what is procedural graphics ? i program in c ,i am interested. please make a video basics of basics.

  • @sruffolo9303
    @sruffolo9303 ปีที่แล้ว

    what editor is tsoding using?

    • @ryonagana
      @ryonagana ปีที่แล้ว

      based emacs

  • @_lapys
    @_lapys 2 ปีที่แล้ว +4

    Firstn't

    • @c4llv07e
      @c4llv07e 2 ปีที่แล้ว +1

      firstn't

  • @temporaryaccounts8812
    @temporaryaccounts8812 ปีที่แล้ว

    7

  • @markow5062
    @markow5062 ปีที่แล้ว

    ты русский

  • @DommageCollateral
    @DommageCollateral ปีที่แล้ว

    hey, do you hvaew discord, or are you part of poimandres?