Perfect Pistons in Shadertoy

Sdílet
Vložit
  • čas přidán 27. 08. 2024
  • In this tutorial I describe how to create a signed distance function like the one featured in the shader "Whack-A-Mole Pistons." I describe how you can make signed distance functions with repeated objects such that each object can differ in its own unique way, without experiencing glitches.
    Errata:
    - At the end I say "the worst possible SDF is the convex hull of the SDF" when the correct thing to say is "the worst possible SDF is the union of all possible configurations of the SDF." The use of the term "convex hull" is inaccurate.
    Shaders in this video:
    Whack-A-Mole Pistons - www.shadertoy....
    Perfect Pistons Example 1 - www.shadertoy....
    Perfect Pistons Example 2 - www.shadertoy....
    Perfect Pistons Example 3 - www.shadertoy....
    An article explaining erot and the hash function:
    suricrasia.onl...

Komentáře • 40

  • @codedeus
    @codedeus Před 11 měsíci +1

    This is a goldmine of shader tricks. Thanks!

  • @DeanEdis
    @DeanEdis Před 3 lety +4

    The clearest explanation of SDF over-stepping I’ve ever seen. Thanks!

  • @chasemarangu
    @chasemarangu Před 2 lety

    6:37 - _intractable_ - excellent word choice!

  • @Kazner0h
    @Kazner0h Před 7 měsíci

    Amazing breakdown!

  • @johnhunter5247
    @johnhunter5247 Před 3 lety +1

    Blackle Mori, back at it again

  • @spambot7110
    @spambot7110 Před 3 lety +1

    i had to let this soak for a few weeks and rewatch, but i am no longer as terrified of raymarching as i was!

  • @MicheleZaccagnini
    @MicheleZaccagnini Před 3 lety +3

    This is gold! so many great tips, that axis rotation function looks great too. Just subscribed!

  • @kostik-pi7me
    @kostik-pi7me Před 3 lety +1

    Extremely informative and clean, will be glad to see more videos from you!

  • @n305
    @n305 Před 2 lety +1

    This is timeless

  • @carbunclegrim3419
    @carbunclegrim3419 Před 3 lety +2

    Thank you, clearly presented. Gives me even more infinite possibilties to mix with fractals, if only i had infinite time:)

  • @MysteryPancake
    @MysteryPancake Před rokem +1

    Great tutorial, very well explained!

  • @mainuss
    @mainuss Před 3 lety +1

    Amazing explanation, love it. More please more 👋👋

  • @helium9480
    @helium9480 Před 3 lety +1

    Thanks! You managed to fix an issue I was having with repetition!

  • @ArmanKhalatyan
    @ArmanKhalatyan Před 3 lety +1

    thank you, great tutorial, cool rotation function 😊

  • @Anskair
    @Anskair Před 3 lety +1

    wow, that was insightful. Thanks!

  • @paulofalca0
    @paulofalca0 Před 3 lety +1

    Again a great video! Thanks!😀

  • @ricopin
    @ricopin Před 3 lety +1

    Thanks for the tutorial!

  • @guitarguy8288
    @guitarguy8288 Před 3 lety +1

    Brilliant! Also looks like it’s time to trim down my mat4 rotation function.

  • @martinteadrinkereklund4285

    Great explanation!

  • @NullPointer
    @NullPointer Před 3 lety +1

    Super clever! Great video

  • @AaronTheGerman
    @AaronTheGerman Před 3 lety +2

    I just realized the max height piston is also just the union of all possible pistons, it just happened to also be a valid piston

  • @tksmkd
    @tksmkd Před rokem

    Blacke, seu mais novo amigo brasileiro! por favor, faça mais videos como esse! poucos tem a sua capacidade (de programação e de explicação)

  • @TomAtkinson
    @TomAtkinson Před 2 lety

    This is amazing! Your a montster! Very helpful.

  • @theobgshow
    @theobgshow Před 3 lety +1

    Thank you very much.

  • @martenrange1940
    @martenrange1940 Před rokem

    Good one

  • @mang0mang012
    @mang0mang012 Před 3 lety +1

    Great video!
    For one more optimization, couldn't you query the neighbour cells and if the height of that neighbour piston is lower then the "me" piston, then you can ignore it altogether? That would I think help reduce the march count pretty cheaply (would only need to do the sin evaluation for neighbour cells).

    • @suricrasia
      @suricrasia  Před 3 lety

      that's an interesting idea! unfortunately, if we only check the immediate neighbour, we might have an issue where the neighbour on the other side is extremely tall and we fall into our overshoot problem again.
      what you could do is use the real height of the neighbour by doing the sine evaluation, and then do the "worst case height" for the cell's other neighbour on the other side.
      I'll make a little shadertoy to help explain what I mean...

    • @suricrasia
      @suricrasia  Před 3 lety

      here's an example: www.shadertoy.com/view/NtXGRn

    • @ravindrakatakiya206
      @ravindrakatakiya206 Před 3 lety

      But what about next neighbor?To skip checking loop of neighbor we have to take closet neighbor as worst

  • @seb776
    @seb776 Před 3 lety +1

    Gosh ! Thanks a lot !

  • @amreamer362
    @amreamer362 Před 2 lety

    Awesome

  • @antoinedevldn
    @antoinedevldn Před 3 lety +1

    Thanks

  • @psenough
    @psenough Před 3 lety +1

    nice trick!

  • @theobgshow
    @theobgshow Před 3 lety +1

    Hello Blackle Mori. Do you plan on creating more shader videos in future? My life has purpose now :)

    • @suricrasia
      @suricrasia  Před 3 lety +1

      yes! I have one planned soon about different ways to add lighting to a model

    • @theobgshow
      @theobgshow Před 3 lety +1

      @@suricrasia Superb! I've subscribed and switched on notifications. I love your clarity and depth. I'm already bracing myself up to ask you to come on to The OBG Show to do a half an hour interview on my series called Ordinary People. This wasn't my intention for making contact, and I hope this isn't considered spam. I just thought of it as I was replying.
      Thank you for sharing a part of you with us.

    • @suricrasia
      @suricrasia  Před 3 lety +1

      thanks for the kind words. I appreciate the offer, but unfortunately I am not interested in being interviewed at this time.

    • @MS-ph2ol
      @MS-ph2ol Před 3 lety

      I am excited for this series, great work!

  • @nikkar314
    @nikkar314 Před 2 lety

    i was here