Monday, 30 March 2015

Blender: Baby Steps III

In this third installment of the "baby steps" novice Blender tutorials we focus our attention on the jam-packed bottom menu bar of the 3D View window and revisit the subject of making selections in edit mode.




In the previous tutorial we briefly touched on the 3D View pane's bottom menu bar and talked a little bit about the "modes" we expect to be working with when creating content for Opensim. Blender behaves quite differently in each mode so it's important to know which one you're in at all times. At least initially, the vast majority of your work will be done in either "Object Mode" or "Edit Mode" so the first little drop-down box of the pane's bottom menu will tend to serve more as a visual confirmation of your mode rather than as the mode selector that it is. You'll do most of your toggling between Object and Edit modes using the "tab" hotkey instead.

"Mode" is an over-used word in Blender in the sense that it gets tacked on to the end of a lot of other words. When someone says "Mode" by itself, or prefaces it with the name of one of these, this is the mode they're referring to (what I think of as "main" modes).

It's also common to see the term "display mode" which I suppose is more of a misnomer. Everyone uses the term but it's more correctly called "display method" and is selected using the second little icon on this bar. Clicking it reveals a drop-down box offering you a number of options.


If you've set Blender to use the Cyles Render engine (as recommended) then for Opensim content creation we will spend almost all of our time using only three of these: texture, solid or wireframe. The display mode has absolutely no effect on what you export. All it does is change the appearance of your objects when you're looking at them in Blender.


The subject of texturing in Blender is a lengthy one so we'll save it for another series of tutorials. The basic idea, though, is to set up "materials" for the various surfaces of your mesh. Each material can be given a plain solid appearance (like putting a "blank" texture on a prim) and then tinted to whatever colour you want. You can also assign it an entirely different texture, as I've done above by giving Suzanne some fur, and putting different floral fabric patterns on each face of the cube.

To make it very easy to spot and work with various materials, I tend to use light and vibrant colours for my "solid" assignments and will work with them in "solid display mode." When I then move on to working in more detail and precision with the actual textures I want to put on the object, I switch into "texture display mode" to be able to see the effects of my work immediately on screen. When I'm editing an object (and in a few other cases) I'll sometimes switch to wireframe mode which can be more convenient in many situations. The above picture shows you the same objects in all three display modes.

Let's now hop to the opposite end of the menu bar where we see six little icons that I didn't label in this tutorial's first picture. The two on the extreme right relate to rendering which doesn't apply to us as Opensim content creators. The next two change the "snap" settings which are roughly analogous to the "snap" steps in your viewer's editor except with more control. I rarely use them, personally, preferring to work with numerical precision instead. The next little button acts as a toggle to enable and then select between various "proportional editing" options and those aren't something you'll likely use until you're a considerably more advanced user. The sixth relates to cameras which you won't use except for a few special (and advanced) operations.

This brings us to twenty (20!!!) little buttons: your layers.

Layers

If you've used Gimp or PhotoShop, you almost certainly already know what a layer is except that layers in Blender are much less complex. A Blender layer from our perspective is simply a very convenient method of organizing multiple objects to make them a bit easier to work with. You might want to think of them as having a bunch of windows open on your computer, all running the identical program and all simultaneously working on the same file and with the same view.

Each object you create in Blender can be placed on any one of these 20 layers and later moved around at your convenience. You can pick which layers to show and which to hide. The ones that are showing are combined to present you with a single view on your display, and anything that's hidden is temporarily invisible (much like clicking the little eyeball beside an object in the Outliner pane). If it isn't visible, you can't accidentally select it and it won't obstruct your view of the thing you're working on.

To see a layer, simply click on its little box here. If you hold down the shift key when clicking it adds that layer to your view. If you do that same again, it hides it again. A visible layer's box is shaded dark grey and a hidden layer is shaded light grey so in my pictures, above, I've selected both the first and second layers and none of the others.

Any layer that has 1 or more object sitting on it will have a dot inside its little box to let you know that it isn't empty. If you look closely at my pictures, you'll see a dot in each of the first three layers' boxes. That's because I put Suzanne on layer 1, then I placed the cube on layer 2, and finally I put a sphere on layer 3. I wanted to show you the monkey and the cube so I shift-clicked on their layers to display them, and I left the third layer with the sphere on it hidden.If I wanted to do some work on Suzanne, that cube might get in my way (visually) so I'd just click on the 1st layer to select it and automatically hide everything else.

There's no limit to how many objects you can place on a layer and for the time being simply use them as a convenient way of managing multiple objects. When you begin to use some of Blender's more advanced features there are some operations and controls where the layer arrangement becomes more important but these will rarely be used for Opensim purposes.

Blender loves using hotkeys so of course layers have them too. To pick a layer use the corresponding keyboard number. For layers 11-20 you hold down the ALT key and then a number, where ALT+1 is layer 11, ALT+2 is layer 12, etc ...up to ALT+0 for layer 20. If you want to add a layer to the view rather than switch to it, hold down the shift key and then press the layer number you want.

When you switch into edit mode you are only working on the current primary selected object and the layers buttons all disappear. I find this a bit of a nuisance and am not sure why Blender chose to do this since they stay there in all other modes. Luckily the hotkeys all still work provided you're able to remember which layer contains the stuff you want to show or hide.

Transforms Buttons

Although I've labelled them separately in the picture at the beginning of this tutorial, the pivot center, transform maniputors, and orientation buttons are all related to the same subject: transformations. That's Blender's fancy word to lump three very common types of actions together: move, rotate, and scale. When you move something, rotate it, or scale it, you're "transforming" it.



It's possible you might not see exactly the same thing as shown in this picture since the first of the four transform manipulator buttons (the one I call the "transform control visibility toggle) acts as a toggle and, when off, will hide the three buttons beside it. To the left of this group of four buttons are two more -- one of them that's actually a drop-down box -- that also relate to transformations, as does the drop-down box to their right. Those outer three change the "context" of the transformation while the ones I've highlighted in this little picture control the type of transformation.

About 90% of modeling involves transforming something, or part of something, so we're going to be transforming a lot. The easier we can make this, the better, and the four "type" buttons are one "quick" method that Blender makes available to you.

The toggle button turns the capability on and off. When off, your selection won't have any "handles" on it at all but you can still move, rotate and/or scale it using another method (buttons in the toolshelf, hokeys, or via the menus). When on, a set of handles appears at your current selection and you can simply click and drag on a handle to do the transformation. You'll know which type of transformation it will do based on which of the other three buttons is highlighted which in turn changes the shape of the handles displayed on your screen.

Move, which Blender also likes to call "grab", uses handles that look like the ones you're familiar with in your Opensim viewer: red, green and blue arrows pointing along the x, y, and z axes. If you click on the red arrow and drag it, you'll move the selection in the x-axis direction just like you would when building with prims.

When you switch to rotate as the transformation type, Blender uses arched handles that, again, look like the ones you see when building with prims. Click on one and drag to rotate your selection on that axis.

The scale type of transformation is one that you don't see when building in-world. It as handles with little cubes on the end instead of arrows, letting you click and drag to scale your selection along that axis.

All three types of transformation are available to you at all times via the other methods. This is simply enabling the quick transform handles and then setting their type so you have yet another method ready and waiting for you to use.

Blender is quite a bit more sophisticated with transformations than Opensim allows you to be and that's the purpose of the "context" settings of the other three buttons. I won't go into detail about them here but if you've done a lot of building in-world you'll be familiar with "global" vs "local" transformation orientation. Blender offers a few more choices for that. The most basic choice is "global" since it will be the one you're most familiar with from in-world building.

Blender also allows you to assign a "pivot center" for your transformation which is something you don't have the luxury of doing when building in-world but once you see what you can do with it I'll bet you really wish you could. The default "bounding box center" choice is the one -- and only -- one you get when building in-world so if you're experimenting with them and forget which one to go back to, that's your go-to choice. The toggle for manipulating center points you'll usually want set to the off position.

When you set a context, that same context is applied to all methods of transformation, so if you use toolshelf buttons, hotkeys or menu they'll be applied to those as well.

All of this is available to you in both object mode and edit mode. When you're in object mode the transformation is applied to the entire object. If you have multiple objects selected, it applies to all of them and the context can affect how their relative transformations occur. When you're in edit mode the transformations only apply to your current selection...which brings us to our third and final discussion about making selections...

Selections - Part 3

When you switch into edit mode (hotkey: tab) there's an extra consideration involved when making selections and some additional options for making those selections, but it's easier to explain by taking you through it step by step so you can see it in action.

Just to practice a little bit of what we learned today, let's leave anything you happen to already have on your screen where it is and pick an empty layer for this demonstration. In my case the first layer I don't already have anything on is the 4th one, so I'll click on its box in the menu bar to select it. If you don't see those layers boxes that means you're in edit mode and need to use the tab hotkey or the mode select drop-down to return to Object mode.

Now we want to add a new mesh cube. Any time we add a new object to the scene we must be in Object mode and Blender will initially position the object based on the location of the 3D cursor (the little red and white target circle). If you've moved your 3D cursor away from the center of the screen, bring it back to the <0,0,0> position using the menu command "Object > Snap > Cursor To Center". That's where our new cube will be added.

Adding a new object like a cube can be done in one of two ways: use the menu to "Add > Mesh > Cube" or use the toolshelf (hotkey T to display the toolshelf if it's hidden) where you'll see a tab called "Create" and one of the buttons there is "Cube". Both methods achieve the same result.


Notice that the bottom of the toolshelf immediately changes to show that you've added a cube and to give you some additional options for it. In the case of a cube there aren't many options: you can only change its size (radius), location and rotation. For other objects there are frequently more options. We'll use the default cube ones for this tutorial. If you wanted to change the options you must do it now because as soon as you take any other action the options will disappear and be replaced by any options associated with that next action. Using ctrl+z doesn't bring them back, unfortunately.

When you add a new object it's automatically selected for you so you won't need to do so. Now let's switch into Edit mode by pressing the tab hotkey (or you can use the dropdown box on the menu bar if you prefer). You'll find that the entire object is pre-selected for you in edit mode too. Also you'll notice that your layers buttons have disappeared and been replaced by four new buttons: the three different Edit mode selection type options and a toggle button called "limit selection to visible."


In edit mode always need to be aware of which selection mode we're in because the effects of what we're doing -- and sometimes even the options available -- may change depending on which of the three modes is active. As you're hopefully remember from the previous tutorial, a face is the planar area that is enclosed by 3 or more edges (in our case 4) which are the lines that connect the defining location of the point-like vertices (our cube's corners in this case).

Normally this would be a perfect way to model a cube because it's the simplest, most efficient  design using the minimum possible number of faces. I want to show you an extra selection mode, though, and we'll need some more detail to work with so we're going to "subdivide" our faces a few times using a button in the toolshelf and then it's options.

If you can't see the toolshelf, use the T hotkey to display it. All the main tools are on the "Tools" tab of the toolshelf which will usually be selected by default until you change to a different tab. Blender remembers which tab you last used during a session and returns you to it next time you open the toolshelf.

There's lots of stuff in this side panel. You'll notice some transform buttons with names you'll recognize from our discussion a moment ago, plus a couple new ones. Below that, in the "Mesh Tools" section you'll see some buttons for "Deform" options, and then some "Add" button options. That's where the button we're looking for is located, about half way down the collection of buttons. Click "Sudivide."

As soon as you do so the bottom of the toolshelf will change to show you the options associated with the "subdivide" action. There are quite a few of them but we're only going to change one of them: the "Number of cuts" option at the top of the list. What subdivide does is cut our current selection into smaller connected pieces which rapidly increases the number of vertices and faces so from an Opensim perspective we try not to do this any more than we have to, otherwise the model's file size gets quite large which makes it slow to load into people's viewers in-world. For this demonstration we need some extra faces, though, so let's cut it 5 times which will now make you cube look like my picture here.


In the menu bar, make sure you have "vertex select" mode as your active mode. It's the icon with an orange dot in the corner of the cube to indicate that it's dots -- vertices -- that you'll be selecting. Now click on the vertex in the top right corner of your cube. The rest of the cube will go grey to show that it's not selected any longer, and only the one vertex you clicked on will be highlighted.

A new method of selection that we haven't talked about yet is called "expand" and is done by holding down the ctrl button and then using the numpad+ and numpad- keys (not the regular plus and minus keys). The ctrl+nupad+ combination expands your selection by selecting each vertex that is connected to a currently selected vertex by an edge. You can keep pressing this combination to further (and rapidly) expand your selection. The ctrl+numpad- combination does the reverse.

Play with this for a moment, then select just that corner again, then use ctrl+numpad+ to expand the selection just once. Now look at the bottom of your toolshelf where it is showing you the last action options. In the case of "select more" there's only one option: a check box for whether to "Face Step" or not. Toggle this and see how the effect of your selection changes. When "Face Step" is enabled, Blender tries to intelligently anticipate that you're ultimately interested in which faces are highlighted so it speeds things up by adding them when it seems logical, even if that means selecting a little bit more than the actual rule for expanding a selection would normally do. When it's disabled, Blender follows the actual rule precisely.

This same technique also works the same way when you're in edge select and face select modes and the "Face Step" method for predicting what you're interested in also changes a little. This predictive/intelligent face-stepping is a brand new feature of 2.73 that wasn't available in 2.72. Prior to this, it only had the strict "follow the rules" option.

This method of expanding selections can be extremely handy and much more rapid than any other selection mode and often becomes even more useful when combined with yet another selection method that is unique to Edit mode: loop selection.

Loop selection only works with portions of a mesh that are quads (four-sided faces) and is used to pick a row of connected vertices or edges, or a strip of faces. The easiest way to see it is to do so...switch back into vertex select mode if you aren't currently in it, then hold down the ALT key and click on any of the edges. You'll see a line of selections made along that edge. You can do the same thing in edge select mode as well. If you switch to face select mode, it will pick a loop if faces based on whichever edge you ALL+click on.Holding down the shift key and then making a loop selection will add that loop to your selection.

Using a mixture of loop selection and expanded selection techniques is often the fastest and most precise way to make selections in Edit mode, and you can always use any of the other methods we've already discussed to then add or subtract from those results.

With both of these selection methods, the primary selected vertex, edge or face will depend on where you first click. When using expanding selections your primary will remain the very first selection you made. With loop select it will be the nearest one to the point you clicked on the screen.

The "limit selection to visible" toggle button determines whether the faces of a mesh are displayed in a sort of half-wireframe way that allows you to select something that's behind a face. When it's enabled you can only select something that's closest to you and everything behind it is protected from accidental selection. When it's disabled you can often make your selections more rapidly but are somewhat more prone to selecting something extra my mistake.

The best way to get used to these techniques is to practice and "play" with them until they become second nature. It's worth doing so because a huge amount of what you do in Blender will depend on being able to make a selection and then transform it using one of Blender's many tools. The more rapidly and intuitively you can do this, the more it will speed up and simplify your workflow.
Selection made using three simple loop-select clicks in face select mode
and shown with limit select to visible disabled