3
$\begingroup$

Using the Add Mesh: Extra Objects add-on, I have set up a group of XYZ Math Surfaces Add > Mesh > Math Function > XYZ Math Surface which generate various parts of a single mesh object, with one parameter 0 ≤ G ≤ 1 that controls the shape of the mesh. I want to achieve the visual effect of animating that parameter. Is this possible?

I tried using Shape Keys, but it isn't working how I expect. I created two separate mesh objects, one at each extreme of the parameter (G = 0 and G = 1). They should have identical topologies (i.e. the same number of vertices and the same arrangement of edges between vertices), differing only in the positions of the vertices. I selected both objects, went to the Shape Keys panel, selected the drop-down arrow, and selected "Join as Shapes", which created a Basis Shape Key and a modifier Shape Key. However, adjusting the "Value" slider for the Shape Key causes horrible distortions instead of a smooth transition. It seems like Blender isn't determining which vertices are equivalent between the meshes, resulting in many vertices that start next to one another ending up wildly separated, while other vertices that start separated end up becoming neighbors.

Is there a way to fix the Shape Keys setup? Or an alternative method to achieve the result I want?

XYZ Math Surfaces to Mesh

The setups for the XYZ Math Surfaces are as follows:

SoCW-Edge-Base-Aft
X equ: (g*f)/16*(6/1*(u**2 - v**2 - 2*(u**4 - v**4) - v*(4*u**2 + 1))/(2*u**2 + 2*v**2 + 1)**2) - (sqrt(6)/3*(1 - v)/sqrt(2*u**2 + 2*v**2 + 1))*f/2
Y equ: (g*f)/16*(6*sqrt(3)*(-u*(4*v**2 + 1))/(2*u**2 + 2*v**2 + 1)**2) - (sqrt(2)*(u)/sqrt(2*u**2 + 2*v**2 + 1))*f/2
Z equ: (g*f)/16*(6/sqrt(2)*(u**2 - v**2 - 2*(u**4 - v**4) + 2*v*(4*u**2 + 1))/(2*u**2 + 2*v**2 + 1)**2 - sqrt(2)) - (sqrt(3)/3*(1 + 2*v)/sqrt(2*u**2 + 2*v**2 + 1) - 1)*f/2
U min: -0.50
U max:  0.50
U stp: 72
V min: -0.50
V max:  0.50
V stp: 72
F equ:  2.00
G equ: [0.00 ↔ 1.00]

SoCW-Edge-Top-Fore
X equ: (g*f)/16*(6/1*(u**2 - v**2 - 2*(u**4 - v**4) - v*(4*u**2 + 1))/(2*u**2 + 2*v**2 + 1)**2) + (sqrt(6)/3*(1 - v)/sqrt(2*u**2 + 2*v**2 + 1))*f/2
Y equ: (g*f)/16*(6*sqrt(3)*(-u*(4*v**2 + 1))/(2*u**2 + 2*v**2 + 1)**2) + (sqrt(2)*(u)/sqrt(2*u**2 + 2*v**2 + 1))*f/2
Z equ: (g*f)/16*(6/sqrt(2)*(u**2 - v**2 - 2*(u**4 - v**4) + 2*v*(4*u**2 + 1))/(2*u**2 + 2*v**2 + 1)**2 - sqrt(2)) + (sqrt(3)/3*(1 + 2*v)/sqrt(2*u**2 + 2*v**2 + 1) + 1)*f/2
U min: -0.50
U max:  0.50
U stp: 72
V min: -0.50
V max:  0.50
V stp: 72
F equ:  2.00
G equ: [0.00 ↔ 1.00]

SoCW-Face-Aft
X equ: (g*f)/16*(3/2*((u**2 + v**2)*(3 - (u + v - 1)**2) - 2*(u**2*v**2 - 2*(u*v - u - v) - 1))/(u**2 + u*v + v**2 - u - v + 1)**2) - (sqrt(3)/6*(u + v + 2)/sqrt(u**2 + v**2 + u*v - u - v + 1))*f/2
Y equ: (g*f)/16*(3/2*sqrt(3)*((u**2 - v**2)*(1 + (u + v - 1)**2))/(u**2 + u*v + v**2 - u - v + 1)**2) + (1/2*(u - v)/sqrt(u**2 + v**2 + u*v - u - v + 1))*f/2
Z equ: (g*f)/16*(3/2*sqrt(2)*((u**2 + v**2)*((u + v - 1)**2) - (u**2*v**2 - 2*(u*v - u - v) - 1))/(u**2 + u*v + v**2 - u - v + 1)**2 - sqrt(2)) - (sqrt(6)/3*(u + v - 1)/sqrt(u**2 + u*v + v**2 - u - v + 1) - 1)*f/2
U min:  0.00
U max:  1.00
U stp: 72
V min:  0.00
V max:  1.00
V stp: 72
F equ:  2.00
G equ: [0.00 ↔ 1.00]

SoCW-Face-Base
X equ: (g*f)/16*(3/2*((u**2 + v**2)*(1 + (u + v - 1)**2) - 2*(u**2*v**2 - 2*(u*v - u - v) - 1))/(u**2 + u*v + v**2 - u - v + 1)**2) - (sqrt(3)/6*(3*u + 3*v - 2)/sqrt(u**2 + v**2 + u*v - u - v + 1))*f/2
Y equ: (g*f)/16*(3/2*sqrt(3)*((u**2 - v**2)*(1 + (u + v - 1)**2))/(u**2 + u*v + v**2 - u - v + 1)**2) + (1/2*(u - v)/sqrt(u**2 + v**2 + u*v - u - v + 1))*f/2
Z equ: (g*f)/16*(3/2*sqrt(2)*((u**2 + v**2)*(2 - (u + v - 1)**2) - (u**2*v**2 - 2*(u*v - u - v) - 1))/(u**2 + u*v + v**2 - u - v + 1)**2 - sqrt(2)) + (sqrt(6)/3*(-1)/sqrt(u**2 + u*v + v**2 - u - v + 1) + 1)*f/2
U min:  0.00
U max:  1.00
U stp: 72
V min:  0.00
V max:  1.00
V stp: 72
F equ:  2.00
G equ: [0.00 ↔ 1.00]

SoCW-Vertex-Fore
X equ: (g*f)/16*(3/2*((u**2 + v**2)*(3 - (u + v - 1)**2) - 2*(u**2*v**2 - 2*(u*v - u - v) - 1))/(u**2 + u*v + v**2 - u - v + 1)**2) + (sqrt(3)/6*(u + v + 2)/sqrt(u**2 + u*v + v**2 - u - v + 1))*f/2
Y equ: (g*f)/16*(3/2*sqrt(3)*((u**2 - v**2)*(1 + (u + v - 1)**2))/(u**2 + u*v + v**2 - u - v + 1)**2) - (1/2*(u - v)/sqrt(u**2 + u*v + v**2 - u - v + 1))*f/2
Z equ: (g*f)/16*(3/2*sqrt(2)*((u**2 + v**2)*(0 + (u + v - 1)**2) - (u**2*v**2 - 2*(u*v - u - v) - 1))/(u**2 + u*v + v**2 - u - v + 1)**2 - sqrt(2)) + (sqrt(6)/3*(u + v - 1)/sqrt(u**2 + u*v + v**2 - u - v + 1) + 1)*f/2
U min:  0.00
U max:  1.00
U stp: 72
V min:  0.00
V max:  1.00
V stp: 72
F equ:  2.00
G equ: [0.00 ↔ 1.00]

SoCW-Vertex-Top
X equ: (g*f)/16*(3/2*((u**2 + v**2)*(1 + (u + v - 1)**2) - 2*(u**2*v**2 - 2*(u*v - u - v) - 1))/(u**2 + u*v + v**2 - u - v + 1)**2) + (sqrt(3)/6*(3*u + 3*v - 2)/sqrt(u**2 + v**2 + u*v - u - v + 1))*f/2
Y equ: (g*f)/16*(3/2*sqrt(3)*((u**2 - v**2)*(1 + (u + v - 1)**2))/(u**2 + u*v + v**2 - u - v + 1)**2) - (1/2*(u - v)/sqrt(u**2 + v**2 + u*v - u - v + 1))*f/2
Z equ: (g*f)/16*(3/2*sqrt(2)*((u**2 + v**2)*(2 - (u + v - 1)**2) - (u**2*v**2 - 2*(u*v - u - v) - 1))/(u**2 + u*v + v**2 - u - v + 1)**2 - sqrt(2)) - (sqrt(6)/3*(-1)/sqrt(u**2 + u*v + v**2 - u - v + 1) - 1)*f/2
U min:  0.00
U max:  1.00
U stp: 72
V min:  0.00
V max:  1.00
V stp: 72
F equ:  2.00
G equ: [0.00 ↔ 1.00]

The F parameter controls the total width of the combined mesh, while the G parameter controls the uniformity of curvature from 0 (completely uniform curvature, generating a sphere) to 1 (maximum variation in curvature). In the following two GIFs, the "Edge" surfaces have been colored cyan, the "Face" surfaces have been colored purple, and the "Vertex" surfaces have been colored magenta.

GIF of mesh with G = 0 GIF of mesh with G = 1

The "Edge" surfaces are triangulated with the "Shortest Diagonal" Quad Method, while the "Face" and "Vertex" surfaces are triangulated with the "Fixed Alternate" Quad Method. After triangulation, the portions of the "Face" and "Vertex" surfaces which overlap with the "Edge" surfaces are deleted. To get the complete mesh, the surfaces whose names end in "Fore" or "Aft" must be duplicated twice, with each duplicate rotated 120° about the z-axis.

All surfaces (four faces, four vertices, and six edges) are combined into a single mesh object with Object > Join. The boundary-vertices are joined to make a single contiguous mesh with Merge By Distance (for F = 2, I found that a distance of 0.000001 m is sufficiently small to avoid merging vertices which are not on the boundaries). Finally, the Normal vectors are recalculated with Shift+N to ensure they all point outwards.

Here is a link to a Blender file with both meshes:

$\endgroup$
14
  • 1
    $\begingroup$ Are you sure the structure between both objects is exactly the same or is it an assumption? Because it does not sound like they were. But maybe it would help if we knew what you are creating? $\endgroup$ Commented Jun 6 at 16:32
  • 1
    $\begingroup$ Shape-keys will give you a linear interpolation between the surfaces at your sampled values of G. so, no, the transition will generally not be the same as varying G. The good? news is that you could certainly do this with Geometry Nodes. If you gave us an example function, we could demonstrate. $\endgroup$
    – Robin Betts
    Commented Jun 6 at 16:41
  • $\begingroup$ Could you confirm that the expression for X, Y, and Z looks like (e.g. for X) X(F,G,U,V) = F x ( G x X1(U,V) + x2(U,V) ) ? It is not so obvious from the provided pseudo-code... If it is correct, it means that for the same topology, the transformation is linear, and as Robin mentioned, a linear interpolation should to the job. UNLESS the process written as the portions of the "Face" and "Vertex" surfaces which overlap with the "Edge" surfaces should be deleted is changing the topology as G is increasing from 0 to 1... $\endgroup$ Commented Jun 6 at 19:41
  • $\begingroup$ @StefLAncien is exactly on it.. in all these expressions as given, g is a linear, in fact, a scaling component, so a Shape-Key should work,here. g is mix-factor? $\endgroup$
    – Robin Betts
    Commented Jun 6 at 20:10
  • 1
    $\begingroup$ @Lawton if you are still new to Geometry Nodes I highly recommend to go through some tutorials first to get a good understanding of it. Here's a good one to get you started youtu.be/ZerJnivvBn4?si=DNSIamTUrbkzzJIj $\endgroup$
    – Harry McKenzie
    Commented Jun 9 at 22:13

2 Answers 2

5
$\begingroup$

Yes this is possible using this answer. You can also achieve this with a non-destructive method using Geometry Nodes, following the same approach described in this thread. This makes it easier to animate and adjust the G and F values.

enter image description here

This is just more work in that you have to map the nodes for six sets of parametric equations and then you have to join the geometry into one mesh.

enter image description here

Here's the Geometry Nodes modifier:

enter image description here

The Merge-Overlaps custom node uses this method to merge overlapping faces. The following is the content of the SoCW Surface custom node that just basically prepares the grid object for transformation by $uv$

enter image description here

For each set of parametric equations you have to map the nodes. For example for SoCW-Edge-Top-Fore where

$$ [ u \in [-0.5, 0.5] ] $$ $$ [ v \in [-0.5, 0.5] ] $$

x = (g*f)/16*(6/1*(u**2 - v**2 - 2*(u**4 - v**4) - v*(4*u**2 + 1))/(2*u**2 + 2*v**2 + 1)**2) + (sqrt(6)/3*(1 - v)/sqrt(2*u**2 + 2*v**2 + 1))*f/2

$$ x(u, v) = \frac{g \cdot f}{16} \left( \frac{6}{1} \left( \frac{u^2 - v^2 - 2(u^4 - v^4) - v(4u^2 + 1)}{(2u^2 + 2v^2 + 1)^2} \right) \right) + \left( \frac{\sqrt{6}}{3} \left( \frac{1 - v}{\sqrt{2u^2 + 2v^2 + 1}} \right) \right) \frac{f}{2} $$

y = (g*f)/16*(6*sqrt(3)*(-u*(4*v**2 + 1))/(2*u**2 + 2*v**2 + 1)**2) + (sqrt(2)*(u)/sqrt(2*u**2 + 2*v**2 + 1))*f/2

$$ y(u, v) = \frac{g \cdot f}{16} \left( \frac{6 \cdot \sqrt{3} \cdot (-u \cdot (4v^2 + 1))}{(2u^2 + 2v^2 + 1)^2} \right) + \left( \frac{\sqrt{2} \cdot (u)}{\sqrt{2u^2 + 2v^2 + 1}} \right) \frac{f}{2} $$

z = (g*f)/16*(6/sqrt(2)*(u**2 - v**2 - 2*(u**4 - v**4) + 2*v*(4*u**2 + 1))/(2*u**2 + 2*v**2 + 1)**2 - sqrt(2)) + (sqrt(3)/3*(1 + 2*v)/sqrt(2*u**2 + 2*v**2 + 1) + 1)*f/2

$$ z(u, v) = \frac{g \cdot f}{16} \left( \frac{6}{\sqrt{2}} \left( \frac{u^2 - v^2 - 2(u^4 - v^4) + 2v(4u^2 + 1)}{(2u^2 + 2v^2 + 1)^2} \right) - \sqrt{2} \right) + \left( \frac{\sqrt{3}}{3} \left( \frac{1 + 2v}{\sqrt{2u^2 + 2v^2 + 1}} \right) + 1 \right) \frac{f}{2} $$

The node setup will look like this:

enter image description here

You will have to do this for all the other sets of parametric equations. I was kind enough to do all the rest of them, namely, SoCW-Vertex-Fore, SoCW-Edge-Base-Aft, SoCW-Face-Aft, SoCW-Vertex-Top and SoCW-Face-Base.

But don't fret! There's good news: you can easily map those nodes by simply copying and pasting the Python formulas using this cool add-on called Math Formula which will automatically map all the Math nodes for you!

Then simply animate the g parameter:

enter image description here

$\endgroup$
0
1
$\begingroup$

Yes it is possible to do a shape animation from one mesh to another using Shape Keys, specifically Join as Shapes:

Join as Shapes (Transfer Mix) Transfer the current resulting shape from a different object.

Select the object to copy, then the object to copy into. Use this action and a new shape key will be added to the active object with the current mix of the first object.

This is a very tricky task because you not only need to ensure that the number of vertices is exactly the same for both objects, but you also need to make sure that the topology is similar, if not identical. If the topology differs, you may end up with a messed-up shape animation due to different vertex index orders. For more details, see this and that.

In your case, to obtain a mesh with exactly the same number of vertices, you need to set the F value to a large number, such as F=60. This increases the size and the distance between vertices, preventing unrelated vertices from merging when using M > Merge By Distance, due to the high density of the mesh in its rounded corners when G=1.

Next, ensure you merge all the XYZ Math Surface objects one by one, removing overlaps either manually or by using this method. Do this in the same order as for objects with G=0 and object with G=1. Set your M > Merge By Distance value very low, like 0.0001. Then, select both objects, go to Object Data Properties > Shape Keys, add a Shape Key, and use Join as Shapes.

Here, I have created and merged all XYZ Math Surface meshes into one object for G=0 and another for G=1 where F=60.

enter image description here

$\endgroup$

You must log in to answer this question.

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