Blender Tips

From PioneerWiki
Revision as of 21:09, 9 March 2013 by Mikehgentry (talk | contribs) (Blender's UI)
Jump to: navigation, search

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. If you add a mesh in edit mode, you'll fuse its geometry to the present mesh instead of creating a separate object.
  • 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.

Tips for the 3D view

  • 'View Selected' pans and zooms to your selection, and sets the centre of viewport rotation. You need this! Numpad '.' by default.
  • Shift - middle mouse button moves the viewport around in a plane.

Tutorials

This was written before Blender's UI was rewritten, but is still useful: http://www.blenderguru.com/25-useful-blender-tricks-that-arent-so-obvious/

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, and Viewport Shading mode

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. Numpad '/' toggles 'local view', making all other objects invisible.

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

To the left of the layer controls is the Viewport Shading mode control, which switches the 3D and orthogonal views between solids, wireframes, textures and bounding boxes. The 'z' key toggles wireframe on and off.

Meshing Tips

Rotating, scaling and flipping

  • Pay attention to your Pivot Point, set just to the left of the layer controls.
  • 'r' toggles between two rotation modes.
  • It's often more precise to use the keyboard, e.g. hit 's' (scale), 'x' (x-axis), '1.5' (multiply by 1.5)
  • A simple way to flip something is to scale it along that axis by -1.
  • If you're trying to flip something and it insists on using its own coordinates rather than the global ones, switch to edit mode, select all the vertices and try again.

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.

Mesh scripts

Fixing broken geometry

Aligning two meshes by a vertex / face centre

  • Tab to object mode, select mesh to move, tab to edit mode and select target vertex or face
  • Shift-s, 'Cursor to selected'
  • Tab back to object mode. Object menu -> Transform -> 'Origin to 3D cursor'
  • Select other mesh, select target vertex or face.
  • Shift-s, 'Cursor to selected'
  • Reselect mesh to move, shift-s, 'Selection to cursor'

Aligning two faces which are both aligned to an axis

If you've got two faces on different meshes, both are aligned to a global axis, and you need to snap one to the other on the orthogonal axis:

  • Tab to object mode, select mesh to remain unmodified, tab to edit mode and select target face
  • Shift-s, 'Cursor to selected'
  • Tab to object mode, select mesh to modify, tab to edit mode and select target face
  • Make sure pivot centre is set to 3D cursor
  • Scale face to zero along orthogonal axis

Scripts for fixing geometry

If you've got two separate meshes which intersect, and need a vertex at that point, copy one of the intersecting edges of one of the meshes, hit 'p' and choose to separate by selection. Tab back to object mode, chain select the free edge and the other mesh, then alt-j to join. Back to edit mode, select the newly joined edge and the intersecting one, hit 'w' and choose 'Edges X intersection'