Intro To Procedural Shapes and Patterns - Episode 1

Поделиться
HTML-код
  • Опубликовано: 4 окт 2024
  • Today, we're starting a brand new series of tutorial videos. In this series we'll be discussing procedural shapes and patterns. We'll be creating signed distance fields, tiling patterns, compound shapes, user interface elements, and more - all using shader math. We'll also be creating a library of nodes - Subgraphs in Shader Graph and Material Functions in Unreal - to help with the creation process. In today's video, we go over the creation of a Linear Gradient node and an Anti-Aliasing node. The Anti-Aliasing node uses derivatives to resolve a gradient or signed distance field into a perfectly sharp and anti-aliased line, regardless of resolution or camera distance.
    ------------------------------------
    Here's last week's tutorial that shows how to create particle billboards for VR.
    • Adapting the Particle ...
    Here's the playlist for the whole series:
    • Procedural Shapes and ...
    Shader Book Recommendations
    www.bencloward...
    ------------------------------
    Theme Music
    Peace in the Circuitry - Glitch Hop
    teknoaxe.com/Li...
    Background Music
    Speo - The Little Things
    • Speo - The Little Things
    #UnrealEngine #shadergraph #Unity

Комментарии • 74

  • @krz9000
    @krz9000 Месяц назад +2

    im a bit late to the party for this one ..but the ben clower party never stops being useful! lets gooo

  • @hotsauce7124
    @hotsauce7124 3 месяца назад +14

    May I ask, is there a preview of what the end result will be? I ask because it help me understand the steps to walk towards the goal. Ben, YOU ARE AN AMAZING TEACHER>>>THANK YOU!

    • @BenCloward
      @BenCloward  3 месяца назад +23

      That's a very good point. I'll try to include some examples of what our end results will look like in next week's video. Thank you!

    • @hotsauce7124
      @hotsauce7124 3 месяца назад +2

      @@BenCloward BEN, YOU ARE THE BEST!!!!

    • @vladdimitrov819
      @vladdimitrov819 3 месяца назад +1

      ​@@BenClowardthank you! This would be super helpful! For longer multi part tutorials where the end may not have been done/recorded yet, it helps showing examples from existing games too. Just so we know what kind of thing we're working towards. Always appreciate your work and sharing expertise with us! Thank you!

  • @mianokamuru6333
    @mianokamuru6333 3 месяца назад +3

    best shaders channel

  • @ab-uo6rd
    @ab-uo6rd 29 дней назад +1

    I love that series so much I decided to watch it a second time! Thank you so much!

  • @Bulborb1
    @Bulborb1 3 месяца назад +4

    Woww this is next level, Uncle Ben did it again!!

  • @jonascarvalhodearaujo8038
    @jonascarvalhodearaujo8038 3 месяца назад +3

    Let's goo on one more series 🚀

  • @literallyjeff
    @literallyjeff 3 месяца назад +4

    One of my favorite topics!

  • @kratos7334
    @kratos7334 3 месяца назад +2

    Awesome!
    Im not new to unreal and yet im learning a lot from you

  • @manonthedollar
    @manonthedollar 3 месяца назад +3

    Yesssss perfect timing!

  • @annechpostma-ddreams
    @annechpostma-ddreams Месяц назад +1

    Excellent tutorial with good clear instructions and explanation!

  • @hoverpillow6106
    @hoverpillow6106 3 месяца назад +3

    Pure gold, Ben.

  • @jamesrascal001
    @jamesrascal001 3 месяца назад +3

    Can't wait for more! I've been wanting to learn how to do this kind of thing for a while. Great vids as always.

  • @maxgordon3194
    @maxgordon3194 3 месяца назад +1

    thank you so much ben. youre literally the only instructor who taught every single thing with industry standard. after these can you do some cubemap based reflection detailed videos too?

    • @BenCloward
      @BenCloward  3 месяца назад

      Take a look at this one and let me know what else you'd like to know about the topic: ruclips.net/video/HA0xXiqxA54/видео.html

    • @maxgordon3194
      @maxgordon3194 3 месяца назад

      @@BenCloward awesome , damn I missed this video I guess. I will work with it a bit and see how it works for me thanks. you're awesome.

  • @pandajumper
    @pandajumper 3 месяца назад +1

    Uncle Ben is the Best!

  • @fleity
    @fleity 3 месяца назад +2

    New series wohooo. Let's go.
    This lends itself great to emergent programming imo, when nice stuff just happens by fiddling around. I always look for something magic when doing stuff like this (but not always reach it). This will be interesting. I hope you can cover a bit more than later on than just basic shapes, patterns that are very hard to draw manually (idk electrical traces etc.) :)

  • @da-mor
    @da-mor 3 месяца назад +1

    That's something I always wanted to try! Let's gooooo!

  • @mlecz
    @mlecz 3 месяца назад +2

    It looks like another series of great videos is coming up! Keep it up, Ben!

  • @VazP-qn8jo
    @VazP-qn8jo 3 месяца назад +1

    Such a great channel and super clear explanation, thank you!!!

  • @thedefaultcube1218
    @thedefaultcube1218 3 месяца назад

    @BenCloward. Thank you for sharing all this knowledge. Currently putting together my forst indie game and your experiences with shaders is the best ive found paid or free. I worried a bit with virtual textures and nanite foilage being a new thing, so im glad to see you starting a new series! LETS GO!

  • @controllerfreak3596
    @controllerfreak3596 3 месяца назад +5

    early on in my shader career, discovering that uv's were just gradients was a pivotal moment.

  • @dimscrawl4910
    @dimscrawl4910 3 месяца назад

    Really looking forward to this. Hope you cover more on the Blender side.

  • @yann6839
    @yann6839 3 месяца назад

    Very cool tips ! Their is a good optional alternative to " length( float2( ddx(a), ddy(a)) ", it's possible to use directly in the divide " fwidth(a) " but I think it's not exposed in Unreal nodes

  • @DillonBoucherDesigns
    @DillonBoucherDesigns 3 месяца назад +1

    This is awesome!

  • @beachc4397
    @beachc4397 3 месяца назад +1

    Amazing!!!

  • @xenolit3027
    @xenolit3027 3 месяца назад

    I think using the "smooth step" node also allow for masking out a gradient.

  • @OminoBusta
    @OminoBusta 3 месяца назад +1

    🔥🔥🔥

  • @mikechristiansen2000
    @mikechristiansen2000 3 месяца назад

    You could have provided a simple explanation of the derivative nodes and why this approach is superior to the step function. Otherwise great video and looking forward to the next in the series.

    • @BenCloward
      @BenCloward  3 месяца назад

      That's true. Although I already did a video on derivatives awhile back: ruclips.net/video/1HTMoCaY0xw/видео.html It's sometimes hard to decided when I should cover material again.

  • @gabrieltrujillopuente7979
    @gabrieltrujillopuente7979 3 месяца назад

    Awesome!

  • @JoeTheis
    @JoeTheis 3 месяца назад

    Super stoked for you doing an SDF series, Ben. I have some kind of allergy to using textures in my game so this seems like it might be a great option. Great video as always! Do you know if it's possible to integrate this approach with Unity's newer UIToolkit (as opposed to the old UGUI)?

    • @BenCloward
      @BenCloward  3 месяца назад +1

      UIToolkit does not yet have support for Shader Graph, unfortunately.

    • @JoeTheis
      @JoeTheis 3 месяца назад

      @@BenCloward ☹️ do you know if that is on the roadmap for anytime soon?

    • @BenCloward
      @BenCloward  3 месяца назад +1

      @@JoeTheis There are a lot of really big, amazing things in Unity's future that's I'm super excited to talk about, but it's probably best if I keep my mouth shut for now. :0)

    • @JoeTheis
      @JoeTheis 3 месяца назад

      @@BenCloward I'm glad to hear that, I'll keep my fingers crossed. I come from a web background so UIToolkit is a very valuable workflow to me.

  • @MichaelGaidamaka
    @MichaelGaidamaka 3 месяца назад

    🎉

  • @reigota
    @reigota Месяц назад

    Hi @Ben, amazing tutorials, I watching (and practing) each one of them! Amazing stuff.
    I have a question. You used (DDX/DDY) but could be used the STEP node to achieve the same result?

    • @BenCloward
      @BenCloward  Месяц назад

      Step could produce a similar result but with aliasing. The method I'm showing produces an antialiased edge.

    • @reigota
      @reigota Месяц назад +1

      @@BenCloward ohh... got it, thanks!

  • @mattacreates
    @mattacreates 3 месяца назад

    LOOOVE this series. I was just going down this road! QUESTION: In UE is there a reason not to use Ceil instead of the DDX, DDY method? Is it just another way to do the same thing or is there a reason we should be aware of to not to use Ceil? THANKS!

    • @BenCloward
      @BenCloward  3 месяца назад +1

      There are lots of ways of resolving a gradient or SDF to a line. The method I have demonstrated creates a perfectly anti-aliased line - regardless of camera distance or screen resolution. Using Ceil, Floor, or Step would also create a line, but it would not be anti-aliased. This will be more clear once we create the circle SDF in next week's video.

    • @mattacreates
      @mattacreates 3 месяца назад

      @@BenCloward k good to know thank you!

  • @stefevr
    @stefevr 2 месяца назад +1

    Hi Ben, thanks so much for making these!
    I have a question; what are the advantages of using DDX DDY compared to something like smoothstep? Are there usecases where one is more interesting than the other? I've always used smoothstep for AA but never thought about using derivatives
    Thanks a lot!

    • @BenCloward
      @BenCloward  2 месяца назад

      The DDX/DDY approach gives you a hard line with perfect anti-aliasing. It's resolution independent so the line is hard regardless of camera distance or screen resolution. With smoothstep, you can control the hardness of the line - so you could create a blurry line if that's what you wanted. Using smoothstep, you could also make a hard line, based on the values you use, but that hard line will become soft if you zoom in on it - and it will become aliased if you're too far away.

    • @stefevr
      @stefevr День назад

      @@BenCloward thanks so much for the detailed reply!! Sorry for replying late, i didn't get a notification

  • @roadtoenviromentartist
    @roadtoenviromentartist 21 день назад

    Dear Ben.. Do you know why are you substracting by 0.5? What is the reason sir?

  • @fleity
    @fleity 3 месяца назад

    Uhh the anti aliasing part is interesting! I've gained a bit of knowledge about this from the alpha to coverage article on medium by bgolus (incredibly recommend that one). Is there a good reason to not use ddxy directly?
    How many.. pixels of anti aliasing does this create? The technique in that article used a divide by fwdith (which is ddxy?) and got smoother with higher levels of msaa, is this true / controllable here somehow?

  • @JeffJeffMe
    @JeffJeffMe 3 месяца назад

    hey Ben, I'm curious about the anti aliasing section. Why not just using the `step` function?

    • @BenCloward
      @BenCloward  3 месяца назад +1

      This is such a great question that you’re about the fourth person who has asked it. 😀 It’s because Step doesn’t do anti-aliasing. We step every pixel would either be black or white. It’s hard to tell in this example I showed because it’s a perfectly vertical line, but it will be more clear next week when I show how to use it with a circle.

    • @JeffJeffMe
      @JeffJeffMe 3 месяца назад

      @@BenCloward I will be waiting to follow along 😄

  • @gatOlegat
    @gatOlegat 2 месяца назад

    i could be wrong, but i think i could achive exactly the same effect bby usimg step node. Connect any gradient to y and scalar parameter to x (or the other way round). This would reduce computation, instructions, etc, better for performance. Please correct me if i am wrong

    • @BenCloward
      @BenCloward  2 месяца назад

      You're not wrong, and your not the first to suggest using Step in the the comments here. Step will give you a sharp edge and it will be a bit cheaper. However, the disadvantage of using step is aliasing. The method that I show gives you a perfectly smooth, anti-aliased edge regardless of camera distance or resolution.

    • @gatOlegat
      @gatOlegat 2 месяца назад

      @@BenCloward Oh, i see, thank you for replying, i did notice some quality loss, i will do some research on that

  • @martinrichards1693
    @martinrichards1693 3 месяца назад

    I'm only sad it took so long to get to this as a topic. Unity isnt too bad but I've been banging my head against this kind of stuff for Unreal for longer than I'd like.

  • @sergiomendo77a
    @sergiomendo77a 3 месяца назад

    In blender we can create a smooth transition of black an white lines by splitting axis of UVs, multiply it by a number, ping pong it and then fraction it.
    This set up is the base for almost any texture but I haven't found how to do that in unreal engine, do you have an idea of how could we do that?

  • @mathiasjensen2841
    @mathiasjensen2841 2 месяца назад

    Why do you have to subtract 0.5 from the AA subnode?

  • @Mr.Mirage_YT
    @Mr.Mirage_YT 3 месяца назад

    Detailed PCG tut series when?😅

    • @BenCloward
      @BenCloward  3 месяца назад +2

      PCG is pretty specific to Unreal right now. I'm trying to keep my channel fairly engine independent. Although I recognize what a powerful feature it can be.

  • @steliosstavropoulos499
    @steliosstavropoulos499 3 месяца назад +1

    Why didnt you use step instead of ddx ddy?

    • @BenCloward
      @BenCloward  3 месяца назад +1

      Step would also work and it might be a little cheaper, but it wouldn't be anti-aliased.

    • @steliosstavropoulos499
      @steliosstavropoulos499 3 месяца назад

      @@BenCloward ooooh thats true... Thanks!!

  • @halogenic
    @halogenic 3 месяца назад

    is it necessary to use Pascal Case when naming Sub Graphs and Properties?

    • @BenCloward
      @BenCloward  3 месяца назад +1

      No - you can format your names however you want.

  • @emmanuelrenquin2567
    @emmanuelrenquin2567 2 месяца назад

    I wanted to replicate the setup in Blender. I managed to create the Linear gradient, but for the Anti aliasing I'm stuck at the DDX/DDY operation. I do not find any equivalent.

    • @BenCloward
      @BenCloward  2 месяца назад

      Those derivative nodes are very specific to real-time graphics. You can probably get by with using a Step node or Inverse Lerp node instead.

    • @emmanuelrenquin2567
      @emmanuelrenquin2567 2 месяца назад

      @@BenCloward Thanks for the answer. I'm just not sure I will continue in Blender. I'm afraid later shaders will use other specific nodes like those. Maybe I will try in Godot.

  • @Jukerlaw
    @Jukerlaw 2 месяца назад

    Hi Ben, I really appreciate the fantastic tutorial! However, I suggest splitting the video into chapters for the Unity and Unreal parts. It would make it more organized.
    Furthermore, I don't understand the part where you divide the length and use it as a subtrahend of 0.5 Could you explain it for me?

  • @blockout22
    @blockout22 3 месяца назад

    do you think you will ever include godot visual shaders to your videos to?

    • @BenCloward
      @BenCloward  3 месяца назад +5

      I've never used Godot, but assuming it has a decent node-based editor, you should be able to do everything I'm presenting here in that engine too. The goal of my channel is to be as engine-independent as possible. I'm trying to present techniques and principles that work in any engine. The reason I'm showing things in both Unreal and Unity is not because I want people to use those engines, but rather to demonstrate that the principles I'm sharing are not specific to one engine.

    • @blockout22
      @blockout22 3 месяца назад

      @@BenCloward godot visual shaders are probably closer to what unity have to offer with minor differences based on it's editor specifics. I do enjoy seeing multiple engine examples and how it's done in each one I also feel like it could help others and your channel to see godot content as the engine is increasing in popularity
      Also I find godot lacking a bit on youtube videos and your channel is great when it comes to explaining.