How much does it COST? - shortest path mask

Описание к видео How much does it COST? - shortest path mask

For anyone who wants to learn how to drive shockwave pattern fx with gradients running over meshes. Add me on Instagram: pclaesvfx

Hipfile: http://bit.ly/shortest_path_hipfile

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 [email protected]

Комментарии

Информация по комментариям в разработке