Difference between revisions of "Making your first ship"

From PioneerWiki
Jump to: navigation, search
Line 72: Line 72:
 
We used the 'short cut' of building our model out of geometric primitives, instead of building it vertex by vertex. This means there are faces inside the model which should never be seen, and to reduce visual glitches, and strain on the renderer, we need to delete them.
 
We used the 'short cut' of building our model out of geometric primitives, instead of building it vertex by vertex. This means there are faces inside the model which should never be seen, and to reduce visual glitches, and strain on the renderer, we need to delete them.
  
* For each mesh, switch to vertex edit mode then select all with the 'a' key and choose 'Remove doubles' on the left-hand menu. This eliminates overlapping vertices.
+
 
 +
[[File:First.ship.double.sided.png]]
 +
 
 +
 
 +
* Switch the mesh to single sided.
 +
* Switch to vertex edit mode then select all with the 'a' key and choose 'Remove doubles' on the left-hand menu. This eliminates overlapping vertices.
  
  
Line 92: Line 97:
 
[[File:First.ship.incoplanar.2.png]]
 
[[File:First.ship.incoplanar.2.png]]
  
 +
 +
Press 'n' key and switch on 'normals' for faces. You might want to make them a bit longer than default.
 +
 +
 +
[[File:First.ship.normals.png]]
 +
 +
 +
This shows you which way your faces have their front sides pointing. Any that look darker than those around them from the front are suspect, but the acid test is looking for the little blue spikes. Chain select them, then flip them round with the 'Flip direction' button under 'Normals' on the 'Mesh tools' panel on the left.
  
 
==== Thrusters and lights ====
 
==== Thrusters and lights ====

Revision as of 22:37, 20 February 2013

Overview

This page describes point by point how to create your first ship, and get it into Pioneer. You should be able to do this from scratch within an hour or two, having no experience whatsoever. We aren't intending to cover much detail at all, but will rather give a simplified overview, and point to other pages with fuller explanations for once you're comfortable with the process.

Prerequisites

To follow this tutorial you will need:

  • A recent copy of Pioneer - using SGModel system. Anything since around Alpha 30 is fine
  • A recent copy of Blender - this was written on 2.65
  • A recent copy of GIMP - this was written on 2.8

Other 3D modellers or raster art programs will work fine, as long as you can work with standard formats such as Collada and .png

Step by step

Making a ship

More here: Blender Tips

Open Blender. The default scene should consist of a cube, a camera and a lamp. The camera and lamp are irrelevant and won't be exported, but that cube is going places ;-)

Box modelling

  • Make sure the mouse cursor is on the view of the scene, then hit Ctrl-alt-'q' to switch to quad view. This allows us to easily check we have lined things up correctly.
  • Shift-'a', then choose 'Mesh' -> 'Cube'. You've just added a cube to the scene. You won't be able to see it yet, as it's perfectly aligned with the 'default' cube: when you add things they'll appear where the 3D cursor is, and you can move that around with the left mouse button, or snap it back to the grid using the shift-'s' menu.
  • Move the mouse cursor onto the top down view, then hit 'g' to move the current selection (our new cube). Hold Ctrl to snap it to the grid, and move it a little further in the plus direction along the Y axis (in the direction the green arrow is pointing). Leave it just touching the edge of the default cube.


First.ship.cubes.png


  • Make two more cubes, and leave them touching the default cube on either direction on the X axis. You can use Shift-'a' for Add, or Shift-'d' for Duplicate.

Editing vertices

  • Right-click on the first cube we created to select it. That's the nose of our ship, so it needs to be a bit more pointed. Hold the middle mouse button in the 3D viewport, and swing the view round to get a better look at it.
  • Hit Tab to switch to 'Edit mode'. You can now Ctrl-tab between vertex, edge and face edit mode. We should be on vertex edit mode already.
  • Hit 'a' for deselect all. Right click on one of the bottom vertices at the tip of the nose. Hold shift, then right click on the vertex above it to chain-select it.


First.ship.vertices.png


  • Hit Alt-'m' for merge, and choose 'At first'. The vertices will merge, and any edges and faces between them are dissolved. Do the same for the other two vertices, to create a pointed nose.
  • We can also make the nose a bit longer, by selecting each of the newly merged vertices then typing 'g', 'y', '2', moving them both two meters further along the Y axis. 's' for scale and 'r' for rotate work in similar fashion.

Joining and separating

You'll note that the only vertices you can edit are those belonging to the currently selected mesh - you have to Tab back to 'Object mode' to select another object, then Tab back to 'Edit mode' before its vertices become visible. If we want to 'fill in' the areas between two meshes, we either have to use another completely separate mesh which lines up with the others, copy part of one mesh into the other, or merge them.

  • Tab back to 'Object mode', then hit 'a' key to select all. Hit Ctrl-'j' to merge our ship together into a single mesh.
  • If you want to separate off a section, select it, hit 'p' and choose 'Selection'.

Creating edges and faces

  • Now you can join up the section between the 'wings' and the 'nose'. Tab back to edit mode, and chain select two vertices. Hit 'f' to create an edge between them. Select three edges and hit 'f', and you'll create a face. You can also just select three vertices and hit 'f'; Blender will fill in the edges where needed
  • If you go wrong, use Ctrl-'z' for undo, or 'Del' key and select 'Only edges & faces'.
  • If you want to make things a bit more complicated, try Ctrl-left clicking to create new vertices and edges. You can also 'Subdivide' faces or edges from the pane on the left, or duplicate vertices, edges and faces with shift-'d'.
  • Hit 'z' to toggle wireframe view

Cleaning up

You should now have something resembling a simple space ship. Move things around until you're happy with the basic shape.


First.ship.shaped.png


While we could move straight onto the textures, we have a little bit of housekeeping due first.

We used the 'short cut' of building our model out of geometric primitives, instead of building it vertex by vertex. This means there are faces inside the model which should never be seen, and to reduce visual glitches, and strain on the renderer, we need to delete them.


First.ship.double.sided.png


  • Switch the mesh to single sided.
  • Switch to vertex edit mode then select all with the 'a' key and choose 'Remove doubles' on the left-hand menu. This eliminates overlapping vertices.


First.ship.internal.png


  • Using a combination of wireframe mode, and 'flying through' the model if need be, delete all the faces dividing the inside into compartments.
  • Sometimes the easiest way is just to delete internal vertices and edges - the faces will go with them.

We also need to add in any missing edges to smooth out the geometry. Any quadrilaterals whose vertices aren't all on the same plane should be divided into triangles.


First.ship.incoplanar.png


The above isn't going to look right with straight surfaces, so we fix it with an extra edge, and recreate the faces with appropriate triangles.


First.ship.incoplanar.2.png


Press 'n' key and switch on 'normals' for faces. You might want to make them a bit longer than default.


First.ship.normals.png


This shows you which way your faces have their front sides pointing. Any that look darker than those around them from the front are suspect, but the acid test is looking for the little blue spikes. Chain select them, then flip them round with the 'Flip direction' button under 'Normals' on the 'Mesh tools' panel on the left.

Thrusters and lights

...

Adding a texture

UV unwrapping

More here: UV coordinates in Blender

Switch Blender to 'UV Editing mode' using the screen layout widget at the top. The left half of the screen now represents the way the texture will be 'mapped' onto our model (analogously to the way a shoebox can be flattened out to its 2D plan, or a globe can be projected onto a 2D map).

Chain-select all of the faces on the top of the model, then hit 'u' and choose 'Unwrap'. A projection of that part of the model will appear in the UV space on the left. Do the same for the underside, the sides and the back. Use the 'g', 's' and 'r' keys to squeeze these sections in as tightly as possible to the grid.

First.ship.uvs.png

Ensure all faces are selected with 'a', then choose 'UVs' -> 'Export UV Layout' on the menu at the bottom left, and save the file.

Drawing a texture

More here: Textures

...

Creating a .model file

Adding the model to Pioneer