How much does it COST? - shortest path mask

Поділитися
Вставка
  • Опубліковано 25 жов 2024
  • For anyone who wants to learn how to drive shockwave pattern fx with gradients running over meshes. Add me on Instagram: pclaesvfx
    Hipfile: bit.ly/shortest...
    Today I want to cover one of my favorite nodes in Houdini: the shortest path node.
    FIRST: Closed test geometry.
    We use the rubbertoy (Flippy!) test geometry and turn it into a watertight mesh by converting it to a vdb (sdf) and then back to polygons. After remeshing we have a fairly even triangulated topology.
    SECOND: Select the roots and compute the cost.
    Select one or more points and group them as your 'group_roots'. Append the 'Find Shortest Path' node and put the group_roots in the start points field. Turn off 'Output Paths' as we only want to compute the cost attribute. Also set the calculation to 'From any start to any end' (this will combine multiple cost array values into the minimum cost in case you have multiple roots).
    THIRD: Inspecting and understanding the cost attribute.
    In a spreadsheet sort the points by the cost attribute and notice that the cost value of the root(s) is zero. The cost represents how much it costs in terms of distance to traverse the mesh starting from the root(s). We end up with a gradient that covers the entire mesh if the mesh is a connected. If the mesh is not connected and some areas are not able to be reached, then those areas would get a cost value of -1.
    FOURTH: Normalizing the cost attribute.
    Attribute promote the cost attribute to the detail attribute to get the maximum value of the cost, we name this: cost_max. Inside of an attribute vop we can normalize the attribute by fitting the current cost value between zero and the maximum cost (cost_max detail attribute). Connect the result to the color value so we can see grayscale gradient in the viewport, or also connect it to a rainbow ramp so we can visualize the range of the attribute better. Bind export the normalized cost as 'cost_n'.
    FIFTH: Map cost to frame values.
    In an attribute vop we remap the normalized cost to absolute frame values. The minimum can be frame 1 and the maximum can be frame 100. We can use these values to trigger a shockwave. These absolute cost values represent the temporal representation of the cost attribute.
    SIXTH: Shockwave over the surface.
    In another attribute vop we fit the frame between 'cost_absolute' as the minimum input and 'cost_absolute + duration' as the maximum input, the output range is mapped between 0 and 1. When we output the result of the fit function to the color we have a nice gradient that runs through the mesh. It travels along the mesh and nicely spreads out, it is not radially spreading out.
    We can run the 0 to 1 gradient to a ramp where we define the profile of the shockwave.
    SEVENTH: Displacing the surface.
    The output of the shockwave ramp can drive the magnitude of a 'displacement along normal'. You can use the ramp to emit particles, control the pscale of points that are scattered on top of it.
    EIGHT: Art directing the variation in cost.
    Before computing the shortest path, we can create a 'resistance' attribute. We create a custom noise that creates areas of high resistance (white) and areas of low resistance (black). On the shortest path node on the path cost tab, we can specify 'resistance' as the Point Cost Attribute (enable checkbox). Some areas will now grow quickly (black patch) and other areas grow slowly (white patch).
    NINTH: Slow down the growth on the flipper.
    We can use the point inside of a primitive sphere and move it nearby one of the flippers. Assign a pink color to the sphere and attribute transfer this pink color onto the blue surface. This gives a pink to blue gradient. In an attribute vop we can add the value from the red channel to the existing resistance attribute. When we look at the final output we see that the cost wave travels last over the flipper.
    TENTH: Recap most important parts.
    Fun effect for gradient based operations. The most important part is the cost attribute and understanding what it does. Resistance attribute to modulate cost as it traverses the mesh.
    For business or one-on-one visual effects consulting inquiries, you can reach me at peterclaesbusiness@gmail.com

КОМЕНТАРІ • 67

  • @yehonataniiii
    @yehonataniiii Рік тому

    Thank you for teaching us the hidden ways of houdini! You are a great teacher!

  • @Mr_Ponzo
    @Mr_Ponzo 5 років тому +16

    Im amazed of how much I learnt with this tutorial. Love the way you explain things.

    • @peterclaes5918
      @peterclaes5918  5 років тому +2

      That’s great to hear! I’m happy that you are learning a bunch!

  • @pixelfound
    @pixelfound 4 роки тому +1

    I always wondered about creating this effect on a mesh!
    Tried using UV, point groups, attribute painting and what not!
    THANK YOU SO MUCH FOR SHARING! AS A BEGINNER I LEARNT A LOT!

    • @peterclaes5918
      @peterclaes5918  4 роки тому +1

      Great to hear that!
      Good luck on your journey!

    • @pixelfound
      @pixelfound 4 роки тому +1

      @@peterclaes5918 Thank You so much!

  • @cgchameleon7567
    @cgchameleon7567 Рік тому

    Such a legendary teacher! Thank you very much.

  • @xrossfader
    @xrossfader 2 роки тому

    You make it so accessible. Thank you.

  • @utubeparpankaj
    @utubeparpankaj 3 роки тому +1

    Highly knowledgeable stuff man.Pls create more Tutorials .:).Cheers...:)

  • @jaaypeso
    @jaaypeso 4 роки тому +1

    I just stumbled onto your page and I loved this tutorial and your clear teaching style which is great for an intermediate user like me. I learned a ton and subscribed. Please keep teaching as I will watch your other videos as well.

  • @g_rant_
    @g_rant_ 5 років тому +1

    Another really great one. So much information and so good. Please keep them coming, they are great and presented really well!!

    • @peterclaes5918
      @peterclaes5918  5 років тому

      Glad you like them! Next one will be released in the coming days!

  • @arnaudgiretphoto
    @arnaudgiretphoto 5 років тому +3

    Mapping space over time... that is just amazing. When i saw this happening i had like a bug to conceptualise it, and it is amazing !
    Really super structured well temporised and explained and straight to cam > it's unique. Keep on, that's so cool /

    • @peterclaes5918
      @peterclaes5918  5 років тому +1

      Glad you liked it. At the end of the day it is ‘just data’ and we apply our concepts of space, time, color, normals,... to interpret that data in different ways. Another fun one to try is to rotate a color in the same way you would rotate a normal.

  • @travislrogers
    @travislrogers 3 роки тому

    Really great tutorial! Well explained. Thanks for this!

  • @ilirbeqiri
    @ilirbeqiri 10 місяців тому

    4 years too late, but thank you for explaining it in a way that makes sense.

  • @HyukLee-o6v
    @HyukLee-o6v 4 роки тому +1

    so nice!! learned a lot. Thank u

  • @4rysc
    @4rysc 5 років тому +1

    Really great videos. Super at explaining and pleasant to listen to

  • @milad_savar
    @milad_savar 5 років тому +1

    super excited u come in the UA-cam Roll , please Keep up , you knowledge is so Strong , thx

    • @peterclaes5918
      @peterclaes5918  5 років тому +1

      Thanks & that’s great to hear.
      The next one will be online in a few days :). I’m trying for one per week at the moment. Laying down some foundational knowledge first.

  • @massimobaita7178
    @massimobaita7178 4 роки тому +1

    Thank You very much, Peter!

  • @blainklitzke6393
    @blainklitzke6393 4 роки тому +1

    Thank you for the share! Very helpful to have this walk through.

    • @blainklitzke6393
      @blainklitzke6393 4 роки тому +1

      Would love to hear more about arrays of cost and their usage. Thanks again, really great to find this information posted on the web in such an articulate manner. cheers!!!

  • @vinesun4699
    @vinesun4699 4 роки тому +1

    Great tutorial ! Thanks

  • @andreyluccahannes5377
    @andreyluccahannes5377 2 роки тому

    This tutorial is awesome! Such a great learning experience because it teaches a concept which you can apply to so much things and not just a particular effect. I would love to see some new tutorials ;)
    Thanks for teaching

  • @PawelGrzelak
    @PawelGrzelak 5 років тому +1

    Great tut.

  • @Dominic-du4ow
    @Dominic-du4ow 5 років тому +1

    Thank you for sharing this. It's very well explained, great advice and very useful as a learning process. Looking forward to more videos like this one.

    • @peterclaes5918
      @peterclaes5918  5 років тому +1

      I’m building a series of fundamental tools first and then I’ll probably cover combinations of setups for more advanced Fx.

  • @aboldmule
    @aboldmule Рік тому

    Amazing content, thanks for sharing.

  • @humayan91
    @humayan91 3 роки тому

    Amazing tutorial. Thank you :)

  • @antoniopepe
    @antoniopepe 4 роки тому +1

    thx. great explanation

  • @cmolfino
    @cmolfino 3 роки тому

    Great tip Peter! thanks for sharing. You mentioned how to calculate cost over not-connected geo... is that possible?

  • @floydafcg
    @floydafcg 5 років тому +1

    Great tutorial! Thank you for posting.

  • @Nitram-xw9ei
    @Nitram-xw9ei 3 роки тому

    Subbed! Great stuff.
    I'd love to try my hand at making this in VEX but that may take some time as I'm still a beginner! It's great to have the VOPs explanation in order to try and think through what the coding process would be.
    EDIT: I managed to create the workflow in VEX, just up to the main mask part. I kept it in three separate Attribute Wrangle nodes in order to keep it consistent with the video. I'll look into resistance part once I have more knowledge of using noise in VEX. Just in general, though, this is an amazing way to create animated masks and particle emitters and a million other things. Thanks once again.
    Cost_Normalized
    // Bring in the two attributes that were created in the nodes above. The cost and the cost_max.
    float c = f@cost;
    float cm = f@cost_max;
    // Normalize the cost by remapping it and the cost_max between 0 and 1
    c = fit(c, 0, cm, 0, 1);
    // Create a colour ramp using the normalized cost for visualisation purposes
    @Cd = chramp("colour_vis", c);
    // Create and promote and attribute called cost_n to be used later.
    f@cost_n = c;
    Cost_Absolute_Deform
    // Create our min and max variables
    float min = chf("min");
    float max = chf("max");
    // Bring in the normalized cost we just created.
    float cost_n = f@cost_n;
    // Refit the normalized cost to the range we set.
    float cost_absolute = fit(cost_n, 0, 1, min, max);
    // Create and promote and attribute called cost_absolute to be used later.
    f@cost_absolute = cost_absolute;
    Deform
    // Create our attributes
    float dur = chi("duration");
    float t = @Frame * chf("time_multiplier");
    float ca = f@cost_absolute;
    // Use the duration as an offset to the size of the mask
    float max = ca + dur;
    // Normalize the mask so we can put it into a ramp to further refine the shape.
    float mask = fit(t, ca, max, 0, 1);
    float ramp = chramp("edge_shape", mask);
    // Plug in the shape to the colour. Boom, mask.
    @Cd = ramp;
    // Move the P position by adding the normal to it.
    // The normals are controlled by the mask shape and also by an overall scale factor.
    @P += @N * ramp * chf("bulge_scale");

  • @electrich1
    @electrich1 5 років тому

    Insane tuts bro, thanks!! Hope u make one about cross product or other math topics, i watch ur dot product explanation and is amazing how ur examples are so clear, amazing work man

    • @peterclaes5918
      @peterclaes5918  5 років тому

      Hi Richard, it took a while, but I just published one on the cross product here: The Cross product: Theory (1/3) ua-cam.com/video/QWdbRHUd_gg/v-deo.html

  • @StephaneSOUBIRAN
    @StephaneSOUBIRAN 5 років тому +1

    Nice tut, thx you.

  • @theagileaardvark
    @theagileaardvark 5 років тому +1

    Really nice idea! I would have solved this problem with... the classic "infection solver". Another trick added to the "toolbox" in the head :) Thanks a lot!

    • @peterclaes5918
      @peterclaes5918  5 років тому

      Nice! Running a solver gives you more control as you could ‘jump gaps’ in the topology if you wanted, but if you have connected topology then the shortest path runs much faster than a solver.

    • @theagileaardvark
      @theagileaardvark 5 років тому

      @@peterclaes5918 Exactly. And in many cases, the added "features" of a solver-based solution aren't really necessary if you can get the same or visually very close result with a custom ramp curve and findshortestpath while saving quite a lot of CPU time as a free bonus :) If you don't have a connected topology you could always cobble up something from the original mesh for the spreading process and transfer the result back to the original mesh at the end. Thanks again, I never thought of this before.

  • @andremonteiro1434
    @andremonteiro1434 4 роки тому +1

    Thanks a lot Peter, truly it is a pleasure to learn with you.
    I am wondering how you can loop or create a cycle animation with this effect? I tried the solver sop to make the Cd attribute loop but no luck.
    Anyway, thanks a lot and keep it up.

    • @peterclaes5918
      @peterclaes5918  4 роки тому +1

      You would be using a modulo on your frame value. Eg: frame % 100 will return values that loop between 0->99

  • @PawelGrzelak
    @PawelGrzelak 5 років тому +2

    How come you can talk and create at the same time!? Unique skill man.

    • @peterclaes5918
      @peterclaes5918  5 років тому +3

      Thanks!
      I phrase what I’m thinking, and then my hands catch up to dropping the nodes in Houdini.
      I visualize the effect in my head first, then reverse engineer the steps to get there, see the node tree in my head and then I drop down the nodes in Houdini. If I would not be talking the speed goes up, but this is a tutorial and pacing is important when teaching.
      After doing this for over ten years, it’s more about the algorithm and setup and less about the individual nodes.

    • @PawelGrzelak
      @PawelGrzelak 5 років тому +1

      @@peterclaes5918 Still, it's an unique skill. Most of pro tuts have voice-over recorded later, as well as footage is all sliced and merged. Pacing is good too. The only thing that I could be better is the name of the video ;) More descriptive.

    • @peterclaes5918
      @peterclaes5918  5 років тому +1

      Thanks for the feedback, I’ve updated the title!

    • @PawelGrzelak
      @PawelGrzelak 5 років тому

      @@peterclaes5918 Much better;)

  • @MyLanista
    @MyLanista 3 роки тому +1

    Great tutorial! I was wondering if there is a way to make this work on an animated mesh. It seemed the mask was flickering which makes sense when the mesh is deforming the path is changing I guess?

    • @peterclaes5918
      @peterclaes5918  3 роки тому +1

      There is a way to do this if you have a stable point count.
      Use a time shift on the incoming animating geometry, set the frame to 1. This frame will become your ‘rest pose’. Then calculate the cost attribute with the shortest path on this rest frame.
      Then use an attribute copy, to copy the ‘cost’ attribute from the rest geometry onto the animating geometry.
      Then use your displacement deformer that is driven by the cost attribute on the animating geometry.
      Hope that makes sense!
      If you don’t have a stable point count, then it gets harder. You could create helper proxy geometry and compute cost on that. For example, you could wrap a sphere around the high res geo that you want, ray the sphere on the high res and try to make it ‘stick’ to the animating underlying geo.
      Eventually you can then perform an attribute transfer to transfer the cost attribute from the proxy onto the deforming high rez.

  • @probiner
    @probiner 5 років тому +1

    Nice vid, thanks

    • @peterclaes5918
      @peterclaes5918  5 років тому

      Thanks! Have fun creating gradients to trigger your Fx!

  • @kate2326
    @kate2326 3 роки тому

    Is it possible to delay path start times for time-dependent points?

  • @demonhunter4709
    @demonhunter4709 5 років тому +1

    Thanks again😇

  • @boole_cat
    @boole_cat 4 роки тому +1

    Super

  • @jluisroga
    @jluisroga 5 років тому +1

    Nice title! Lol Thanks for your insights

    • @peterclaes5918
      @peterclaes5918  5 років тому +1

      I’ll cover some finance and investing related advice in the future on a second channel :). Different kind of cost.

  • @salil808
    @salil808 6 місяців тому

    why did you promote the cost to a detail attribute?

    • @peterclaes5918
      @peterclaes5918  6 місяців тому

      The goal is remap the attribute between the minimum and the maximum value. Have a look at the values in the geometry spreadsheet.
      At the point level cost is all unique values, but at the detail level there is only one 'cost_max' value as there should only be one maximum value. I want to store this maximum value once (at the detail/object level) vs storing that same value on all the points. If a value is the same for all points or all primitives, it is more memory efficient to store it as a single data value at the detail level.
      Then we remap the point cost value between the minimum (a value of zero) and maximum so we get a nice range between 0 and 1. This is 'normalizing' the attribute. The 0 to 1 range is easier to work with.
      Since this attribute normalizing operation is such a useful thing, the Sidefx Labs team made a tool for it 'attribute_normalize_float'. You can take a look inside of that as it also does the data promotion to detail, both for a minimum as well as a maximum value.

  • @kiranirugalbandara1908
    @kiranirugalbandara1908 5 років тому

    Really amazing tutorial . Only problem is your titles ! Atleast add "in Houdini" to the end

    • @peterclaes5918
      @peterclaes5918  5 років тому +1

      Thanks! I’d have to add ‘in Houdini’ to all my titles as the entire channel has Houdini videos, so instead I add it in the description and in the tags so people who are searching should be able to find it.

    • @kiranirugalbandara1908
      @kiranirugalbandara1908 5 років тому

      @@peterclaes5918 Your decision mate ! Anyways I'm lucky I found the channel , great content , keep it up !