-
Notifications
You must be signed in to change notification settings - Fork 114
Blender Basics
It is way beyond the scope of this documentation to give you an introduction to Blender, especially since more knowledgeable people have done so in other places, such as the manual on Blender wiki. First, try to get started with Blender's GUI and then have a look at how to work with objects. Don't worry, Blender is a really powerful piece of software and can seem daunting for a beginner, but the functions you really need to know to use it for your robot modelling purposes are comparably limited.
Remember, that Phobos 1.0 uses Blender 2.79. This is important when searching for documentation, as there have been some great changes in Blender 2.8. These will be incorporated in the next Phobos release.
When Blender starts up, it loads a default scene with a single cube, a camera and a light. We need none of these, so hit A and DEL to get rid of them. Besides the now empty scene in the middle, there are various toolbars, but important is that there is an object tree on the top right, an object property panel on the bottom right and the tools panel on the left. T shows and hides this panel, which is essential, as all Phobos operators are found here.
Newbie tip: To select an item in Blender, use the RMB (Right Mouse Button), the LMB only moves the world cursor, which will come in handy later.
Note: If you have installed Phobos with its preset, the GUI is already adjusted. The cube is deleted and you have a better starting point without too many Blender screens overwhelming you.
The best piece of advice we can give you as a Blender beginner: RMB on anything you don't understand. Chances are there will be a pop-up menu with links to both the user manual and the API documentation (not in the 3D editing window though, there RMB is used to select objects).
Let's see what this Y field in Rotation is about, either at the Blender Manual or its Python API reference.
Blender sports two options to automatically center the origin of a mesh to its shape, Origin to Geometry and Origin to Center of Mass. One has to be careful to use both options to determine the actual center of mass of a robot part. Origin to Geometry calculates the average of all vertices of a mesh, meaning that a mesh that is dense on one side and sparse on the other would have a bias of the calculated center not based in physics. Thus this only works well for objects with a uniform vertex distribution or simple, regular shapes such as boxes or spheres. Origin to Center of Mass assumes the mesh to be a hollow shell and calculates the center of mass as the weighted (by face area) average of all face center points, which is physically accurate for hollow shells, however a solid object of the same shape as a hollow shell does not necessarily have the same center of mass.
The following is only important if you want to dive deeper into understanding Blender or the code of Phobos and use it for your own scripts.
In Blender, every object possesses four different transformation matrices to save its current location, rotation and scale in space. These are:
- matrix_basis
- matrix_local
- matrix_world
- matrix_parent_inverse
These matrices allow the objects to be structured hierarchically in parent-child relationships within Blender. Thus, a different behavior can be observed for these matrices depending on whether they belong to a global or child object.
Global objects are objects which do not have a parent, and their location, rotation and scale are fully defined in relation to the world. Thus, their matrix_basis, matrix_local and matrix_world are all equal. As they possess no parent, the matrix_parent_inverse is the identity transform (or the last matrix_parent_inverse they had before they were un-parented from some object, however it is ignored).
In objects which are children of other objects, i.e. which have a parent, the three matrices serve different functions, as outlined below.
matrix_basis is the transformation of an object in its own coordinate space. It represents the transform that is displayed in Blender's Transform values in the sidebar and object properties. These values are often a point of confusion, because the matrix_basis does not necessarily refer to the object's actual position and orientation in space (the exception being global objects, where it always does). Instead, this is the global transform the object would possess if it was NOT parented to another object. For instance, if you move an object in X direction by 1.0 units, the vector (X:1, Y:0, Z:0) will be displayed in the sidebar even if you afterwards parent that object to another object and move that parent object around in your Blender scene.
The local matrix defines the transformation from the parent world transform to the child world transform. Consequently, if the local matrix of a child is applied to its basis point, this point would then reside at its parent's origin. Likewise, if you move an object in relation to its parent, this matrix will get updated.
This matrix is the absolute transform of the object in the world (and sometimes you wish this was the one displayed in the sidebar instead of the matrix_basis). This is the location, orientation and scale at which the object is displayed in blender.
The parent inverse matrix is set at the time of parenting and never changes afterwards, no matter what transformations are applied to the parent or the child (in fact, it doesn't even change after a parent-child relationship is cancelled and is simply ignored by Blender until the object becomes a child again, at which point it is simply overwritten). It is the transformation which, if applied to the child, reverses the change of the origin of the child's coordinate system that resulted from establishing the parent-child relationship. It is thus equal to the inverse of the parent's world transform at the time of parenting. This last point is important! As the parent could be a child of another object, the local and basis transforms would not reflect the change of origin of the parent, thus the world transform has to be used to derive the parent inverse.
- matrix_basis: the object's "own" transform in its own coordinate system
- matrix_local: the transform which brings an object from its parent's origin to its position in the world
- matrix_world: the absolute transform of the object with respect to the world
- matrix_parent_inverse: the inverse of the parent's world transform at time of parenting
While Blender does not readily display all these matrices, Phobos has
a function for doing so: utils.blender.printMatrices
, which you can run from
Blender's terminal or in a script.
Back to top.