Dissecting and Optimizing UE's Simple Grass Wind material function

แชร์
ฝัง
  • เผยแพร่เมื่อ 1 ก.ค. 2024
  • This is a different video than usual, here I'll go through UE's SimpleGrassWind function node by node, explaining what's going on and how it could be done better.
    It's just an opportunity to discuss few topics that are quite difficult to introduce in a standard tutorial, really.
    The website I used to see the compiled shader is shader-playground.timjones.io/
    Discord: / discord
    Patreon: / visualtechart
    00:00 - Intro
    01:33 - Function Walkthrough
    04:25 - Function Optimization
    11:42 - Function Result Analysis
    12:42 - Next Video Topic

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

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

    This video is fantastic! I think I might want to pivot around the object's origin with a multiplier based on vertical distance from the origin so the tops of the grass blow more than the bottom.

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

      Yeah, that would result in a nice enough motion :D The only issue I may see is that it wouldn't preserve the mesh length throughout the bending

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

    you are so professional, thank you

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

    This is timely as I'll be doing tree shaders soon :D

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

    Here early! Will watch this later

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

    The simple grass wind always looks like everything‘s under water. If you want to create realistic wind motion, you need to push the whole object (minus vertices that are „attached“ to the ground) in the wind direction and then after it passes a threshold, let it swing back to 0. I used the rotate about axis for that. With the per instance random and a multiply, you can get rid of the synced motion. After that we need some secondary movement for the details, for that you could actually use the simple grass wind in a super subtle way, however there are much simpler ways of doing so, for example using a texture based approach.
    This approach doesn’t really work with clustered grass meshes and is best used with single small patches of grass or taller plants where everything is near the pivot on x and y.
    Great Video!

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

      You definitely did your homeworks man :D I agree with you! Looks like your approach would lead in a more than decent result, I probably would try to not rely on textures at all though. And maybe for grass patches some baking could be used to retain the single grass blades position, etc ;)

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

      @@VisualTechArt Yeah true, using textures could also lead to some weird choppy movement (pixels to vertices), also saving the extra instructions is nice^^ Textures are useful if you want to handcraft exactly how the grass should behave. In my most recent attempt I use time with a sine and a vertex color gradient for additional wind detail. The gradient has multiple uses: Fake ambient occlusion, masking out the wind effect where the grass is connected to the ground and the extra wind detail.
      Also regarding the rotate about axis method above, the curve of the vertex color gradient could be modified to create different effects. Smooth for wind and an abrupt falloff if the grass was damaged by the player…

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

      @@QuakeProBro Yes, there's an endless amount of possibilities :D

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

    I just tried dissecting the simple wind node, and found myself utterly confused -- thanks for the clarification!
    Also I cannot understand why they by default have an Append node not fed into anything right before RotateAboutAxis lol

  • @cmds.learning7426
    @cmds.learning7426 2 ปีที่แล้ว +1

    cool

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

    There might be a reason to use multiple instructions instead of sin: if there are much more execution units which can calculate the longer code than units calculating sin/cos, then it can be faster to use multiple instructions, as the trigonometry unit can become a bottleneck.

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

      I see, I didn't consider that! Thank you :D

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

    is that shader playground a website? It doesn't seem to want to work right in my chrome or edge, are you using an app?

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

      It is the website, if you're using the last Radeon compiler, last time I checked it was broken :)

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

      @@VisualTechArt oh it's working now, maybe it was under maintenance at the time or something

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

    Pivot Painter 2 is very useful to make those animations look realistic!

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

      But, it's hard to generate a PP2 without going in 3DSmax to generate texture map :(...Maybe PP3 will make it easier in the future?

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

      @@fddesign there is a pretty good blender add-on that's working for 3.0 I think

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

      @@schrottiyhd6776 Do you know a great and simple tuto about this? Or a link to the addon?

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

    [SM6] (Node RotateAboutAxis) Cannot cast from smaller type float2 to larger type float4. ue5.1

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

      You're plugging in a node that has only RG into a pin that accepts RGBA, can you pin more precisely when/where are you getting that error? :)

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

      @@VisualTechArt 4:43, Mask RGB -> Mask RG into Normalize results in the error the comment made.

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

    Can you share the new function file so we can replace it?

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

      I sometimes do share stuff, looking to do more of it in the future :)

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

    整挺好!

  • @Maniac-Design
    @Maniac-Design 2 ปีที่แล้ว

    I always found Simple Grass Wind not realistic at all, the best is to use pivot painter 2 in addition to an additional wind movement, even if you do stylized style, a good wind system makes the difference visually.

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

      Yes! Pivot painter is definitely a good tool :D

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

    I've never hated a shader more than Unreal's grass wind. The guy who wrote it should be forbidden from ever creating shader effects again.

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

      could be wrong, but we've had the same simple wind node since UDK xD

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

    first of all, I am not a fan of the original function, it just don't look good at all.
    the so-called optimizations you did there are just mambo jumbo. the only really effective thing was the cutting of the z- component of the calculation. the rest had little to no effect.
    I would have gotten rid of the rotate about axis node first. this is by far the most expensive operation in the function.
    also don't use const bias it cost one instruction more than just doing the range remapping with mult and (neg) add.

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

      I actually pointed out that stripping the Z component was the most effective thing :)
      As I pointed out when I was doing something to make the function more flexible and/or readable.
      How would you have rewritten the rotation without the RotateAboutAxis?
      And why you say that about the ConstBiasScale? In shader toy (not displayed in the video) I tryied remapping with both MultAdd and AddMult. While the instructions called were different, the clock cycles didn't change... Unless the ConstantBiasScale does something more other than AddMult, but it isn't the case as far I know