Sunday, 12 April 2015

Blender: Context Part II - Transformation Orientation

In the Context Part I tutorial we saw how the various pivot center settings for transformations give us a tremendous amount of control during the modeling process by changing the "context" of an action. Today we continue to explore Blender's context controls, shifting our attention to the effect of the transformation orientation setting.

I will be assuming that you've swapped your mouse button assignments as per the Virgins and Mice tutorial, that you've read part I, and have at least a general understanding of the subjects covered in my previous novice tutorials.

Transformation Orientation

Blender expects most modeling done by the user to be by eye rather than with mathematical precision, particularly when complex objects are involved. It's quite difficult to interpret a user's actions in a 2-dimentional space (your monitor) in the context of a 3-dimensional space (Blender's environment) so Transformation Orientation is your way of helping Blender know what your intent is. Blender wants you to specify your frame of reference (what it calls "transformation orientation") just so it can't misinterpret you.

Whether you're aware of it or not, you're probably already familiar with the idea of specifying a frame of reference because Opensim is subject to the same considerations. If you've done any building or scripting at all in world you'll have been bumping into it constantly.

Here's a cube I rezzed (your viewer may look a little different).

By default the viewer expects you to be using the "world" axes as your reference when building in a region. With "world" as your reference, the x-, y-, and z-axes are aligned to the region's x,y,z coordinate system so when you're moving or rotating things they do so relative to "the world." When editing the size of an object (numerically or using the handles displayed for a single object when you hold down the Shift and Ctrl key) the reference the viewer uses for size switches to local but rotation remains global. Scaling, in the viewer, is always local reference even when the reference drop-down is set to "World" which I'm sure has been equally as annoying at times you as it has been for me.

When repositioning an attachment your viewer switches to using the attachment point as the reference since that's more relevant to the situation. The script engine typically uses world reference for root prims and local reference for child prims in a linkset. In most cases you can also tell the viewer to use a different reference when positioning and rotating something, and for scripts you often have to jump through hoops to convert from world to local and back again to avoid having unintended things happen with linksets.

Blender (and almost all 3D modeling software) uses the same sort of overall approach where there is a global reference frame centered on Blender's <0,0,0> point and everything else is considered relative to that. Each individual object you add to the scene is initially aligned to that global reference and then, as you move it around, the model's position and rotation will usually change relative to the global one. Good 3D modeling software takes this to whole different level of control, though, allowing far more control over how an object is manipulated.

Particularly when you're modeling by hand, it's often a lot more convenient to work with the model's original "local" x,y,z orientation rather than the global (hence why in your viewer's edit mode these are automatically forced to be local); but there are also many cases where working with global references is faster. Because Blender can't anticipate which is more useful to you at any given moment, it needs you to specifically change it from the global default. Blender has yet other options that can be very convenient at times -- options that don't exist in-world.

As was the case with pivot center, it's easiest to show the effects of the various transform orientations by playing with a very simple object so in Object mode let's add a cube to our scene and position it at the global location <0.5, 1.,0, 1.5> with a rotation of <15, 30, 45>.

It's fastest to do this by typing those values into the most recent actions section of the toolshelf immediately after adding the cube; but you can also do so using a variety of other methods. In my picture I have also coloured the cube's faces to make it easier for you to see their original orientation (red is x-axis, green is y-axis and blue is z-axis).

You'll want your 3D Manipulator widget to be active, which it is by default, because the frame of reference context is generally only relevant when you're manually adjusting an object. Depending on what type of translation you're doing you may with to switch between its three handle types: translate (move), rotate, and scale which will give you conveniently shaped handles to grab and drag.

Let's also switch into Edit mode since this will make it a little easier to demonstrate some of the options.

There are five: Global, Local, Normal, Gimbal, and View. In the following section I'll draw your attention to specific things of interest but you might wish to experiment with each of the options with (1) the entire mesh selected, (2) just one or two faces selected, (3) only a single edge or two selected, and (4) only one or two non-connected vertices selected. For each of those, try moving, rotating, and scaling (but you can't scale or rotate a single vertex). When modeling you'll regularly be using all of those variations.

Technical note: the exact effect of the scale transformation actually changes depending on whether you're in Object Mode or Edit mode but you're unlikely to run into these differences very often when creating Opensim content so I'll leave it up to the reader to explore axis-constrained single-object scaling in Object mode if/when the need to use it arises.

Selecting a Transformation Orientation and Orientation Effects

We tell Blender what frame of reference we want to use by selecting it from the Transformation Orientation drop-down box. There are two places you can do this: in the 3D View pane's bottom menu bar or in a section of that pane's properties side panel -- they are identical so changing one automatically changes the other. Try each of these with your cube, using ctrl+z to undo and return to your original cube each time.

You can use the widget handles or hotkeys to move, rotate or scale and I'd strongly suggest becoming adept at both since hotkey activation can save you a lot of time (and thousands of mouse clicks) when modeling. To move something use hotkey G (for "grab"), to rotate something use R, and to scalae use S. You can follow that with an axis letter to constrain the translation to only that axis much like grabbing one of the widget's handles does. You'll also notice that the widget itself changes it's orientation to match the orientation you've selected.

Immediately after having made a translation the most recent actions section of the toolshelf will show the exact change you made and allow you to change any aspect of it, including the transformation orientation and constraints. It's hard to emphasize just how powerful and time-saving this can be, allowing you to manipulate even simple objects in ways that would be impossible to do in world.

The effects of each orientation are as follows:

Global: By default Blender uses "Global" as its reference frame. All translations are done based on the center of Blender's universe. With the entire object selected this will feel a lot like working with an in-world prim, but as soon as you select just a single face or edge or vertex it becomes a whole new experience. You'll also immediately notice that if you constrain scaling to an axis (hotkey S X then move your mouse) it will be scaling it in a way that's impossible to achieve with a prim -- or at least not easily.


Local: This is what will feel most familiar when you're scaling an object since it uses the object's original frame of reference. When moving or rotating it (or a portion of it) it will behave much the way the viewer does for a prim when set to use "local" reference instead of "world."


View: I'm skipping the next two orientations for a moment and going to the "View" option which is far more easily seen than explained and is also a little counter-intuitive when using hotkeys.When you switch to View orientation the widget changes to simple 2-dimensional x-y handles that are always aligned to your angle of view, so if you move your viewpoint around in 3D space it will always remain the same. Why Blender didn't use X-Z instead is a mystery to me since that's actually the way it behaves with respect to the hotkey constraints .

It's also a little unusual for the way the most recent action section works. If you change your view after making the transformation you can then use that section's Orientation drop-down to switch to global and then back to view and it will update the transformation to reflect your changed view,

There are some occasions where this orientation can be extremely useful but I suspect you won't be using it all that often for most content creation.


Gimbal: This orientation has virtually no use at all for an Opensim content creator working with mesh -- or at least none I can think of, and I don't believe I've ever used it when modeling -- so I'm not even going to try explaining it or show a picture. It is extremely useful when working with armatures for animation but that's well beyond the scope of this tutorial. For now, pretend this doesn't exist as an option and if you ever begin doing animation work you'll want to read up on it.

Normal: The last of the orientations is called "Normal" and to best explain and demonstrate it requires a separate tutorial post all to itself so normals and normal orientation will be the subject of part III of this series. It is an orientation that you will use a lot when modeling more complex objects, particularly when fine-tuning them. I'd estimate that about 50% of my modeling is done using normal orientation and the other 50% would be split evenly between global and local (although these figures will vary depending on what I'm working on).

Closing Comments for Part II

Before I conclude part II, I must reinforce something I stated in part I: that the overall choice of context offers an extremely powerful ability to model objects. It's important to emphasize that transformation orientation isn't something that works in isolation from the pivot center; it's a component of it. This means that once you've become a bit familiar and comfortable with how transformation orientation works with the default median point pivot center you should then extend your experimentation to using the other centers.

In particular, using the 3D cursor as your pivot center and repositioning it to a non-zero-vector place of importance can allow you to achieve extremely complex transformations with speed, ease and accuracy, saving countless hours of tedious, frustrating hand modeling using the defaults.

I can also remember how bewildering and hard to absorb this all was when I first started modeling and know that my tutorials aren't going to take that feeling away from the reader. I can, however, assure you that time spent working with it, practicing and experimenting, will gradually make all of these techniques and controls far less mysterious and intimidating. Eventually it almost becomes second nature, speeding up your workflow and opening the doors to tackling some pretty neat creations.

No comments:

Post a Comment