I'm working in MATLAB on a problem involving the motion (translation and rotation) of a superquadric in a 3 dimensional space. I've written a code that computes the position (3 Cartesian coordinates of the superquadric center, referred to the world reference fixed to the ground) and the orientation (roll, pitch and yaw referred to the world reference fixed to the ground) at each sampling instant. The other superquadric parameters, i.e. the length of the axes and the squareness, are left fixed in time.

Everything works fine, but the problem is that I don't really like how MATLAB render the 3D surfaces (I've tried the functions surf, mesh and so on...). Hence, I'm looking for a simple alternative to render a video animation about the motion of my superquadric. Since it is a freeware program, I was wondering if it is possible to use Blender.

My questions are the following:

  1. Is it possible to import in Blender from MATLAB the sequence (already computed in MATLAB) of positions, orientations, axes length, squareness and then use Blender (hoping to achieve better results than the one obtained with MATLAB) to create a video animation?

  2. If it is possible, is it a difficult procedure for a total newbie like me?

  3. If it makes sense to use Blender to animate a superquadric, where can I find some basic tutorials on Blender that allow me to solve my problem?

EDIT According to the suggestions of Duarte and Harry, I provide more "low level" details about my problem.

Each point on the surface of my superquadric are expressed by the following parametrization \begin{equation} \begin{aligned} \xi^{\text{b}} & = a_\xi\,\textrm{c}_{\alpha}^{\varepsilon_1}\,\textrm{c}_{\beta}^{\varepsilon_2}\\ \eta^{\text{b}} & = a_\eta \, \textrm{c}_{\alpha}^{\varepsilon_1}\,\textrm{s}_{\beta}^{\varepsilon_2}\\ \zeta^{\text{b}} & = a_\zeta \, \textrm{s}_{\alpha}^{\varepsilon_1} \end{aligned} \qquad \text{with} \qquad \begin{aligned} \textrm{c}_{\gamma}^\varepsilon &\triangleq \textrm{sign}(\cos \gamma)\, |\cos \gamma|^{\varepsilon}\\ \textrm{s}_{\gamma}^\varepsilon &\triangleq \textrm{sign}(\sin \gamma) \, |\sin \gamma|^{\varepsilon} \end{aligned} \tag{1} \end{equation}

here the notation gets the following meaning:

  • $\xi^\text{b},\eta^\text{b}, \zeta^\text{b}$ are the Cartesian coordinates of the point on the superquadric surface. The superscript means "body reference", in the sense that
  1. the position of the superquadric (i.e. its center) is placed in the origin of the world reference;
  2. the orientation angles (roll, pitch, yaw) are null.
  • $a_\xi, a_\eta, a_\zeta$ are the axis length, expressed always in the directions identified by the body reference;
  • $\epsilon_1,\epsilon_2$ are the squareness of the superquadric;
  • $\alpha,\beta$ are the latidue and longitude coordinates of the generic $\xi^\text{b},\eta^\text{b}, \zeta^\text{b}$ point, and they acts as the degrees of freedom of the parametrization. The entire superquadric surface is obtained by spanning $\alpha\in[-\pi/2,\pi/2]$ and $\beta\in[-\pi,\pi]$.

Naturally, only a finite subset of the surface point can be represented in the computer implementation. Hence, in MATLAB, I pick from the domains of $\alpha,\beta$, i.e. $[-\pi/2,\pi/2]$,$[-\pi,\pi]$, $N=100$ equidistant points $\{\alpha_i\}_{i=1}^N$,$\{\beta_i\}_{i=1}^N$, obtaining $N^2$ 2-dimensional points $\{(\alpha_i,\beta_j)\}_{i,j=1}^{N}$ ("domain mesh-grid").

Then, for each point in the domain mesh-grid, I apply the parametrization $(1)$, ending up with $N^2$ 3-dimensional points $\{(\xi_i^\text{b},\eta_i^\text{b}, \zeta_i^\text{b})\}_{i=1}^{N^2}$ ("codomain mesh-grid").

After that, I apply a roto-translation to the codomain mesh-grid, given by the following transformation \begin{equation*} \left[\begin{array}{c} \xi \\ \eta \\ \zeta \end{array}\right]=T_\theta\,T_\phi\,T_\psi\,\left[\begin{array}{c} \xi^\text{b} \\ \eta^\text{b} \\ \zeta^\text{b} \end{array}\right]+\left[\begin{array}{c} \xi_\text{c} \\ \eta_\text{c} \\ \zeta_\text{c} \end{array}\right] \qquad \text{with} \end{equation*}

\begin{equation*} T_\theta \triangleq \left[\begin{array}{ccc} 1 & 0 & 0 \\ 0 & \phantom{-}\cos \theta & -\sin \theta \\ 0 & \phantom{-}\sin \theta & \phantom{-}\cos \theta \end{array}\right] \quad T_\phi \triangleq \left[\begin{array}{ccc} \phantom{-}\cos \phi & 0 & \phantom{-}\sin \phi \\ 0 & 1 & 0 \\ -\sin \phi & 0 & \phantom{-}\cos \phi \end{array}\right] \quad T_\psi\triangleq \left[\begin{array}{ccc} \phantom{-}\cos \psi & -\sin \psi & 0 \\ \phantom{-}\sin \psi & \phantom{-}\cos \psi & 0 \\ 0 & 0 & 1 \end{array}\right] \end{equation*}

in order to take into account of the position $\xi_\text{c}, \eta_\text{c}, \zeta_\text{c}$ and the orientation $\theta, \phi, \psi$ of the superquadric with respect to the world reference.

As a final step, I render the image of the surface by plotting the new codomain mesh-grid $\{(\xi_i,\eta_i, \zeta_i)\}_{i=1}^{N^2}$ with the suitable MATLAB commands, such as surf or mesh.

  • 1
    $\begingroup$ Hello and welcome. While files, images, and external videos or links may be helpful additions they should not be the only way to obtain information about your issue. Don't make understanding your question rely on downloading a file, watching a video or visiting an external site. Use the builtin tools to upload images or gifs, along with thoroughly explaining the problem in written form so it can be indexed and searched for thus helping future visitors with similar issues. $\endgroup$ Commented Dec 20, 2022 at 22:02
  • 1
    $\begingroup$ If you have the cartesian equations or the parametric equations for your shape you can easily recreate them using geometry nodes and easily animate them. I would go with that route rather then import a sequence since you will have more control over your geometry. Try this one for reference blender.stackexchange.com/questions/270409/…. And please provide more details such as your cartesian or parametric equations. $\endgroup$
    – Harry McKenzie
    Commented Dec 21, 2022 at 2:58
  • $\begingroup$ @ Duarte: thank you for your reply, next time I will take into account your suggestions. @ Harry: I've added more details about the parametrization that I'm using. The procedure that you are mentioning seems very similar to the one that I'm using in MATLAB. Is there any possibility to pass from MATLAB to Blender the superquadric parameters? Because currently I'm generating the sequence of positions and orientation angle with a particularl motion model and, TBH, I would like to avoid a new Blender implementation of such model. $\endgroup$
    – matteogost
    Commented Dec 21, 2022 at 16:36

1 Answer 1


I think the Sverchok add-on can do it for you: https://github.com/nortikin/sverchok/pull/2378

  • 3
    $\begingroup$ While appreciating the pointer, given that @matteogost is a brand-new Blender user, I think it would be fair to ask you flesh this out with some steps: how to use Sverchok in this context..., otherwise this is a comment. Ideally, you could implement a little toy project to illustrate? If, for any reason, that's tricky for you, it would be much more tricky for them :) $\endgroup$
    – Robin Betts
    Commented Dec 21, 2022 at 5:43
  • $\begingroup$ @Leo: very interesting, but I would like to know if it is possible to provide from MATLAB the sequence of parameters that defines the superquadric surface. $\endgroup$
    – matteogost
    Commented Dec 21, 2022 at 16:32
  • 1
    $\begingroup$ Hi @matteogost, I think I should have given my answer as a comment. I don't know if the MATLAB surf or mesh data can go directly to Sverchok. The Sverchok devs should know. Maybe get in touch with them? I use Sverchok as an interesting tool to make odd artistic things. However Sverchok does have nodes that generate geometry from texts of code. The generative art node and the scripted node are used for interpreting xml and python. So if you refactor the MATLAB data to one of those syntaxes I guess it could possibly work. It's not a direct connection from MATLAB to Blender, but indirect. $\endgroup$
    – Leo Aguiar
    Commented Dec 22, 2022 at 19:54

You must log in to answer this question.

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