Animating Wolfram surfaces with Blender: Bezier curves, MOs & spiral​
​by Guenther Gsaller
This is a continuation to the posts listed at: https://community.wolfram.com/web/ggoff/

Abstract

In Example 1 the Wolfram Language was used to test a vector sketch of an apple and convert cube-files. Two versions of the bowl were implemented. Example 2 was inspired by historic seals and shows spiral development in an animation.

Experiments

Example 1: Fruits

Initialization

In[]:=
path0=SetDirectory[NotebookDirectory[]<>"/data/"]
Out[]=
/Users/gg/Desktop/gg2aeb/ams10pub/data

From Sketch to Animation

Before starting this project a vector sketch for each fruit was created in Affinity Designer and exported as pdf-file.
Clicking on the imported graphic allowed a collection of coordinates for e.g. six relevant points.
In[]:=
fruit1=Import[path0<>"/"<>"apple1.png",ImageSize->{960/4-6,1280/4-12}];​​pts={{118.49999999999997`,38.208398437499966`},{141.29999999999998`,27.80839843749999`},{163.79999999999998`,33.908398437499955`},{220.8`,145.80839843749993`},{173.39999999999998`,228.80839843749993`},{117.`,173.70839843749997`}};​​HighlightImage[fruit1,ImageMarker[pts,"CircleBullet"]]
Out[]=
The six points were translated near the z-axis in preparation of rotating around the z-axis:
In[]:=
pts2=Transpose[pts];​​mm=MinMax[pts2[[1]]];​​pts3=Transpose[{pts2[[1]]-mm[[1]],pts2[[2]]}]
Out[]=
{{1.5,38.2084},{24.3,27.8084},{46.8,33.9084},{103.8,145.808},{56.4,228.808},{0.,173.708}}
The next step distributes the points in circles around the z-axis:
In[]:=
pts4=Table[{pts3[[i,1]]Cos[j],pts3[[i,1]]Sin[j],pts3[[i,2]]},{i,1,6},{j,0,2Pi,Pi/6}];​​ListPointPlot3D[pts4]
Out[]=
The collection of points were used to form the rotational surface and animate it:
In[]:=
pts5=Table[Take[pts4,{1,i}],{i,2,6}];​​apples=Graphics3D[BSplineSurface[#,SplineClosed->True],Boxed->False,ImageSize->Small]&/@pts5;​​ListAnimate[apples,ControlPlacementTop]
Out[]=
A similar process was done for pear, orange and lemon. SVG-files for all four fruit-curves are included in folder data.

Boolean Operations On Geometries

The first version implemented in Wolfram Language:
In[]:=
ell1=Graphics3D[{Opacity[.7],Ellipsoid[{0,0,0},{2Pi,4,2}]}];​​sin1=Plot3D[{-2.2,0.2Sin[x]},{x,-2Pi,2Pi},{y,-2Pi,2Pi},PlotTheme->"FilledSurface",PlotStyle->Opacity[.7]];​​combo=Show[ell1,sin1];​​Show[combo,ViewPoint{-0.7,1.0,0.4},BoxedFalse]
Out[]=
The result of the Boolean difference between ellipsoid and wavy object, flipped around the x-axis, resulted in the bowl.
​
In the second version both requirements are imported. Earlier they were exported from Blender.
In[]:=
fns=FileNames["*.ply"];​​combo2=Import[#]&/@Drop[fns,{2}];combo3=Graphics3D[{EdgeForm[],Opacity[0.3],Yellow,GraphicsComplex[MeshCoordinates[combo2[[2]]],MeshCells[combo2[[2]],2]]},Boxed->False];​​combo4=Show[combo2[[1]],combo3,ViewPoint{-0.2,1.8,0.3},BoxedFalse]
Out[]=
The Boolean difference between half-ellipsoid and wavy object delivered the bowl.

Preparation of molecular companion

One out of many aroma molecules for each fruit was prepared in Psi4. The molecules were optimized, the cube files for the frontier-orbitals were calculated. In the animation just the highest occupied were displayed. An flavor molecule for an apple was used below.
In[]:=
molName="ethyl-2-methylbutyrate";
In[]:=
fns=FileNames["*.cube"]
Out[]=
{Psi_a_36_36-A_HOMO.cube}
The level for the range of the contours was extracted from the second line of the cube-file:
In[]:=
range=SetAccuracy[ToExpression[StringDrop[StringTake[Import[#,{"Text","Lines",2}],-10],-1]],3]&/@fns
Out[]=
{0.04}
The cube-file was imported as 3D-graphics with transparency for the creating proper MOs.
In[]:=
mos=Table[Import[fns[[i]],"Graphics3D",Contours->{-range[[i]],range[[i]]},ContourStyle->Opacity[0.5]],{i,1,1}]
Out[]=


The molecule and the MO were exported as ply-files.
In[]:=
Export[molName<>"-homo.ply",mos[[1]]]
Out[]=
ethyl-2-methylbutyrate-homo.ply

Blender

Part 1-3:
After sketching four fruits the Bezier-curves for one half of the fruits were exported as svg-files. The apple was imported as curve and solidified. It was given mix of red-yellow material. As stem a modified raw cylinder was used. The rotation of the curve with the screw modifier around the z-axis was animated. The scene was completed by a sci-fi like floor and an apple-aroma molecule including the highest occupied molecule-orbital. It was imported as ply-file. This was repeated for pear, orange & lemon.
Hint: The vertex color node with the imported molecule as object delivers the intended colors.
​
Part 4:
The bowl, an open half-ellipsoid, was combined with the wavy object through a Boolean modifier (difference).
Floor- and fruit-objects were appended from blend-files of part 1-3. Again the bowl + fruits were rotated around the z-axis.

Example 2: Seal

Initialization

Cylinder, cylindrical helix

Following animation with a cylinder and a helix was used as prototype.

Blender

Part 1:
A basis version of cylinder & spiral was implemented in Geometry Nodes:
Choosing fitting radii resulted in a cylinder with engraved pattern using the Boolean Difference modifier. The Geometry Nodes were applied and animated.
Part 2:
A more elaborate pattern with steeper helix-parts was implemented by using the array modifier and animated.
Part 3:
Solidified wires with an inner glow effect were animated followed by using wider radii for helix and helix-parts.
Part 4:
Historically cylindrical seals were rolled e.g. in clay to release the embedded info. The final animation visualizes both sides of the process in circular form.

References

Collection of animations

https://vimeopro.com/orbs78/animations

References

Fruits
​​
Scene: Modified Sketches Of Fruits & Molecules
​
A collection of fruits and for each aroma one molecule with molecule orbitals are shown.
​
Smith, Daniel G. A., Lori A. Burns, Andrew C. Simmonett, Robert M. Parrish, Matthew C. Schieber, Raimondas Galvelis, Peter Kraus, et al. “PSI4 1.4: Open-Source Software for High-Throughput Quantum Chemistry.” The Journal of Chemical Physics 152, no. 18 (Mai 2020): 184108. https://doi.org/10.1063/5.0006002. Accessed December 30, 2021.
​
Audio:
Stock Music & Sound Effects - Royalty Free Audio - Storyblocks
https://storyblocks.com/audio (accessed 2021-12-30)
MEDIA MUSIC GROUP. Beautiful (Hopeful Inspirational Acoustic Guitar). Accessed December 30, 2021. Asset ID: SBA-346416392.
​
Seal​
​
Scene: Modified Cylinder, Spiral & Boolean Difference
​
“Wolfram Language & System Documentation Center,” February 27, 2022. https://reference.wolfram.com/language/.
​
Audio:
Stock Music & Sound Effects - Royalty Free Audio - Storyblocks
https://storyblocks.com/audio (accessed 2022-02-27)
Nir, Ben Ami. Avalon. Accessed February 27, 2022. Asset ID: SBA-300538680.