Difference between revisions of "Blender Tips"

From PioneerWiki
Jump to: navigation, search
m (Mesh Modifier: Edge Split)
m ("in easily groups for easy control"!)
Line 24: Line 24:
 
=== Layers ===
 
=== Layers ===
  
Use Blender's layers to keep your objects in easily groups for easy control of selection and visibility. For example, the Lanner uses separate layers for:
+
Use Blender's layers to keep your objects in groups for easy control of selection and visibility. For example, the Lanner uses separate layers for:
  
 
# High detail static mesh
 
# High detail static mesh

Revision as of 14:53, 22 January 2013

Blender's UI

Some things to keep in mind when using Blender:

  • Do check the Blender Manual. It's not complete, but there is a lot of stuff in there.
  • Always have one hand on the keyboard and one hand on the mouse. Blender has lots of keyboard shortcuts, but you'll want to use the mouse to move the view around and position/scale/rotate things.
  • Most things in Blender are context sensitive, and that context includes: What is selected? Are you in edit mode? What window is the mouse cursor in? The last of those can be confusing, but it works as long as you stick to the golden rule of having one hand on the keyboard and one hand on the mouse (and it's necessary so that the keyboard shortcuts can be used efficiently). Operations that aren't available in the current context will typically not be shown at all, for example if you use the "Space Menu" when you're not in edit mode, then "Remove Doubles" (which is a mesh edit operation and therefore only works in edit mode) won't be listed at all.
  • The middle mouse button controls the view in all windows. That means it also works as a way of scrolling control panels (you can drag them with the middle mouse button or use the scroll wheel), scrolling window headers (you can drag them with the middle mouse button or use the scroll wheel), dragging curve editors, and so on.

Selection and Simple Editing

Basic controls that work in several places (e.g., 3D view, animation curve editor, UV map editor) include:

  • "Select All"/"Deselect All". 'A' key. If there is anything selected, this will deselect everything. If there is nothing selected, it will select everything. Extremely useful!
  • "Grab". 'G' key. For moving things around.
  • "Delete". 'X' key.
  • "Toggle Edit Mode". Tab key.
  • "Space Menu". Space key. Most things can be done through this menu; just open it and start typing the name of an operation (e.g., "Remove Doubles", or just "Doubles").

And probably a load more.

Object Management

Layers

Use Blender's layers to keep your objects in groups for easy control of selection and visibility. For example, the Lanner uses separate layers for:

  1. High detail static mesh
  2. High detail landing gear components (the animated bits)
  3. Medium/low detail static mesh & landing gear
  4. Collision mesh
  5. Thruster and navigation light tag nodes
  6. Decal meshes and label tag nodes
  7. Blender lamp & camera objects (you could just delete these, but they're needed if you want to make renders of the object outside the game)

The "select all" toggle ('A' key) only works on the selectable objects on currently enabled layers. So, when exporting the objects I use turn on a different combination of layers for different purposes. For the high LOD I turn on the high detail layers and the tag layers. For medium/low LOD I turn on the medium detail layer and the thruster/light tag layer (but leave decals & labels off). For the collision mesh I just turn on the collision layer.

Blender-layer-controls.png

Visibility & Selectability

The 'H' key hides currently selected objects. Alt-H unhides everything on the currently enabled layers. You can also control visibility for each object with the 'eye' icon in the Outliner window.

Selectability is useful too. This is controlled with the 'mouse cursor' icon in the Outliner window. In the Lanner, I have actual Blender text nodes attached to my label tag objects, so that I can get a better idea of where the text will go (actually this doesn't work great yet because the text in game is centered vertically on the node I think). I turn off selectability for the text objects, which lets me use the "select all" toggle to select everything for export while still excluding the text.

Blender-outliner-visibility-selectability.png

Meshing Tips

Mesh Modifier: Mirror

Lots of things you might want to model are symmetrical. There's no point doubling the work you have to do by modelling both halves separately, or awkwardly using manual duplicate & mirror operations to cope with this. Instead, just turn on the mirror modifier. You usually want to mirror the X axis, and have "Merge" turned on (so that vertices on the centre-line aren't duplicated).

Here is the Lanner's mesh in edit mode. Note that only half of it exists. The other half is being maintained by the mirror modifier.

Lanner-half-mesh.png

Here are the mirror modifier controls:

Blender-mirror-modifier.png

Mesh Modifier: Edge Split

The way the model responds to lighting depends on the surface normal. The surface normal is the direction that the surface is facing. A surface facing directly towards a light will be bright; a surface at a glancing angle to a light will be dim. The surface normal that Pioneer uses comes from the mesh data, but it doesn't actually come from the faces, it comes from the vertices. For a particular point in a triangle, the normal used for lighting is calculated by interpolating from the normals that are taken from the three vertices of the triangle. This is useful for curved surfaces, because although the triangle itself is flat, the interpolation of the normals makes the surface look like it's curved because the shading is right. However, it means that where two triangles meet, they have the same normal for lighting, which means that even if they're at a sharp angle (not just an internal edge of a curved surface) the lighting will make it look like it's not a sharp edge.

Here is part of the Lanner, with really weird lighting caused by having a sharp edge that shares normals.

Lanner-sharp-edge-incorrect-lighting.png

And here is what it's supposed to look like:

Lanner-sharp-edge-lighting.png

One way to achieve this is to duplicate the vertices along each sharp edge, so that the two sides of the edge can use different normals (note: this is what the "Rip" tool does). But that's a massive pain to edit and maintain because then if you want to reposition one of those vertices or change its UV coordinates, you have to make sure you move both copies at the same time, and for corners that connect more than one sharp edge you get even more duplicates.

The right way to do it is to use the "Edge Split" modifier. Edge Split does the same duplication of vertices that you can do by hand, but because it's a modifier you can just turn it on and it will manage the duplicates for you. Edge Split needs some way to decide which edges are supposed to be "sharp" so that it only duplicates vertices on the sharp edges. It has two ways of deciding whether an edge is sharp: you can give it an angle threshold, so all edges greater than the specified angle will be sharp, or you can mark edges manually. Here is the control panel for Edge Split:

Blender-edge-split-modifier.png

In this case, I've used a high threshold to avoid making too many edges sharp, and I've marked some edges manually as well. Here the manually marked edges are shown in blue:

Lanner-mesh-sharp-edges.png

To mark edges as sharp, select them in edit mode and use the "Mark Sharp" tool (type it in the "Space Menu"). The tool is a little confusing, because it has a mode toggle: in one mode it marks edges as sharp, in the other mode it clears the marks. So, first select the edges you want to (un)mark, then use the tool, and then if necessary toggle the check-box marked "Clear" in the tool controls panel.

Note: The tool controls panel is at the bottom of the 3D view tool panel, which can be toggled with the 'T' key.