最短的路径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

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
谷歌翻译:
对于任何想要学习如何在网格上运行渐变来驱动冲击波模式fx的人。加我在Instagram:pclaesvfx

今天我想覆盖Houdini中我最喜欢的节点之一:最短路径节点。

第一:封闭测试几何。
我们使用rubbertoy(Flippy!)测试几何体,并通过将其转换为vdb(sdf)然后返回到多边形将其转换为防水网格。重新网格化后,我们有一个相当均匀的三角形拓扑。

第二步:选择根并计算成本。
选择一个或多个点并将其分组为“group_roots”。附加“查找最短路径”节点并将group_roots放在起始点字段中。关闭“输出路径”,因为我们只想计算成本属性。同时将计算设置为“从任意开始到任意结束”(如果您有多个根,这会将多个成本数组值组合成最小成本)。

第三:检查和理解成本属性。
在电子表格中,按成本属性对点进行排序,并注意根的成本值为零。成本表示从根部开始遍历网格的距离成本。如果网格是连接的,我们最终会得到一个覆盖整个网格的渐变。如果网格未连接且某些区域无法到达,则这些区域的成本值为-1。

第四:规范成本属性。
属性将成本属性提升为详细属性以获取成本的最大值,我们将其命名为:cost_max。在属性vop内部,我们可以通过将当前成本值与零和最大成本(cost_max detail属性)拟合来规范化属性。将结果连接到颜色值,以便我们可以在视口中看到灰度渐变,或者将其连接到彩虹渐变,以便我们可以更好地可视化属性的范围。绑定将标准化成本导出为“cost_n”。

第五种:将成本映射到帧值。
在属性vop中,我们将标准化成本重新映射到绝对帧值。最小值可以是第1帧,最大值可以是第100帧。我们可以使用这些值来触发冲击波。这些绝对成本值表示成本属性的时间表示。

第六:冲击波在表面上。
在另一个属性vop中,我们将’cost_absolute’作为最小输入和’cost_absolute + duration’作为最大输入之间的框架,输出范围映射在0和1之间。当我们将fit函数的结果输出到颜色时我们有一个很好的渐变穿过网格。它沿着网状物传播并很好地展开,它不会径向扩散。
我们可以将0到1的梯度运行到一个斜坡,在那里我们定义冲击波的轮廓。

第七:取代表面。
冲击波斜坡的输出可以驱动“沿正常位移”的幅度。您可以使用渐变来发射粒子,控制散布在其上的点的pscale。

八:艺术指导成本的变化。
在计算最短路径之前,我们可以创建一个“阻力”属性。我们创造了一种自定义噪声,可以产生高阻力区域(​​白色)和低阻力区域(​​黑色)。在路径成本选项卡上的最短路径节点上,我们可以将“阻力”指定为点成本属性(启用复选框)。一些区域现在将快速增长(黑色斑块),其他区域增长缓慢(白色斑块)。

NINTH:减慢鳍状肢的增长速度。
我们可以使用原始球体内部的点并将其移动到其中一个鳍状肢附近。为球体指定粉红色,属性将此粉红色转移到蓝色表面。这给出了粉红色到蓝色的渐变。在属性vop中,我们可以将红色通道中的值添加到现有的Resistance属性中。当我们查看最终输出时,我们发现成本波在跳跃器上最后传播。

第十条:回顾最重要的部分。
基于渐变的操作的有趣效果。最重要的部分是成本属性并理解​​它的作用。 Resistance属性在遍历网格时调整成本。

For business or one-on-one visual effects consulting inquiries, you can reach me at peterclaesbusiness@gmail.com

说点什么

avatar
  想得到该评论有新回复的通知?  
提醒