Thursday, 26 March 2015

Blender: Baby Steps II

In the first "baby steps" tutorial we looked at the overall Blender interface and tried to make it just a tiny little bit less scary. In part two, we continue that process and look at a few specific things that are of particular importance to us as Opensim content creators.

At the end of previous part of this tutorial we added a monkey to the scene. Yes, a monkey. Her name is Suzanne. Why? No idea...that's what the folks at Blender call her and she's their monkey so they ought to know. If you were following along, your screen will look like this.

Take a deeeeeeeeeeeeeeeeeeeeeeeeeeeeeeep breath...


Okay...that's some scary stuff, isn't it? Particularly with all my little notes added to it. Don't panic.

Yes, there's an awful lot of stuff there and when you don't know what any of it means or what it's for, it's pretty darned intimidating. Even worse, a considerable amount of it will change somewhat depending on what you're doing.

The flip side of this interface overload is that once you do know what it is and what it's for, you'll be blessing them for putting it all where it is so you don't have to go search for it, slowing down your work flow or hiding that critical piece of information you need to avoid f***ing something up.

So many programs these days try to simplify workspaces...they hide everything to make it more "user friendly". Actually what they're often doing is making it novice-friendly at the expense of making it user-functional. Blender hasn't gone that route, bless them! All you have to do is keep a bit of an open mind about it while you're learning.

Let's get some easy stuff out of the way.

The Info Pane Revisited

The info pane is that main menu bar across the top and you'll be happy to hear that you almost never need to touch it. You'll barely use it at all, in fact.

There are 4 menus and the only one of any interest to an Opensim content creator is the first one: the file menu. That's where you save files, load files, export files, import files...and set user preferences (which you'll very rarely change now). We don't Render because that's not what we're interested in for Opensim, we're unlikely to need/use anything in the Window menu, and Help is that place where you find help and instructions that nobody ever reads anyway. It would get a lot more use if it had the name "Don't look in this menu" instead. But then I wouldn't be writing tutorials...

Beside the menu are three drop-down boxes.

View Selection: In the first part of this tutorial we took a brief look at this...it's access to the 9 different preset views Blender gives us depending on what we're doing. If you were following along and replaced the Timeline withe the UV/Image Editor at the bottom you won' t need this at all until you become a fairly advanced user and start doing animation work. By the time you're doing that, you'll have lost all fear of the interface. Until then, "Default" view will be what you use.

The Middle One: Yes, it's so important that I neither know its official name nor have I even bothered to give it a pet name of my own. It's of interest to people doing renders, which isn't us. Just pretend it isn't there.

The Render Engine: About 99% of the time anything that relates to rendering is something we can safely ignore.This drop-down is no exception except that it is actually responsible for setting the rendering engine used for the scene and we want to be using Cycles render. Right now it doesn't matter in the slightest if you use the default Blender render engine instead, except that the way materials are set up becomes different. As you become more advanced I'm confident that you'll want to be using Cycles (it's better!) so you might as well start now. That's why I recommended setting it as your start-up file's engine in the Virgins and Mice bonus tutorial. Once you've set it, you'll never need to change it again.

Everything else up there is information about the current scene which you'll glance at periodically -- mostly to make sure you haven't done something that's going to make your mesh impossibly large to import in-world. We'll talk about that another time.

The 3D View Pane (Main screen) Revisited

We're going to revisit this one quite a lot during this series of tutorials. As you'll recall, this is the main portion of the screen where we'll be doing the bulk of our work. It has two side panels that are shown or hidden using the "T" (toolshelf) and "N" (properties) hotkeys. It also has a fairly complex menu bar running along the bottom with a ton of little icons on it in addition to its four menu categories.

The toolshelf on the left we'll talk about in other tutorials but there's a section at the very bottom of it that I want to draw your attention to. I've labeled it the "Most Recent Action Options" area. Whenever you do anything in Blender's main 3D View pane, there's a very high chance that something will show up here. It might even be every single time you do something but it's possible I'm forgetting a case where it doesn't.

The thing that shows up is the name of the action you took and any parameters or options associated with that action. Sometimes these are options that aren't available to you prior to taking the action. As an example:

When you add a cube, you don't have any options. You just go to the 3D View pane's menu and pick Add > Mesh > Cube. The moment you do that, the cube appears on the screen and suddenly there are a bunch of things you can change about that cube immediately, all displayed in that most recent action area. You can change the values there to affect its size, position, and rotation.

As long as you don't take any other action at all those options will continue to be available to you and can be changed. You're allowed to adjust your view, but nothing else. As soon as you do something else, that new action will replace it and you'll have lost your ability to use that area to change your cube -- you'd have to do it another way. Sometimes doing it another way is easy. At other times it's a nightmare.

[EDIT]
When I originally planned the content for this tutorial and created the picture, above, I intended to cover a few more elements of this pane in a little greater depth. Looking at the total tutorial length, though,  I've decided to cut those parts and cover them in a subsequent tutorial instead. There was simply too much new material packed into this one and I think it would result in information overload.

We'll talk a bit about the one I labeled "Current Mode" but we'll skip the rest of the stuff on the bottom bar for this session. Instead, we'll very briefly look at the right hand side and move on.
[END OF EDIT]

The properties panel is one we'll touch on periodically throughout the tutorials but I wanted to draw your attention to some of the information that's presented there.You can change values here, manually, and those changes will be reflected by actual changes to the object; but until we have a grasp of selections I don't want to go into any great detail here about how that works. For now, treat it as a source of information.

There are a couple things that are of considerable interest, though.

You'll notice that the entire panel is subdivided into little sections with lines between them. Each section has a black arrow at the top left corner of it that acts as a "show/hide"button. If the arrow is pointing down, the section is "expanded" and being shown. If it's pointing to the right, it's hidden. There's a lot of stuff here we rarely need to refer to so you might want to hide some if it. Just remember that it's there.

You can even drag these little sections up and down the panel to change their order. The handle you click on to do this is the little dots to the right of the section's name. Via the user preferences you can go really wild and add and remove almost any section from any panel on any pane. Blender is the absolute ultimate when it comes to having your own custom work environment.

This same approach is taken to all panels and many panes. You'll see them in the toolshelf (though fewer of them) and you'll see many of them in the hugely elaborate menus of the Properties pane. In my picture I've selected the "Object Properties" tab which has an icon that looks like a little cube. Just by selecting that tab, everything below it changes. Some of the information there is a duplicate of the properties panel of the 3D View window (but you will often have that panel hidden) and some if it is completely new (and scary so we won't look at it today).

The reason I'm pointing to the Properties pane in this tutorial is only to show that it shares this approach to the sections (hide, expand) and that setting found on one pane are frequently also found on other panes as well. This might not seem all that efficient a use of screen space until you remember that Blender has no idea at all about which panes a specific user will have on their screen, so anything that is relevant to a pane needs to be included on it, somewhere.

In the 3D View pane's properties panel I've pointed out a few areas of interest:
  • the "Transform" section at the top where you can see things like location, rotation, scale, and dimensions...the same information is duplicated in the Object properties tab of the Properties pane. You can change a value manually (and with numerical precision) and it applies the change\ to the model. Some of these will almost feel comfortable to you...that's the same sort of information you're used to seeing about prims in your viewer's editor. And then some.
  • a bit lower down is the 3D Cursor section which tells you the exact current location of the cursor (the white and red target thing). Yours will probably be saying <0, 0 , 0>. Changing these values lets you position your cursor (with numerical precision).
  • just below that is the "Item" section where you can name the currently selected object (in my picture it's the money mesh "Suzanne")...this is also shown at the very top of the Object properties tab of the Properties pane. You can change it in either location and it will update the other one.
  • I also pointed to the "Display" and "Shading" sections as my example of a hidden section (Display) and an expanded section (Shading). On your screen they may both be expanded or be reversed.
Once you become slightly more comfortable with Blender you'll really appreciate all of this stuff being here. But gosh it's intimidating for a new user! For now, keep in mind that there isn't anything you can really do to break anything and sometimes playing with things to see what they do is just as valuable a learning experience as any other. Just save a lot so you can recover your work if necessary.
As a side note: saving you file, frequently, is a good idea for even the most experienced users. Blender's tendency to crash is far less often than it was even a year or two ago, but it does still happen. Also, having a saved copy to revert to can be handy.

We won't spend any time at all in this tutorial looking at the Properties pane so let's continue our tour with another look at the Outliner.

The Outliner Pane Revisited

We won't revisit this one for very long but there are a few things here that need to be pointed out. You'll notice that by adding our monkey mesh to the scene she's now also been added to our list of scene objects in the Outliner pane.

The name given to the object is what shows in the list. You can double-click on the name and change it here if you like. You can also right-click on it to bring up a context-sensitive drop-down menu that includes an option to rename it. There's also a box in the 3D View pane's properties side panel where you can change it (I labeled it in the picture above) and some of the other panes also give you a place to change an object's name.

When you have only one or two objects in a scene it isn't all that important to name them. When you start getting 20 or 30 or more, taking the time to give each one a meaningful name is worth it. Names must be unique...if you try to use an identical name the other object that already has that name will be given a .001 suffix. Imagine a list of objects called cube.001, cube.002, cube.003....cube.030. Do you think you'll be able to remember which cube is which if you want to select if from this list? Very unlikely. Naming them makes them easier to locate later in a busy scene.

To the left of the name is a little upside-down triangle which tells us it's a mesh object. There are other types of objects that use different icons. For Opensim, only mesh objects can be imported. Anything else either can't be imported or needs to be converted into a mesh first.

There's some other stuff on the right-hand side of the object's name which will change as we work with it. Right now all you'll see is the same upside-down triangle that tells us it's a mesh. When we add a material or two to the mesh, it will get another icon telling us we've done that. Other icons will appear when you add other things, so these serve as handy reminders as to whether you've done something or not. There's more to it than that, but not at this level.

Lastly, out at the far right are three more icons.
  • The eyeball is something you can click on to quickly hide/unhide that object.
  • The arrow is something you can click on to quickly toggle whether you're allowed to select that object.
  • The camera icon determines whether to render it which means we get to ignore it.
A few last comments before we leave this area because this can be confusing to a new user
  • If an object has been selected in the scene its little icon will be highlighted in orange. If it isn't currently selected, it won't. 
  • There is also a light grey or dark grey shading that can be applied by clicking in the line..I don't have the faintest idea why because it does not indicate anything at all about whether it's selected or not. If the grey highlighting has a use or function, I haven't discovered it yet. As a novice user this can be extremely counter-intuitive and misleading! Just remember that grey highlighting in this pane is meaningless. Orange highlighting is what you're looking for.
  • If you click (single left click) on something in the list it selects it. This is very handy when you're in Object mode (we'll talk about modes in a moment) but can do unexpected (but useful) things when you're in one of the other modes. When you're first getting started, though, my advice is only to click on names in the outliner when you're in object mode.
  • There are a lot of other handy things you can do in the outliner pane to help organize and even manipulate objects. Unfortunately this means you need to exercise a little bit of care when clicking here to avoid accidentally doing something you don't intend to. As a beginner you'll likely under-appreciate this pane and use it primarily to make selections.
This brings us conveniently to the subject of selections.

Selections - Part 1

Talking about "selection" in Blender is a bit like talking about snow in the arctic or sand in the desert...if you don't live there the single word is just fine. If you do, your immediate thought is "what kind of snow?" or "what kind of sand?" or in the case of Blender, "what kind of selection?"

It's not quite that bad; but it is important. Happily for our purposes we only need to be aware of five types of selection and they're split into three main types:
  • object selection which involves selecting an entire object (much like selecting an entire prim) or group of objects (a bit like a linkset)
  • face, edge and vertex selection which doesn't have a very good Opensim analogy...think of these as the things that are use to create a mesh object.
  • other stuff which is a rather large assortment of things associated with objects that aren't mesh which means in many cases we won't be using them or they'll be the only selectable things available to you when you're working with them so they'll be a bit self-evident. They have different names, though, so it can be a bit confusing at first if you're reading about them.
The key determining factor about which type of selection we're doing is our current mode which is set using the drop-down box immediately to the right of the menu options in the 3D View menu bar (the one at the bottom of the large main viewing area).

By default you'll be in "Object mode" which means any selections you make are objects. In almost all other modes you'll be working with a single object and selecting its individual faces, edges or vertices (if it's a mesh object) or its "things" (handles, control points, etc. if you're working with non-mesh objects). You can see a list of some of those modes by clicking the drop-down box.


I say "some of those modes" because the list of available modes is determined by which object is currently selected. Selection and mode are inter-twined. The ones you see above are the modes that you can switch to when Suzanne (or any mesh object) is selected. There are other modes but they don't apply to mesh so they're hidden.

The vast majority of your work (at least while you're learning) will be done in either "object" mode or "edit" mode and, since it's so common, Blender helpfully makes the tab key the hotkey to switch between them. Strictly speaking, the tab key is actually the hotkey to switch from your current mode into edit mode and back again.

As your skills expand, the mode you're most likely to experiment with as your third one is "sculpt" mode -- referring to the artistic discipline of sculpting, not the Second Life "sculptie" type of mesh -- so if you are in scupt mode and press the tab key, you'll enter edit mode, then pressing tab again will return you to sculpt mode. For now, though, you'll likely be spending 99.9% of your time in either object or edit mode.

The bottom line of this, for a beginner, is that in object mode you'll be selecting objects. In edit mode you'll be selecting either vertices, edges or faces; or if you're working with something other than a mesh object you might be selecting one of those "other stuff" things. When you're in one of the other modes you're usually selecting the same things you'd be selecting in edit mode but it varies a bit from mode to mode depending on what's relevant.

Making life easier, the way we select things is almost universal regardless of what we're selecting or which mode we're in. It's the mode that determines what we select. The "thing" can be any of the types we discussed a moment ago (objects, vertices, edges, faces, and "other stuff"). When you select something, Blender highlights it to clearly show you that it's selected.
  • Selecting one thing is a matter of clicking on it (and if you've reversed your mouse keys as I suggested, that means a left-click).
  • If you're in object mode, you can also select something by clicking on its name in the outliner pane.
  • Selecting a second -- and any additional -- thing can be done in the same way while holding down the shift key.
  • Clicking on an already-selected thing while holding down the shift key will deselect it again.
  • You can select a group of things by pressing the hotkey "B" (for "bounds select" although I've also seen it called "border select") which will turn your mouse pointer into crosshairs. Then click and drag to select anything that falls inside the rectangle formed between your starting point and the point that you release. This always adds to any existing selections rather than replacing them.
  • If you press the B hotkey, then hold down the shift key, then drag your selection box, anything inside the box will be deselected. If you prefer, you can press "B" then hold down your middle mouse button (but not the shift key) to make the "deselection" instead.
  • There's another way of selecting larger number of things: "circle select" which is activated with the "C" hotkey and turns your mouse pointer into a circle. This one takes a little bit more getting used:
    • holding down the left mouse button (if you've swapped your mouse buttons) will add anything new that is inside your circle. You can drag it around while holding it down to keep "painting" more additions.
    • you can use your mouse's scroll wheel to change the diameter of the circle (even while in the middle of "painting")
    • you can press your middle mouse button and "paint" to subtract from the current selection
    • you can hold down the shift key and left-click paint to subtract from the current selection
    • when you're finished, press the right mouse button (assuming you've swapped your mouse buttons) or press your keyboard's Enter key to leave circle selection mode
    As I say, it takes a little getting used to but it can be a very fast method for selecting things.
  • And finally there's the magic hotkey button "A" that acts as a toggle between "select all visible" and "select none". If nothing is currently selected it will always select all. If one or more things is selected, it will select none (and then pressing it a second time would then select all).
  • When in object mode, anything you've marked in the outliner as being non-selectable (by toggling the little arrow icon to the right of its name to off) will ignore any attempt you make to select it. If it's already selected, switching it off in the outliner will deselect it.
While this might all sound a bit complicated, you'll be surprised how rapidly it becomes second-nature once you start using it.

Oops! (Undo)

I really shouldn't go any further in this tutorial without mentioning that Blender offers you the standard "oops!" capability of undoing something you just did: the hotkey combination ctrl + Z. It's actually a super-charged undo that is limited only by the number of steps you're willing to let it remember and/or the amount of memory you can let it use to store those steps.

By default Blender remembers and can  undo your last 32 steps. If you're working with normal file of the size that would be suitable for export to Opensim this won't occupy too much memory (although it's not uncommon for more complex scenes to have it climb into the range of a few GB). If you start to work with very complex scenes, or high resolution models, this can rapidly gobble up all of your available RAM and (shudder) go into virtual RAM.

The amount of RAM being used to store your undos (as well as your active file) is shown as part of that data I referred to above in the Info bar. The actual .blend file size when you save will usually be much less because it doesn't store undo data with the file.

You can change the number of steps and/or limit the amount of memory Blender is allowed to use by changing this setting in the User Preferences (Editing tab). The default values (32 steps and unlimited memory) is fine to begin with though.

I say Blender's undo is "super-charged" because there's a twist: if you enter edit mode and make some changes, using the ctrl+Z undo will undo each action step by step while you're still in edit mode. If you exit edit mode and return to object mode, a single "undo" will undo all of the changes you made while you were last in edit mode, not just the last change. This can lead to some surprises if you do it without thinking. If you only want to undo your last step, go back into edit mode first, then undo.

There's a redo too which in Blender is ctrl + shift + Z (many Windows users will be expecting ctrl + Y which isn' the undo). If you've undone something this will redo it.

Where are they? If you're used to working with menu-undos/redos in other software, you'd expect "undo" and "redo" to be in the main menu's edit menu. Trouble is, Blender doesn't have a main menu (remember, that thing that looks like a main menu is actually an Info pane) and there's no "edit" menu anywhere. Fear not, there is a menu way to access undo...it's in the 3D View pane's menu (at the bottom of the main screen area) but the exact name of the menu button depends on what mode you're in. In Object mode it's in the "Object" menu, in Edit mode it's in the "Mesh" menu, in scupt mode it's in the "Scupt" menu, in....well the chances you'll remember any of that is pretty small so let's stick with remembering ctrl+Z is undo, and ctrl+shift+Z is redo. In Blender, hotkeys are usually an integral part of the workflow, not an alternative to it.

While you're doing something, there's a "woops, I didn't mean to be doing this" abort ability too: the escape (esc) key on your keyboard. This doesn't undo anything, it just aborts an action that you've initiated but haven't finished yet (like the bounds and circle selections we talked about a moment ago).

Usually the right-mouse button (if you've swapped your mouse buttons) does the same thing as the esc key, with a very small number of exceptions. Circle select is one of those exceptions where the right mouse button is "I'm finished" instead of "woops...stop." In bounds select the right mouse button cancels the operation.

Face, Edge, Vertex

I guess this is also as good a time as any to explain what a "face," an "edge" and a "vertex" is when talking about mesh, although perhaps you'll already have a good idea.

A mesh is composed of "faces" where each face is defined by three or more edges that meet at shared vertices ("vertices" is the plural of "vertex"). A simple cube, like the one above, has six faces (you can see only 3 of them here). Each face of the cube has four edges (the lines) and 4 vertices (the dots at either end of the line).

In Blender a lot of our work involves manipulating these. You will frequently be switching between these three -- mostly in edit mode -- and it's important to understand that they're all interdependent. When you edit a face you're changing all of the edges and vertices that define that face. When you edit an edge, you're affecting the two vertices at either end of it as well as the shape of any face it helps to define. When you edit a vertex you're affecting any edge and any face that it's part of. When you're in object mode it's like working with every face/edge/vertex selected...you're working with the whole thing.

In Blender we try as much as possible to work with faces that have four edges (and thus four vertices). These faces have a special name: "quads". Blender can also work with triangular face (called "tris") or with faces that have 5 or more sides (usually referred to as "n-gons") and any mixture of the three; but it's "happiest", most convenient, and considerably more flexible when working with quads. Unfortunately Opensim (thanks to a decision made many moons ago by Linden Lab for Second Life) only accepts triangular faces.

The good news is we can do all our work with quads then use a handy Blender feature to convert them all to triangles at the end. The bad news is converting quads to tris doubles the face count.

The even worse news is that Blender happily works with double-sided faces. Opensim doesn't (thanks again, Linden Labs). If you want a face to be seen from both sides you actually have to model two faces with a small space between them, at least doubling the face count yet again for your object. Don't ask me why Linden Labs decided to do it that way. Most likely because they never originally intended to allow us to work with anything other than default prim shapes and lacked the foresight to realize we'd want to.

Now that we've completed our topical detour let's return to the subject of selections.

Selections - Part 2

Complicating matters when it comes to selections is:
  • When you're in object mode much of the information that's displayed in the 3D View pane's properties side panel is only for the current "single one selected thing" which I tend to think of as the "primary selection." It's not for some attempted average of "everything selected. In edit mode it's the other way around, usually representing an average of all selected faces/edges/vertices.
  • Almost all of the Properties panes tabs supply data that is only for the "primary selection," not an average of all current selections.
  • Some Blender operations are applied to "everything you've selected"
  • Other Blender operations are only applied to the "primary selection" without in any way affecting anything else that's also selected.
  •  Yet other Blender operations base the way the operation works on the "primary selection" using the "other stuff selected"
Needless to say, this can get confusing for a novice -- heck, at times I can still find myself a bit lost when it comes to this stuff -- so don't be upset if it takes a while to get used to this and even longer before it becomes second nature. Remember, ctrl + Z is your friend!

The one happy note in this confusing subject is that the importance of primary selections is typically not all that great until you start using some of the more advanced features. In many basic situations it doesn't matter at all.

It does beg the question, though, as to how one knows what this special "primary selection" is and how one goes about making sure the thing you want as your primary selection actually is your primary selection.

Sadly, as you can see from the above picture, Blender isn't entirely consistent. When you're in object mode the primary selection is bright orange and anything else that's selected is a red-ish orange. When you're in edit mode you'll be selecting either faces (as shown in this picture) or edges or vertices. In edit mode the primary selection is highlighted in a bright white while everything else that's selected is highlighted in bright orange. In both Object and Edit mode anything that isn't selected won't be highlighted at all. In other modes the primary selection (and selections in general) can be shown in yet another way.

Seeing your primary selection often all boils down to singing a Sesame Street song to yourself while looking at a group of selected things..."one of these things is not like the others...."

There are a couple rules that determine which is the "primary" object/face/edge/vertex/thing:
  • No matter what you're doing, if you have a number of things selected and then select exactly one more thing (by shift-clicking on it when it isn't already selected) it becomes the primary selection. This means you can select a bunch of stuff however you want to, then deselect the one thing that you want to have as your primary selection, then reselect it. This always makes it the primary.
  • If you add to a selection using either border or circle select, whatever was the primary selection before this will remain the primary selection after it.
  • If you have an existing primary selection, then use the "A" hotkey to deselect all then use it again immediately to select all, the previous primary selection is remembered and becomes the primary selection for all.
I'm sure this is making your head spin at the moment but let me re-emphasize that when you're first starting out the importance of primary selections is minimal. I only bring up the subject at all because you'll need to be aware of it, and that when something you're trying to do doesn't work the way you though it would, or if the information you're seeing somewhere isn't what you'd expected to see, the "primary selection" consideration might very well be the reason.

There's a third part to this subject of making selections and it only applies to edit mode. It's also far easier to explain by having you "do it" rather than trying to explain it in words or show you with pictures, but it also begs to be done while looking at other elements of the 3D View pane while in edit mode.

This tutorial already being extremely long and packed full of information, let's leave that for next time and give you a chance to digest what you've learned from this one.

___________________________________

I find myself struggling with explanations and order of presentation for some of these novice tutorials because Blender's most basic elements are highly interdependent and also highly sensitive to the context they're being used in.

I want to avoid not telling you something that's relevant even at the most basic level, but because of this context-sensitive interdependence there's a lot of different subjects and new terms that have to be thrown at you in a very short span of time and will be hard to absorb.

I find that in cases like this it's often best for the student to read through once, absorbing and understanding as much as they can,m and then go and play with it to see how it works. Then later come back, re-read, and usually the parts you haven't absorbed or understood will make a little more sense.

All I can do it urge you to persevere. If you're like me, there will be this "eureka!" moment when suddenly the entire Blender interface will go "click" in your head and begin to make sense. Once this happens it will change -- almost instantly -- from being a scary, overwhelming, intimidating environment into one that you realize puts everything you need almost exactly where you want it to be.