2
$\begingroup$

I would like to improve the documentation of the Simple Deform Modifier. Therefore, I have inspected the source code (click here to view online. The math is 'do-able'. For example: the transformation for the taper-mode is as follows. However, I have trouble understanding the coordinates

  float x = r_co[0], y = r_co[1], z = r_co[2];
  float scale = z * factor;

  r_co[0] = x + x * scale;
  r_co[1] = y + y * scale;
  r_co[2] = z;

I assume that the r_co[0] to ...[3] are the X,Y and Z-coordinates of the vertices. So, the tapering is scaled in the X and Y axes, with a weight from the Z-location/distance.

  • Is this Z-location/distance calculated from the origin of the mesh? It should be 0 at the origin because vertices are not scaled in X & Y axes for the origin-plane.

  • What is the Z-location/distance of a vertex at the border of the mesh? It should be 1 because the tapering is at its max at that point.

So, are these R_co[0] ... [3] coordinates expressed in a number varying from -1 to +1, with 0 at the origin of the mesh? Is there any documentation about this?

Thanks.

$\endgroup$
  • $\begingroup$ AFAIK it is still the case that: Questions re blender source code are considered off-topic on BSE See blender.meta.stackexchange.com/questions/296/… $\endgroup$ – batFINGER Mar 5 at 15:00
  • 1
    $\begingroup$ @batFINGER, though clarifying simple deform behavior can be really helpful... $\endgroup$ – lemon Mar 5 at 15:05
  • 1
    $\begingroup$ @batFINGER, and also why this "source-code" tag exists? $\endgroup$ – lemon Mar 5 at 15:11
  • $\begingroup$ That's for all the Python-code. $\endgroup$ – Jaco Mar 5 at 16:02
  • $\begingroup$ @batFINGER I thought this superseded that link? blender.meta.stackexchange.com/questions/2216/… $\endgroup$ – Ray Mairlot Mar 5 at 16:10
2
$\begingroup$

After further research.

The Simple Deform modifier modes are in fact basic operations of rotating (Twist & Bend) and scaling (Taper & Stretch). The code for the Taper function is given above.

The calculation of the deformation is performed in the local coordinate system. The parameters r_co[0] … [3] are thus the local X, Y en Z coordinates of the object. Depending on the location of the origin of the object, these can be positive, negative or both. In the figure below, the origin is at the bottom of the object, so all local Z coordinates are positive.

Originally, the parameter Factor comes from the user (0.750 in the example) but is adjusted somewhere else in the code for the size of the object in the Deform axis. It is also influenced by the parameter Limits. In the example, the deform axis is Z and the object has a size of 3 units in this axis. So, the factor used in the function is 0.750/3 = 0.250; e.g. the total amount of deformation is spread over the entire deform axis.

So, all vertices are scaled in the local X and Y axis. The local Z-coordinate remains unchanged. Following the given formula the deformed vertex is calculated as follows:

Vertex (-0.5,0,3);  -0.5 + (-0.5*(3*0.250)) =  -0.875
Vertex (-0.5,0,2);  -0.5 + (-0.5*(2*0.250)) =  -0.750
Vertex (-0.5,0,1);  -0.5 + (-0.5*(1*0.250)) =  -0.625

enter image description here

| improve this answer | |
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.