Thursday, 10 September 2015

Blender: Overview of Modifiers

It's been a while since I last did a beginner level Blender tutorial but I've been meaning to write this one for a while since it's of fairly significant importance to people who want to model objects for use in Opensim: modifiers.

A few of my previous tutorials have touched on this subject when they guided you through the necessary steps to use the array and curve modifiers to make chains and other interesting objects, but I didn't spend any time talking about them in a general sense. Let's do that today.

Loosely speaking, a modifier is an action you want to take with a specific scene object, but want to be able to leave it as something to do later -- often just before you export it. Further, you want the flexibility to be able to change your mind about the exact parameters of that action, and you want to be able to continue working on your base model, as is, and have those changes react responsively to those changes. For those of you who have done a lot of Photoshop/Gimp work in the past, think of modifiers as being non-destructive layer effects.

As is the case with almost all aspects of Blender, there are a zillion options with modifiers, but a large number of them will be of little or no interest to us for creating in-world content. I'll focus on the ones I consider more generally useful for our purpose.

To use a modifier you first need an object. That's because a modifier does more or less what its name suggests: it modifies something else. That means we need a "something" before we can use a modifier since modifiers are context-sensitive to the type of object they're being applied to. If you're not aware of the distinction between types you might want to read my Overview of Blender Primitives tutorial.

Since the vast majority of objects we'll be working with for Opensim purposes are meshes, let's use our handy "Suzanne" mesh as our guinea pig. In Object mode Add > Mesh > Monkey (or use the toolshelf's create tab) and select her.

Now look for the wrench symbol in the Properties pane and select it...that's the "modifiers" tab. At the moment there will be nothing in the pane other than a "Add Modifier" drop-down because Suzanne doesn't have any modifiers assigned to her yet. With Suzanne selected, click the drop-down box and don't panic. You'll see a very large number of options appear.

The list of possible modifiers depends on the type of object, so if you were working with a curve you'd see a different (much smaller) list. Blender only lists the ones that are relevant to your object type.

For mesh objects you'll see they're grouped into four columns that distinguish the general classes of modifiers:
  • Modify: These ones manipulate data, UV maps, normals, and vertex weighting and are ones you may begin to use occasionally as you become a somewhat more advanced user -- particularly if you are doing rigging and weighting (part of animation).
  • Generate: These modifiers are all ones that result in actual changes to the topology of the mesh, either be adding new vertices/faces or by removing them. It's one of the two bread-and-butter modifier classes that will become your go-to ones.
  • Deform: This is the other bread-and-butter go-to class of modifier. Unlike the Generate class, this one leaves the topology of your mesh intact but changes its shape by moving the existing vertices around in some way.
  • Simulate: This class is one you'll likely become increasingly interested in as you become more familiar with Blender -- in particular the ones directly associated with physics simulation (cloth, collision, and soft body). I use these extensively when creating clothing by having Blender's physics engine (a full implementation of Bullet) help me drape it more naturally; but that's a subject for a more advanced tutorial.
For now, you'll likely want to stick with the two middle classes of modifier until you're extremely familiar with them and how they work. Later, you might want to investigate the others.

The key thing that distinguishes the two classes we'll look at today is that the Generate class almost always changes the actual vertex count of our object whereas the Deform class leaves the topology intact but alters their position/relation of vertices to one another. The former can result in drastic increases in vertex count so you'll need to be somewhat judicious in how (and how often) you use them. In spite of this, it's likely to be the class you use a little more often initially.

For our Suzanne model let's pick the "Subdivision Surface" modifier (commonly just called "subsurf") which is near the bottom of the list. I won't go into detail about what this modifier actually does, other than to say that it subdivides each face of your model to give it a smoother appearance -- but does so at the expense of a significant increase in the total vertex count (roughly 4 times as many for just one level of subsurf, depending on the exact topology of the model).

You'll see Suzanne's appearance change in the main 3D View screen, and you'll see an entry added to the modifiers list in the Properties pane.

This brings us to a very critically important property of modifiers: they're non-destructive! What this means is the actual mesh object is not being changed when you assign a modifier to it (if you switch to edit mode you'll see Suzanne is exactly the same as she was). A modifier is a "something I intend to do later" instruction that does not in any way alter the mesh until you apply it.

This means that you can edit and change the mesh in any way you want and the modifier will sit there, taking those changes into consideration and showing its effects based on the new shape/topology of your mesh.

Modifiers can be added to an object regardless of what mode you're in although typically you'll only add new ones while in Object mode or Edit mode.

Until you click the "Apply" button of a modifier it will remain there as an entry in the modifiers list for this object but the object itself won't change. You'll notice in the Outliner pane that a little wrench symbol will now be shown after the object's name in the listing to remind you that there are one or more modifiers assigned to it. You can select the object and go to the Modifiers tab of the Properties pane at any time to see what it is, alter its settings, or even remove it. Modifiers are all per-object, so you can add a different object to the scene and none of our Suzanne modifiers will affect it in any way.

You'll also notice that the "Add Modifier" drop-down box is still there at the top of the pane. You can have more than one modifier assigned to an object, so let's do that with Suzanne by adding a second one: this time the "Triangulate" modifier which is also one of the ones in the Generate class.

You will probably want to use a triangulate modifier on every single mesh object you create since Opensim (and SL) require all mesh imports to be made up exclusively of triangle-faced objects whereas all of your work in Blender is (or should be) done using primarily quad-sided faces. This modifier converts anything that isn't a tri into a tri. You can do the same thing to the mesh while in edit mode by selecting the entire object and using the Ctrl + T hotkey combination (or Mesh > Faces > Triangulate Faces), but you definitely don't want to do that until just before you export (since you'll want to preserve your quads as long as possible in case you want to make changes to it) and you'll want to have a saved quad-faced version of it to revert back to in case you want to make any alterations after you've looked at it in-world. It's a lot easier to have it sitting there as a modifier instead, then just applying it immediately before export.

You'll notice that this new triangulate modifier was added to the list in the Properties pane as a new entry below the existing subsurf modifer. You can have as many modifiers as you like (or if there's a limit I've never run into it) assigned to an object and the list of them is typically called the modifier stack, or just "the stack" in any other Blender tutorials you might do.

You'll see that the little header line of both of our modifiers is very similar, with almost all of the little icons being identical. These are ones that are shown on almost all modifiers and quite important.

  • The first little icon is a downward-pointing arrow which, if you click it, will collapse all of the modifier's settings and turn into a right-pointing arrow instead. Click it again to expand it once more. If you have a large stack of modifiers you might want to collapse ones where you're unlikely to need to change their settings again.
  • Next you have a little icon that indicates which modifier it is and beside that is a text box that by default will also tell you what type of modifier it is. You can change the name in the text box if you wish to use something more informative to remind you of your reason for using it but for the most part you're unlikely to need to.
  • Next we have a little camera icon that, for our purposes at the moment, is useless. This indicates whether the modifier should be applied when the scene is rendered in Blender which isn't something we'll be doing since our models are being made for export.
  • Beside it is a little eyeball icon. This allows you to toggle whether to display the effects of the modifier in your 3DView pane when you're in Object mode. This is a really important one which I'll come back to in a moment.
  • The next two icons (one that looks like a cube with the front 4 verts selected, and one that looks like a triangle) are toggles that control the appearance of the mesh when you're in Edit mode.

    It's a little tricky to explain their effects but they're also quite useful when you're modeling. The first determines whether to display the modifier's effects in Edit mode (so it behaves like the eyeball icon, above, except it's for Edit mode) and the second determines whether to adjust the actual edit cage to show it too.

    The easiest way to see the effect is to switch into edit mode with Suzanne, zoom in close to one of her ears, then toggle those two icons for the subsurf modifier and watch what happens to her mesh in your display.

    I typically use Blender's default to view the effect but not adjust the edit cage, but there are occasions where I will want to disable showing the effect and other occasions where I'll want to work with the adjusted'll probably develop your own preferences and habits as you work with them as well.
  • The next two icons are up and down arrows and are critically important. They allow you to move the modifier up and down the stack, changing the order of your modifiers, and this can have a drastic effect on the final appearance of your mesh. That's because modifiers are applied to the mesh in the order they're listed.

    To demonstrate this effect, try it now with just these two modifiers on Suzanne. Move the triangulate modifier to be first on the list and watch the effect. Then move it back to the bottom.

    The effect of our subsurf modifier is quite different when we triangulate the faces prior to subdividing them. With other modifier combinations it can be even more radically different, and of course the larger your modifier stack the more important the order of them can become.

    It takes some time, experience and practice to learn how best to order your modifiers and it's hard to give you any general tips since it depends greatly on exactly which modifiers you're using. The only sure-fire "rule" I'd offer is: always put a triangulate modifier on the bottom of your stack. If by some chance the faces are all triangles already it won't have any impact, and if they aren't then you'll know that your final mesh will conform to Opensim's import requirements.
  • The final icon is an "X" symbol. Clicking it deletes the modifier, removing it from the stack.
In all modifiers you'll also have, below that top line of icons,  an "Apply" button and usually also a copy button. There may be additional buttons here as well depending on the modifier.

As I mentioned earlier, the "Apply" button is your "Do it now" button...the modifier's effects will be immediately applied to the object and the modifier will be removed from the stack. You have to be in Object mode to apply a modifier, and when you do the effects will be applied based on the exact model as it is right now, ignoring any other modifiers that might be above it in the stack. This can result in your modifier not doing what you intended it to do if there are any unapplied modifiers above it; so typically you would only apply a modifier that's currently sitting at the top of a stack.

In theory when you export your object you have the ability, when saving, to apply all modifiers automatically (it's a check box in the export dialog) and it should do so in the exact order that they're listed. I have encountered a few instances in the past where either the order they were applied is incorrect, or where a modifier didn't get applied, so when I'm ready to export I now save the file (so my .blend is current); then manually apply each modifier, in order, from the top of the stack, until all are done; then finally export. It's a nuisance when working with a large number of modifiers but it's less of a nuisance than having them apply incorrectly and having to go back and do it all over anyway.

The "Copy" button adds a duplicate copy of the current modifier (including settings) immediately below the existing one in the stack. I've almost never used it and can't think of many occasions when it would be particularly handy.

I promised, above, to return to the little eyeball icon that shows the modifier's effects in 3D View since it's pretty important. There are several things worth discussing about it.

When you only have one or two modifiers applied to an object, and your scene has only a small number of objects, you'll probably want to have the effects of all of them all showing in your 3D View pane. As the number and complexity of modifiers increases, or as the scene complexity increases, you may find that Blender becomes very, very slow and unresponsive. That's because displaying it requires Blender to figure out what it will all look like after the modifiers are applied, doing it for each object and each modifier in order until it has a final "this is what it will look like" solution and, the more complex that is, the more Blender will struggle to do those calculations in real time as you're working.

As you start to work on more complex things you'll frequently need to either completely hide some objects in your scene (so Blender won't have to figure out how they're supposed to look) or disable showing some or all of you modifiers' effects unless it's something that directly effects the part you're working on at that moment.

When you're in Object mode there's an additional use to the eyeball icon. When the eyeball is toggled on to show the effects of the modifier, the mesh details shown in the Info pane (the main menu bar that by default is at the top of your screen) will be updated to show the vertex and face counts after all currently visible modifiers are applied. If the visibility of a modifier's effect is turned off, it won't be included in that total. When you're in Edit mode it only ever displays the details of the exact current model with no modifiers applied. You can use this to see just what effect any of your modifiers is having on the vertex count (particularly your Generate class ones) in case you need to make some adjustments to their settings.

Everything else that appears in a modifier's properties will depend on which modifier you've selected so it's not practical to try to detail -- or even generalize -- them here. You can find a complete listing of modifiers and details about what they do and what their settings mean in the main Blender guide. I will gradually do future tutorials for the ones that are particularly useful for Opensim (I've already done several that talk about the array modifier, curve modifier, and screw modifier which you'll find in my tutorial archives page).

That said, there's one pair of settings you may see fairly frequently that are worth commenting on here: the "View" and "Render" settings that you'll see on the subsurf modifier as well as a handful of others. For our purposes in Opensim you can pretty much always safely ignore the Render setting because the only time it is ever used is when you render a scene in Blender. When you export (or manually Apply a modifier) it is always the View setting that is applied. For Opensim purposes we're only doing the latter so that's the only one that's important to us.

A couple closing notes for this tutorial:
  • In my opinion it's very much worth spending some time playing and experimenting with each of the modifiers even if you don't see an immediate use for it. Just being aware that it exists can lead to new ideas, or might spring to mind as an easy way to accomplish something instead of modeling it laboriously by hand.
  • It's also worth noting that most of the modifiers can also be done via a command while you're in Edit mode, and often can be applied to just a selected portion of an object instead of the entire object. Modifers are always applied to an entire object although in some cases you are able to limit their effect to only specific portions of the mesh using something called "Vertex Groups" or, occasionally, by material assignment.

    A good example of this is the Bevel modifier which will smooth out sharp edges by adding new topology to make them a little rounded. This can add a lot of extra vertices and is often something you'll only want to do to certain, select edges. There's no way to do that via modifier -- you'd have to do it in Edit mode using that mode's bevel command. However, if you need to bevel an entire object it's far easier to do it using the modifier.
  • Modifiers I'd consider to be of significant use to beginners modeling content for Opensim would be
    • Generate class: Array, Bevel, Decimate, Mirror, Screw, Solidify, Subdivision Surface and Triangulate
    • Deform class: Curve, Displace, Lattice, Shrinkwrap, and Smooth 
    although that's very likely heavily influenced by the sorts of things I typically create. You may find less use for some of them than I do, and my make significant use of one that aren't on my list simply because you're interested in making different content than I do. There are other modifiers that I use extensively but aren't ones I'd expect a beginner to find useful (physics simulations and ones relating to vertex weighting).
Hopefully the above will give you a basic overall sense of how modifiers work and why they might be useful to begin learning about. As with almost any Blender subject, there's no substitute for getting your hands dirty...just dive in and play with them using Suzanne (or a cube or sphere) as your guinea pig.

No comments:

Post a Comment