1
$\begingroup$

I have several deformed guide hair strands. Their Point Positions before and after the deformation are stored to the Named Attributes Original and Deformed. How can I transfer the deformation data from the nearest splines to another hair system? The ideal solution would include a smooth interpolation of the target hair between guide splines.

I have to use Blender 3.3 Geometry Nodes.

enter image description here

$\endgroup$
4
  • 1
    $\begingroup$ Wouldn't it be easier to use the hair guides and add interpolated children with a modifier? Blender 3.5 would be better suited for this purpose. $\endgroup$
    – Blunder
    Jun 16, 2023 at 10:34
  • $\begingroup$ Thanks. It would, but for external reasons I have to find a way to make it in Blender 3.3 and use existing guides and hair. In the project I'm working with the hair strands shapes don't match guides shapes, and I need to transfer only deformation vectors, not shapes. $\endgroup$ Jun 16, 2023 at 11:06
  • 1
    $\begingroup$ I see. What defines the area of influence that each guide has on the surrounding children? What do you mean by "deformation vectors"? Is it the difference between the original and deformed position for each control point? $\endgroup$
    – Blunder
    Jun 16, 2023 at 17:13
  • $\begingroup$ Yes, by deformation vectors I mean the difference between the original and deformed position of the guides. The answer of @AndréZmuda shows very well how the system looks without interpolation between guides. The area of influence of each guide is not quite obvious. I see how to limit it by distance from each guide, leaving strands in between unaffected. But I think bilinear or trilinear influence interpolation between several nearest guides would do much better if it is possible. In Python it could be done fairly easily, but I can not figure out how to implement it in Geometry Nodes. $\endgroup$ Jun 16, 2023 at 20:49

2 Answers 2

1
$\begingroup$

Interpolating Solution

This solution realizes the interpolation and is based on blender 3.3.8. It has still some drawbacks: All splines need to have exactly 8 control points, that are ordered in the same sequence in every spline. It is possible to adopt this solution to a different count of control points, but you would have to modify the node net.

3d result

The basic idea is, to use the nearest face interpolation of the Transfer Attribute node for the interpolation of the deformation. This interpolates an attribute on a face based on its value of the corresponding vertices. Thus, we need a mesh with one vertex at the position of each Guide.

As we have 8 control points per Guide and per spline, we need to interpolate 8 sets of displacement vectors – 1 displacement vector for each Guide. We could use 8 different attributes for it. I decided to use 8 different meshes, instead.

How does it work

The following image shows the main node setup. This processes each set of displacement vectors separately. This mesh uses two group nodes, that are explained below. The one on the left side creates an interpolation mesh, as mentioned above. The one on the right side modifies the position of the control points of the target geometry.

node setup

Interpolation Mesh

The following image shows the node setup of the New Interpolation Mesh group node. It takes two parameters as input:

  • Control Point Level -> This defines, which point of each spline should be modified.
  • Guide Splines -> The guiding splines.

New Interpolation Mesh group node

The mesh will be generated in the lower frame. This creates a grid and places all its vertices on the nearest guide position. Finally, the mesh is reduced to the count of splines and the corresponding spline ID is transferred to each vertex of the mesh. There may be setups, where the grid needs a higher resolution. For this example, it was enough, to create a grid of Spline Count x Spline Count vertices.

The upper frame exposes the displacement vector of the control point, selected by the Control Point Level input for every vertex of the mesh.

The image below shows the Modify Control Point group node. It takes the splines, that should be modified, an Interpolation Mesh and a Displacement vector.

Modify Control Point group node

This group node iterates over the control points of all target splines, selected by the Control Point Level. Then it uses the Nearest Face Interpolation, to get the desired displacement vector and move the current control point.

$\endgroup$
1
$\begingroup$

Nearest Spline Solution

This solution does not interpolate; it only transfers the deformation data from the nearest spline. Furthermore, this solution expects all splines to have the same number of control points. Currently this is hard coded. But different from the Interpolating Soltion one may parameterize the number of control points and read it from a spline or add a group input for it.

Additionally, this solution is made in 3.5, so there is mapping to the old nodes left to be done. Mainly the new nodes need to be replaced by Transfer Attribute nodes. Currently I don’t have 3.3 installed.

result in 3d

node setup

How does it work

We start with saving the ID of the closest guide spline to every target spline.

nodes for saving the ID of the closest guide

Sadly Sample Nearest does not support Splines. Thus, we need to convert the splines to a mesh and capture the spline IDs before.

Now we can modify the positions of the control points of the target:

nodes for modifying control point positions

This is close, to what you did. Only, we need to calculate the index:

nodes for calculating index

As already mentioned in the beginning, we expect every spline to have the same number of points. This allows us, to calculate the index of the corresponding control point of the closest guide. By multiplying the ID of a guide with the number of points in a spline, we get the ID of the first control point of this guide. Adding this to the local spline ID of the current control point, gives us the corresponding control point of the guide.

$\endgroup$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .