Math To Mesh (Mtm)

by EBTRR in Scripts and Addons


Math to Mesh (short: MTM) allows you to create a mesh out of a function.

The function can have one or two input parameters (x and y).

This addon contains PyPip. This is a separate add-on that allows you to install Python packages/libraries from the Blender UI for the Python Interpreter of Blender.

The spherical harmonics/functions will be created using scipy, which you can install through PyPip.

With Update 1.0.1, you can now animate your function in x and y.


Links:

Discord: https://discord.gg/D2AZRcZMxt

Check out my other products: https://blendermarket.com/creators/ebtrr


If you have any questions feel free to contact me. 

For feature requests and Bug reports, you can use the Discords Channels or the Blender Market Contact Formular.


Custom Functions Generator:

You set a name and a target collection.

Then you type in your function.


The function can contain normal arithmetic python operators like +, -, *, / and ** for the exponent operator.

Trigonometric Functions like sin, cos and tan.

Hyperbolic Functions like sinh, cosh and tanh.

Constants like e and pi.

Special Functions like sqrt. You can archive the Square Root through x**0.5 too.


Then you set the range for the x and y axes. The min values always must be lower than the max values.


At last, you set the mesh resolution with the number of vertices in each axis direction.


The generated meshes are always triangular meshes. (Every face is a triangle)


Some examples:

sin(x)*sin(y)



5*(sin(x)/x+sin(y)/y)



(x**2+y**2)/100



tan(x)/10


You can see that through the strong gradient of the tan function, the result depends on the mesh resolution and where the mesh points are set.


Animation:

You can animate your function by simply setting the x and/or y Offset for your axis and the step size (Number of Keyframes). The Keyframe Interpolation is always linear.

Meaning of Offset (Example): x has the value; (Original x) + n/(Number of steps)*(Offset in x); at the nth step (Keyframe)


Speed and Performance:

If you have a Mesh with a resolution of 40x40 and 100 steps, calculating the functions sin(x)*2*y animated in x and y takes less than 10 seconds.

If you have a Mesh with a resolution of 100x100 and 500 steps, calculating the function 2*sin(x)*sin(y) animated in x and y takes around 3 mins and 30 seconds. (Improved with Update 1.0.2)

 

RAM:

High-resolution Meshes with hundreds of keyframes can take up much of your memory (RAM).


Example:


2*sin(y)*sin(y)



Spherical Functions Generator:

The start is similar to the Custom Functions Generator.

You select a name and a collection.


Then you change the Degree and Order of the spherical function

The Order can not be greater than the Degree.

The mesh resolution sets the number of vertices of the x and y-axis. Important notice the number will be lower than the Square of the mesh resolution because the add-on automatically merges the start and endpoints.

The resulting mesh is always a quad and tris-mesh.


Some examples:

Degree: 2

Order: 0



Degree: 4

Order: 1



Updates:

15/05/2022 Release Version 1.0.1: You can now animate Custom Function Meshes in x and y.

16/05/2022 Release Version 1.0.2: Performance Improvements

Dev Fund Contributor
Published 9 days ago
Software Version 2.93, 3.0, 3.1
License GPL
Have questions before purchasing?

Contact the Creator with your questions right now.

Login to Message