Unreal Engine 5 Tutorial - Technical Shading - Introduction To HLSL

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

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

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

    Your style of teaching in this video is beyond valuable for anyone learning this concept for the first time. Excellent work!

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

    This video is incredible.
    I've been using Unreal's shader graph since UE3 and UDK and I'd say I've been doing it at a decently high level.
    However, I've always had a fascination with HLSL and just never known where to even start with it!
    Thank you for not only making it easy to understand, but actually showing a great starting point for a workflow to translate between the graph and code.
    10/10. Would recommend.

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

    Custom HLSL nodes open up a few things that simply can't be done through standard nodes in the material system. You can also use them to pull off some fun hacky things that you wouldn't think the engine would let you do. I cant wait to see what else you're going to cover :)

  • @jiiiiim_xyz
    @jiiiiim_xyz 2 หลายเดือนก่อน +1

    That was exactly what I've been trawling youtube for. So many materials tutorials are just joining nodes together with zero explanation. This was such a great and well explained introduction :) I'll be watching all your videos.. And I'll add you to my IOU list once I manage to finally get a job (unemployed right now so I can't join the Patreon just yet).. But I intend to support all the people such as yourself who are making this learning journey possible.. Thanks!

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

    Nice soft intro to using HLSL in Unreal. Thanks for sharing!

  • @mattacreates
    @mattacreates 3 หลายเดือนก่อน +2

    This is awesome! Sine is actually from -1 to 1 for everyone who may have run into issues experimenting. Use a ConstantBiasScale to adjust it to 0 to 1 or add 1 divide by two . Doing that messes with the above results though but just an fyi.

    • @renderbucket
      @renderbucket  3 หลายเดือนก่อน +1

      That ConstantBiasScale is a really good tip!
      I have a correction in the description about the range of sin. But for some reason that correction isn't popping up on the video. When using those values as a mask it usually wont matter if its -1 or 0 vs 1 or 100 it will produce the same output. But It is much more proper to use the ConstantBiasScale as you mentioned or at least throw a Saturate or Clamp node on the sin curve to clamp it between 0-1.
      Thanks for suggesting this.

    • @mattacreates
      @mattacreates 3 หลายเดือนก่อน

      @@renderbucket Oh cool! Sorry I didn't see it. I just subscribed to your patreon. This content is great!

  • @lukasmerten7697
    @lukasmerten7697 11 หลายเดือนก่อน

    This topic is finally exactly what I looked for, thank you

  • @IstyManame
    @IstyManame 4 หลายเดือนก่อน +1

    You're genuinely a great fucking teacher i appreciate the effort that went into the video it made it so much easier to understand than reading random HLSL tutors lol

  • @glitchysparx
    @glitchysparx หลายเดือนก่อน

    You are the best, man! So interesting and clear lesson. Thank you so much!!

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

    Fantastic, I'm going to watch all these videos. Just what I was hoping to learn!

  • @rifat.ahammed
    @rifat.ahammed 11 หลายเดือนก่อน

    Man you are the great. I was looking for videos like this. Thank you very much buddy .

  • @lemonxorp7985
    @lemonxorp7985 8 หลายเดือนก่อน

    A really impressive tutorial.

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

    This is the best tutorial about HLSL for Unreal Engine in the WORLD! ​Khan Academy level, thanks !!

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

    Yes, please more of these videos.

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

    This is right the thing I’ve been searching! Thank you for your work!

  • @DeviateMonster
    @DeviateMonster 9 หลายเดือนก่อน

    Great tutorial mate, easy to follow

  • @suraj.1889
    @suraj.1889 9 หลายเดือนก่อน

    Thank you very much for this tutorial!

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

    The sine node is from -1 to 1. Unfortunately this can be confusing when you just want a value to go from 0 to 1 as the time it takes the sine to come back up to 0 from -1 means that the colour black will be there longer than the colour white.
    You probably already know this but just incase someone else needs to know: After sine, put an add node with a value of 1 and then connect a divide node with a value of 2. This ensures the pulsating value stays between 0 and 1.
    What you will then need to do with the step node after subtract is have a value of 0.05 instead. Otherwise the sliding effect will only go 50% of the way with the value of 0.5 as stated in the video.
    For the custom node I figured out it would be this (I'm still extremely new to this so it took a while to learn where +1 and /2 would go lol)
    return(step((ceil(uv*10)/ 10)-(sin(t)+1)/2 ,0.05));

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

      Thank you for posting this! that is correct.
      It is going to -1 to 1, but In this video I incorrectly called it as 0.
      When plugging the sine into the alpha of a lerp it will get clamped out at 0 (black) so anything lower than that won't make any difference. But this clarification you posted I'm sure is very helpful to others to understand the math correctly.

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

      @@renderbucket Ah I didn't know that about the lerp clamping the sine. I should give this a test thank you :)

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

      Is this the reason why in the video the animation always paused for a second when 100% red or 100% blue?

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

      @@zombi1034 Yes

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

    your tutorials are very pleasant to watch, very big thanks to you, i am learning a lot!

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

    Very cool, nice work and thanks for sharing. Stay safe out there.

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

    This is so much helpful! The explanation was very simple to understand

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

    i love you work man !!!

  • @Da-rPo03
    @Da-rPo03 2 หลายเดือนก่อน

    FWIW, in 5.4, it looks like you can adjust the UV tiling on the Texture Coordinate node.

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

    Great video, nice and clear!😍

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

    thanks for the vid! more HLSL pls!

  • @DRockafella
    @DRockafella 6 หลายเดือนก่อน

    Good morning Mr ​ @renderbucket , in your example you had Sine with a Period of 3. How would this translate into the Custom Expression?
    I tried to multiply sine by 3, eg: (3sin(t)) but that clearly is not the answer as it just broke the effect. Then I tried 3*sin and while that does not break the effect it does not have the same effect on the timing as the example with the Sine Period of 3?
    This probably is not a big deal at all, but my small brain is just trying to follow along as best I can.
    Thank you for these tutorials.

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

    Nice!!! Thanks for excellent and clear tutorial!!!~🤩

  • @dmytrobielyi4026
    @dmytrobielyi4026 9 หลายเดือนก่อน

    Great stuff! Thanks for such detailed explanation. One question - is there a way to keep HLSL code as file outside the custom function? Can't find relevant information on that topic.

  • @K0UK0U
    @K0UK0U 7 หลายเดือนก่อน

    thank you

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

    great content

  • @豪大帝
    @豪大帝 4 หลายเดือนก่อน

    thank you!!!!!

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

    Awesome!

  • @gendalfgray7889
    @gendalfgray7889 4 หลายเดือนก่อน

    When to use HLSL? What advanteges? I know it can do for loops, but don't know rest.

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

    Awesome video! but there are two thing I didn't quite understand: How does the written function node knows you want to do It on the x axis instead of the y of the UVs? And at 14:23 you altered the sine period value on the node so It fills slower, but I didn't see that being specified on the written counterpart , how did It go at more or less the same speed as the node version?

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

      Great questions!.
      So for the first thing, the blocks revealing go left to right because when we use the break out float2 components we are only using R (Red/X). So that gives us a gradient in X axis, which then when we subtract a value going from White to Black it reveals and hides values on the X axis going from 0-1 produce the horizontal animation. If we were to use the G (Green/Y) value instead when breaking our float2 components then it would be Up and Down.
      For the sine period modification, the sine node in Unreal is a bit odd because it defaults with a period of 1.0. When normally its 2 * PI (3.14...)
      If you are not using a sine node in Unreal and instead HLSL Code and you want to modify the period in HLSL code you will have to achieve a similar result by doing something like
      sin(x * (1/p) * 2 * 3.14);
      Where x is what you are connecting the sine node to inputting into the sine node.
      Where p is your period value (so 1 if you want it to match unreals period default of 1).

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

    A little bit off topic but I would like to see a conversion of something that runs on tick into c++ since in one of the conferences about optimization in the unreal fest they said anything that ticks run 10x times faster when converted into c++, so I think is a must have for everyone, I mean, 10 times is too much performance and there are a ton of things that run on tick.

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

      Not sure exactly what you may be referring to, but generally a tick is a cycle. Often referred to as a frame when people mention stuff like do this every "tick".etc
      What they might be referring to is certain code/things may run much faster in C++ than through blueprints or alternative ways of doing things. There also may be the case sometimes were its the opposite. I would need a bit more details to fully comment, but generally C++ is a very low level language so its performance is often much higher than other languages like python.etc

  • @tryit2136
    @tryit2136 6 หลายเดือนก่อน +1

    5:58 hey isnt GREEN is vertical 0 to 1 top to down while RED horizontal 0 to 1 left to right?

    • @DRockafella
      @DRockafella 6 หลายเดือนก่อน

      Green (U) goes horizontal across the x axis as you can see it starts on the left (and moves across to the right). Red (V for vertical :P ) starts from the top (where you can see it) and fades down the y-axis, vertically.
      Hope that helps.

    • @tryit2136
      @tryit2136 6 หลายเดือนก่อน

      @@DRockafella no sir,U is RED and represents the horizontal direction, while V is GREEN and represents the vertical direction. Just component mask out any channel, and you'll see the b/w gradient in 0-1 direction.

    • @tryit2136
      @tryit2136 6 หลายเดือนก่อน

      @@DRockafella if u look closely, green horizontal only hue is changing not the value.

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

    You're awesome!

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

    Fantastic videos!
    I wanted to ask since I've become increasingly interested in Shaders. Should I master the Material Editor and all its functions/nodes before I jump into HLSL? Or would it actually help me learn Material Editor better if I already had some HLSL knowledge

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

      Don't wait, if you're interested in HLSL learning even just a bit of it will help you understand how to use nodes in the material editor in any game engine.
      Remember even with nodes, you are just writing HLSL or shader coding but in a more visual way. Sometimes it's easier, sometimes it's faster, and sometimes writing HLSL is easier and quicker.
      Any sort of technical shading challenge will benefit greatly from HLSL and various graphics programming techniques. I'll also highly recommend GPU Gems, a book that's old but still very relevant. You can google it and Nvidia has it online for free. Would recommend it as more technical guide on various techniques.
      Good luck with your learning! And when you make cool stuff please share with us and join the Discord!

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

      ​@@renderbucket I appreciate you taking the time to write such a helpful and constructive reply! I will definitely begin learning HLSL then! :) Its something I am quite interested in but feel a little intimidated by it. I have basic programming skills (C++ and C#) so hopefully it transfers over well 😅I will definitely be joining the discord to see shader lovers out there.
      And thanks for the book recommendation, awesome that its free online!

  • @段sjdj
    @段sjdj ปีที่แล้ว

    Does UE4.26 run these tutorials correctly?

  • @ThadeousM
    @ThadeousM 3 หลายเดือนก่อน

    Does HLSL provide performance benefits over nodes?

    • @renderbucket
      @renderbucket  3 หลายเดือนก่อน +1

      Not really, if you can do the same thing with Nodes. Probably better to do it with Nodes in most cases. Some of the nodes in Unreal are really just using HLSL if you go into them.
      But there are many things you can do with HLSL that aren't possible in Nodes in Unreal.
      It also sometimes can be way easier to do things with code than tons of nodes.
      So its really more of compliment to working with nodes for the basic/intermediate side of things.
      And on the very advanced end of things you can go as far as creating compute shaders or fully custom materials.
      HLSL is also not just a Unreal thing it can be used in Unity or any other Game Engine running on DirectX. It is also very similar to GLSL, so learning one or the other you kind of learn both.

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

    Is there something wrong about the direction? at around 5:45

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

    Nice video, thanks. Shouldn't Sine node output be going -1 to 1, not 0 to 1 ?

    • @suraj.1889
      @suraj.1889 9 หลายเดือนก่อน

      ohhhhhhhhhhhhhhhh!

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

    In general, does HLSL run more efficiently/use less instructions than implementing the same thing via nodes? I'm sure that's a big ol' "DEPENDS," but I figured I would ask. :)

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

      It does depend. Certain things you can only do in HLSL and not through nodes in an easy way. That's where HLSL is more efficient. A lot of the Unreal nodes also use HLSL inside them in custom nodes. Internally all of the materials in Unreal are HLSL code.

    • @lifeartstudios6207
      @lifeartstudios6207 หลายเดือนก่อน

      unreal will optimize away "same" shader instructions if the are done in material graph, but it doesn't do that for hlsl. Instead, you need to mark it yourself with things like #LOOP, #BRANCH, etc to tell the engine how to "unroll" the shaders.

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

    Why not "uv.x" but rather "uv" since we know which of the uv cordinates we need?

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

    So there is no type for variables?i mean uv is 2d vector and t is a float

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

      There is, but in this case since we are just making t and uv a variable that references to the input of our Custom node. It will just inherit whatever the Time node is (float) and uv (vec2/float2).

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

    Does the HLSL code run faster than the Node-based "Code"?

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

      Depends what your doing, for simple stuff its probably not much difference. For some things the nodes may be faster due to optimizations in Unreal. But the main thing is that certain things, like for loops you cannot do through Nodes. So your only option is to use HLSL in a Custom node or write a fully custom shader for Unreal.
      For more complex things eventually we will be referencing in external files instead of always just throwing updated code into our Custom Node.

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

      @@renderbucket Yea, I just did some research as well: The nodes get optimized by the compiler expect for the "custom"-node, so basicly no HLSL optimization. So in that case nodes should almost always be faster depending on what you do of course. Also you could modify the engine to make custom HLSL.

  • @TheReaper-xl7qp
    @TheReaper-xl7qp ปีที่แล้ว

    Hello, I am modding a game in a Custom UE 4.13
    Is there any chance you can provide me a script for these nodes
    Step
    Saturate
    Bosol
    and also I wanted to ask if it's possilbe to create our own Material Expression Nodes instead of using the Custom via Visual Studio and UE source