Saltar al reproductorSaltar al contenido principalSaltar al pie de página
  • ayer
BLENDER - Curve Modifier with Geometry Nodes (English)

Special Thanks for ErinDoes and Blender Bash who tought me how to do it.

Categoría

😹
Diversión
Transcripción
00:00Blender Operations Notebook number one. Curve Deform Modifier using Geometry Nodes.
00:07Curve Deform Modifier the traditional way. Let's demonstrate how to apply a Curve Deform
00:16Modifier to an object. Here, I increased the cube size along the y-axis by 20 units.
00:23I entered edit mode and made 20 cuts along the y-axis.
00:26Then I added a Bezier Curve, which will be used to deform the object. I scaled and edited this curve.
00:46I selected the object, went to the Modifiers menu, and added a Curve Deform Modifier.
00:52I selected our Bezier Curve as the Curve object. In this tutorial, we will use the y-axis for
01:00deformation. Done. Now the object will be deformed according to the shape of the curve along the y-axis.
01:11Now, let's show how to create this modifier using Geometry Nodes.
01:14In Geometry Nodes, there isn't a native node for this purpose, so we'll need to build it manually,
01:21and here we'll explain how.
01:22We'll need an object, in this case a cube that will be deformed, and a curve. Each point on the curve has a
01:38normal vector, in red, and a tangent vector, in green, both of which can be read directly. However,
01:48we'll need a third vector, calculated from the two previously mentioned ones, using a mathematical
01:53operation called cross product. Besides these vectors, we'll also need the position of each point
02:00along the curve. Geometry Nodes already has a node called sample, which directly reads position,
02:07normal, and tangent vectors of each point on the curve. The other required vector is perpendicular
02:13to the normal and tangent vectors, and is calculated using the cross product.
02:17The cross product vector is perpendicular to the plane formed by the normal and tangent vectors,
02:34shown in blue in the video. But how do we calculate this vector?
02:51No need to do it manually. Blender calculates it for you.
03:05Here we have a parallelopiped that will be deformed to match this curve.
03:14Each point of the parallelopiped along the y-axis corresponds to a proportional position along the curve.
03:21Each point along y will be positioned along the curve, considering the direction of the normal
03:33and cross product vectors at that point. To do this we'll map the x value of each object vertex
03:40to the normal vector of the corresponding curve point. The z value of each vertex to the cross product
03:46of that point. The y value will be mapped to the curve point's position.
03:52Let's see how this is calculated. We'll take one vertex as an example. This vertex has x, y, and z values
03:58in space. Its x value is multiplied by the curve's normal vector at a specific point. The result is
04:04added to the z value multiplied by the cross product. Then, this result is added to the curve point's
04:10position vector, corresponding to the vertex's y value. Each curve position is mapped to the parallelopiped's y-axis
04:16position, since in our example we're using this axis for deformation. Now let's demonstrate this with
04:22an example. Let's take this vertex with index 0 and position x equals 4, y equals 0, z equals negative 4.
04:30We'll multiply x equals 4 and z equals negative 4 by the curve's normal and cross product vectors
04:36at the corresponding point. At this stage we'll ignore the position vector.
04:43So we get these results, which we add together, producing the final result, the new position for this vertex.
04:54Now let's repeat this for the other vertices.
05:07You'll see that the object is aligned with the normal vector of the curve at each point.
05:16Now let's add the curve's position component to the calculation.
05:19Done. This section of the parallelpiped is now deformed and positioned according to the curve.
05:23Now we repeat for the rest. The next object section, further along the y-axis,
05:26will be repositioned according to the curve, and so on until the last vertex.
05:40Note, the object's size along the deformation axis must be normalized to 1. That is, regardless of
05:46its actual length along this axis, in this example it's 30 units along y, it must be scaled from 0 to 1
05:52for deformation purposes. How do we do this? Let's look at an example with a more complex object.
06:04There's a node called bounding box that reads the min and max vertex positions of an object.
06:15The bounding box encloses the object in a virtual box.
06:23Its size adapts to the object's dimensions, so it always knows where the edges are.
06:32Now, to normalize or compress this size into a range from 0 to 1, we use the map range node.
06:39Switch the map range mode to vector.
06:45In its vector input, connect a position node that reads each vertex's position.
06:50Then, connect the min and max outputs from the bounding box to the from min and from max inputs of map range.
07:03This way, all vertex positions will be remapped to a 0 to 1 range.
07:07Now that we have the tools, sample curve, cross product, bounding box, and map range,
07:20let's build the curve to form modifier.
07:31Enables wireframe view to better see the mesh edges.
07:36Enable geometry nodes workspace.
07:39With the cube selected, create a new geometry nodes node tree.
07:42We'll create a parallelepiped using a cylinder with 4 vertices.
07:55Set depth to 20 and side segments to 50.
07:58Add a transform modifier to rotate 90 degrees on x-axis and 45 degrees on y-axis.
08:16Use join geometry to connect the object to the group output.
08:20Now add a curve.
08:20We'll use a spiral in this example.
08:25Connect the curve's output to join geometry.
08:27Now insert the necessary nodes to normalize object size as explained earlier.
08:40Add a bounding box node and connect the object to it.
08:42Add a map range set to vector mode.
08:51Connect bounding boxes min to map range's from min and max to from max.
08:59Add a position node and connect it to map range's vector input.
09:07Add a sample curve and connect the curve to its curves input.
09:12Add a set position node on the object line.
09:27On the object line before join geometry, add a set position node.
09:31This will reposition the vertices.
09:40Add a separate x, y, z from the map range output.
09:50And connect its y output to the factor input of sample curve.
09:54This will associate object vertex y positions with the curve's points.
09:58Now we'll set up the vector math.
10:07Add two vector math, add nodes, and chain them.
10:10Add a cross product node to compute the perpendicular vector.
10:22Add a cross product node to compute the perpendicular vector.
10:35Add a cross product node to compute the perpendicular vector.
10:39Connect the tangent and normal outputs from sample curve.
10:44Connect the position output of sample curve to one add node.
10:51Add two scale nodes, vector math set to scale.
10:54Connect cross product to one scale and normal to the other.
11:07Connect each scale to the remaining add nodes.
11:13Connect each scale to the remaining add nodes.
11:24Now we need to get x and z values from the object's vertex positions.
11:28Add a position node followed by a separate x, y, z.
11:36Connect x to the scale with the normal vector.
11:47Connect z to the scale with the cross product.
11:49Now that the math is done, connect the final result to set position.
11:58Voila!
11:59Your object is now deformed into the shape of the spiral curve.
12:03Adjusting the to min and to max values in map range will change the deformations
12:08start and end points.
12:09You can add math nodes to smooth these changes.
12:19Imagine just type!
12:20You can add math to the curve as the wave.
12:21But� will change the whole round line,
12:24and there will happen the leakage.
12:26Now 최대 1 and 3.
12:29If you will Sóce for the loop forramer short curve.
12:32The97 you octagon can win the allса!
12:34Loveā is just a dream set of evolve.
12:37It may be painful as anän if you want to Ke programa!
12:41Just a dream set of dream set of loss.
12:44Loveā is just a dream set of events!
12:45Starting with Blender 4.2, there's a Set Curve Normal node that allows you to change the curve's normal orientation.
12:58If you set it to zit up, the normals point towards zit, preventing twisting.
13:09In this example, we use the Y-axis for deformation, but other axes are also possible.
13:14For example, along the X-axis.
13:18To do this, instead of connecting the Y-value extracted from the map range to the factor input of the sample curve node,
13:27we're going to connect the X-value instead.
13:29And instead of multiplying the X-value by the curve's normal vector, we'll multiply it by the Y-value.
13:35And finally, we'll input values on the X-axis in the to-min and to-max fields of the map range,
13:43instead of using the Y-axis.
13:47Final tips. Here we have an object that will be deformed along a closed curve.
13:51In other words, a cyclic path.
13:53First, let's check whether the object's normal vectors are facing the correct direction.
13:58Go to the Overlays menu and enable the Face Orientation checkbox.
14:03If the object appears red, as shown here, the normals are pointing the wrong way.
14:08To fix this, go to the connection between the curve's normal and tangent vectors used in the cross-product operator and reverse the connections.
14:15Done. If the object appears blue, its normals are now pointing correctly.
14:19Here we can see that when the object reaches the end of the curve, even though it's closed and cyclic, it collapses.
14:26The same happens when it reaches the beginning.
14:29For a smooth cyclic movement without collapsing, we need to add a set spline cyclic operator after the curve and check the cyclic box.
14:39Then, in the line connecting the deformation axis to the factor input of the sample curve, we should insert a math operator of type modulo.
14:59Here, we use the florid modulo.
15:01The modulo value should be set to 1 since the factor ranges from 0 to 1.
15:06Done.
15:08With this, we have a smooth cyclic deformation.
15:12You

Recomendada