Making your first ship from scratch

From PioneerWiki
Jump to: navigation, search

Creating a ship for Pioneer, step by step. This step by step tutorial is intended to guide contributors trough the process of modeling, texturing and setting up a ship, and then putting it into Pioneer. It won't cover basic modeling or design questions in depth, but it will be more like a case study on ship creation, from idea to making it into a mod file. Working knowledge of the basic handling of Blender, GIMP and Inkscape, or equivalents is assumed. Note that this article isn't intended to be a tutorial on these tools.

Software

We will use the following tools:

You can also use any other program you are familiar with. They need to be able to handle some formats like Collada (.dae) for models, .png and DDS texture format for textures.

Folder structure, naming conventions

It's important to have a good structure for your source materials. It makes life easier both for you and anybody else who needs to work on your creation later. I do it this way for example:

  • Ship name/
    • /ship.blend - I usually put the .blend file on the main folder of the ship.
    • /sketches - I put any drawings and sketches, brief, description to this folder.
    • /textures_src - Texture source files, like Inkscape or GIMP project files, and any exported layer or maps such as AO goes here. More on these later.
    • /textures - The final texture files go here.
    • /preview - Preview renders and WIP-s go here.
    • /export - I use this directory for test exports. It's contents will become a mod.zip, so it mirrors the structure of the /data directory of Pioneer:
      • /models/ships/molaramsayi - where the meshes and textures and the .model file go.
      • /ships - where the ship definition file goes.

It's also useful to have and stick to a naming convention.

  • Final files should have the name of the ship, then the LoD level. The final names usually look like this:
    • molaramsayi_hi.dae
    • molaramsayi_med.dae
    • molaramsayi_low.dae
    • Each LoD could have several separate .dae files, like for landing gear, but they should follow the same naming convention for the LoD level, to make things clear.
  • I use a similar approach for the shield and collision meshes. They could go into the top LoD file, but I prefer keeping them separate, so they are easier to modify later.
    • molaramsayi_coll.dae - for the collision mesh.
    • molaramsayi_shield.dae - for the shield mesh. NOTE: that the object in it should have the suffix _shield in it's name to be recognized as shield mesh.
  • Also a similar way for the texture files, following their respective entries naming in the .model file:
    • molaramsayi_diff.dds - for the diffuse texture.
    • molaramsayi_spec.dds - for the specularity texture.
    • molaramsayi_glow.dds - for the glow texture.
    • molaramsayi_norm.dds - for the normal map.
  • molaramsayi.model for the .model file where you define the LoD levels, materials and animations for the engine.

It is also useful to follow a naming convention for source files, such as molaramsayi_AO.png for any intermediate file used for texture creation, and any native file, like molaramsayi_texture.svg.

Sketching and Brief

This is not really a technical thing, but a good practice when you are working on assets intended into official Pioneer. First step is to visualize any idea before you dive into modeling. It's easier to try different things, proportions, shapes and such, or to get feedback before you sink hours into something that turns out to be a dead end. The nice thing about these is that they don't need to be pretty. You can doodle something with a ball point pen, or put some primitive shapes together in 3D. Checking the silhouettes is also a good idea, since that is what our eyes notice first. You can find a bunch of thumbnail sketches on the dev forums.

For this article, I'll be creating a medium cargo craft from OKB Kaluri called Mola Ramsayi. A larger sister of the Mola Mola. The basic idea is a rounded cone-like shape, with a three-way symmetry along the longitudinal axis. One main point is that Kaluri workhorse crafts have a relatively simplistic and compact build. Also it should look like if it could be a tail-sitter.

The basic structure is quite similar to the Mola Mola, even if the nose is more tapered. OKB Kaluri ships tend to be round with smooth curves and some abrupt shape terminations, like the tail side of this craft, as you can see on the thumbnails bellow. Another typical Kaluri features are the high visibility cockpit area and the heat-sink fins near the engines. The former is a subject of some debate as if Kaluri invented this layout and Mandarava-Csepel Shipworks stole the idea, or vice versa, since the two companies are doing corporate espionage like if it was a sports competition.

Cargo hatches will be on the sides and on the top too, and there will be a docking collar over and back to the nose.

(thumbnail drawings come here)

00 med trans 2 s.png

This painting shows the direction I want to take this ship. At least three times as long as the Mola Mola, which makes it about half the length of the Vatakara, so it will be along the line of the Deneb.

Modeling

Coordinates

Pioneer uses Y as the longitudinal axis of the ship, X for left-right and Z for up-down. You need to align your ship with this in mind.

01 axis.png

 

Objects and transformations

Objects are how Blender represents discreet elements of your model. The mesh of your model (all the vertices and edges and faces and such...) will be contained within one or more of these objects. The confusion for newbies is understanding the difference in scaling/rotating on an object and its mesh. Pioneer uses an object's properties to place it in game. A common mistake is to scale or rotate the object when the intent was the mesh within. In these cases make sure you are in Edit Mode before starting any manipulation on the object.

See: Object Mode and Edit Mode.

Before exporting, the scale of any object should be 1 on all axes to avoid problems and distortions. This is a very important thing, so don't forget to Apply (freeze) it ([ctrl+a > Scale] in Blender, Object mode). You can also clear any object scaling with [alt+s]. Rotation and position can be anything that makes sense while you work on the model, but it should be at 0,0,0 and align with the axes above in the end.

Modeling

Reference images

The first I usually do is setting up reference images in the viewport, so I can see the concept art, or even orthographic views. You can set it up in the right-side panel of the 3D view (N-panel). You can change a lot of things like image opacity, scale and position, and you can also choose the view, where the image is visible. The other image below shows a part of the render settings in the Properties window. I set up the render resolution to match the dimension of the image (702*426 in this case), so it won't get distorted in the Camera view

RTENOTITLE RTENOTITLE

Modifiers

Modifiers can change an object in certain ways, like mirroring it or smoothing, to name the two most popular one. They can make the modelers life a lot easier in different ways.

They can be found under the Wrench icon in the Properties window. For this ship's fuselage I will be using a bit more complex setup at first, because of the trilateral symmetry.

Each modifier has a line of icons, for enabling and disabling them for different modes, like during render, object mode or edit mode. They should be on in object mode if you want to export the model to collada without applying them first.

04 modifiers.png

Let's see what they do:

Mirror

This one will basically halve the amount of work we have to do, because it will mirror everything we do on one side of the mesh, along the origin (pivot) of the object. If the mesh is in correct orientation (see axes above, newly created objects are usually set up correctly), then the default settings are good.

Except for the Clipping option in the second column, which stops vertices from moving to the other side of the model, and stick them on the mirroring plane if they touch it. This is usually very helpful, because it prevents a lot of extrusion and smoothing errors. You want this to be on most of the time.

The thrid column is about texture UV layout. If they are on, the unwraped texture will also get mirrored on the respective axis of the layout. (U for horizontal, V for vertical). They are disabled here, because I will apply all of these modifiers later, and add another Mirror, where U will be enabled (more on this in the Unwraping section).

Array

This one is usually not needed, but it's a big help in this case because of the trilateral symmetry of the fuselage. What it does is repeating the object in any direction, distance and number. Useful for lightposts along a road for example.

In this case, it's set up to repeat the mesh three times (Count), merge the areas where they meet (Merge), and the offset of the repeats are controlled by an empty object, which is rotated 120° on the Y axis (Object offset). This way I only have to model one side of the hull, and it's repeated on the other two, which is very helpful, since I don't have to worry about symmetry at all. And since I'm repeating the already mirrored mesh, I basically have to work on 1/6th of the model.

The Merge option is important here, because I want to have a continuous surface all around. The Distance setting for it governs, how close the vertices need to be to get merged.

This modifier will be applied on the model when the base shape is ready, so I can work on the not tri-lateral parts of it.

SubSurf

This is another very handy modifier when you need to model smooth surfaces, or organic shapes. It subdivides each face into four and smooths them to create curved surfaces. It's very handy because you can have a dense smooth mesh but you don't need handle each and every vertex in it. Although you need to have a quad only mesh most of the time, because triangles and ngons can mess with the subdivision and smoothing in very ugly and unpredictable ways.

The Catmull-Clark method is preferred, because the Simple subdivision just subdivides the faces, but doesn't smooth them.

The Subdivision option sets the number of iterations it does for the viewport and the render. Usually you don't want it to be larger then 1 for the viewport.

Subdividing the UV-s usually a good thing, especially if you are doing organic, but since I will apply the modifier before unwraping the model, it doesn't make much difference for me. The optimal display is helpful if you can't select certain vertices because of the smoothing.

Modifier order

An important thing to note is that the order of the modifiers in the stack counts. A lot sometimes, since each modifier does it's work on the mesh it gets from the modifier above it.

You can move the modifiers up and down in the stack with the little triangle arrows on the upper right corner of each modifier.

In the above case, the smoothing would be much sharper on the three outter edge of the model if the SubSurface would be over the Array modifier in the stack, since it would first smooth the mesh, and it would duplicate it after the smoothing already happened. Array first and then mirroring would give a quite different result too.

Camera setup

Placing the camera

Since I don't have ortographic views for this ship, I will set up the render camera to have view on the model similar to the concept image. After I set up the modifiers, I reset the 3D cursor to the 0,0,0 coordinates ([shift+C]), so I can rotate the camera around it, and eyeball the rotation of the rudimentary shape I created with the above modifiers, to match de perspective of the image. I've also imported the Mola Mola model to have a scale reference.

You don't need to bother with this most of the time, especially if you have ortho views for your model. Usually I prefer to work this way, because it's easier for me to work with an image where the craft is in percpective.

Animation

UV unwrap-ing

Model and it's UV map
An Amphiesma papercraft under construction

UV unwrapping your mesh is the needed step to prepare your model for texturing. This is how you tell your 3D modeling program (and Pioneer for that matter), where each pixel on the texture goes on your model.

Doing the unwraping tends to be a strange and disliked part of the modeling process, but it is not that bad actually. Sure it is tedious and sometimes boring, but it can be learned to do it easily, effectively and fast. In my experience it can be quite calming too, when you get the hang of it. It is problem solving, but in a puzzle way. You unwrap your model quite similar to the way you make those papercraft models, just in reverse. You just need to cut some edges of your model, so it can be unwraped. Actually it can be used to make these kind of models.

First you will need to set up your UI for it. Simplest way is to switch Blenders UI preset to UV editing up on the top bar, in the dropdown menusaying Default:

RTENOTITLE

This will switch you to a view with only two windows: The left side will be a UV/Image editing window, the right 3D window. You can also switch between these presets with [ctrl+left/right] Or alternatively you can set up your default to incorporate a UV/Image editor window either by dividing up the 3D window, or switching the timeline to one. (How to customize the interface of Blender).

Now that we prepared the workspace, we can get right to it. First you need to switch the 3D view shading to Textured mode either by selecting it on the 3D window buttons on the bottom, or by pressing [alt+Z]. This will most likely turn your mesh into a solid white-is color (if not, then hang in there, I'll get to it pronto).

In edit mode select all vertices of the mesh with [A], then create a new texture in the UV/Image editor window: RTENOTITLE

RTENOTITLE RTENOTITLE

Set it from Blank to to Color grid. It will give you a colorful numbered grid texture, which should also be visible on your model:

RTENOTITLE

It might not look like this right away, because Blender handles this texture display a bit strangely. First make sure to select the whole mesh, then from the drop-down menu down the UV/Image editor window select that image again to assign it to every . If that doesn't help either, make sure your viewport shading mode is in Multitexture in the right side panel, and delete any lamp from the scene.

GLSL viewport shading or if you are working with the Cycles rendering engine, you need to give the mesh a material with a shader, and assign that image to it for color.

We use this image to see any scale issues and stretches on our UV map.

We are all set for the puzzle now. You can unwrap your mesh with [U] in the 3D view (in edit mode):

UV-unwrap.png

As you can see, there are several options we can use.

Unwrap will try to do it's thing based on the cuts you have in the model. Without them it will produce a mess. But we will still use this option most of the time. Smart UV Project tries to guess, where the model should be cut, and unwraps according to that. Usually it will not give good results on complex shapes. I mostly use it for previews, like when I want to quickly try out the ship in game with a quick AO bake. Lightmap pack and the three primitive projections aren't too useful for us. Project From View can be very useful. It projects the mesh as seen in the current view. It is handy when you want to unwrap some parts that are close to planar.

For the Unwrap command to work properly, we need to cut up the mesh in certain parts. You can do that by selecting edges, then [W-->Mark Seam] and remove unneeded seams with [W-->Clear Seam]. As you cut trough the model, and repeatedly use the Unwrap command, your UV layout will be more sensible.

The aim is to minimze stretching texture on the model and to create a sensible UV layout with coherent scale for texturing. Approach it like if you want to cut a paper box open, but you don't want to separate it's sides more than necessary. The Color Grid helps you spot texture distortion on your model. By rearranging the UV nodes you will see the color grid projected on the model's rearrange itself on the corresponding face - try to ensure all the grid lines are square to each other.

LoDs (Level of Detail)

LoD example

It is costly for Pioneer to calculate the positions of large numbers of vertices and triangles on screen so reducing the complexity of your ship can significantly improve performance.

As a ship moves further away from view and shrinks in size (these cows are small, those cows out there are far away), a combination of your monitor's resolution and the ability of your eye to resolve detail is reduced. A simple trick is to replace your model with one of a lower Level of Detail (LoD) containing fewer mesh nodes as it passes a certain threshold (in our case Pioneer the number of pixels it occupies on screen, set up in the .model file).

Generating a lower LoD for your ship is easy - you simply remove nodes from your object meshes.

  • Duplicate your mesh objects and place into their own layer.
  • Rename them to something meaningful such as fuselage_MED.blah...
  • Start removing every other vertex or edge loop from each of your meshes. Merging faces to ngons ([B]), then dissolving stray vertices [X --> Dissolve], or removing edge loops [X --> Edge loop] are useful tools.
  • Try to keep geometry on the edges of your mesh so that the shape of your ship is maintained.
  • It is also useful to avoid removing seam edges, so the UV layout don't get messed up.
  • Keep going...
  • Export these objects into their own .dae file e.g. myship_med.dae myship_low.dae etc...

You should now have a simplified mesh that still looks like your original ship. To create an even lower LOD duplicate these new objects and repeat the process above.

Exporting the model

Blender objects need to be exported in Collada (.dae) format before Pioneer can read them. As mentioned above, it is useful to separate your model into different files for LODs, shield, and collision meshes. When exporting, select only the objects you want for that particular export file. It helps to have related objects on different layers for selection. Collada export settings:

Exporting.png

These LODs then need to be registered in the myship.model file where the lod number is the number of occupied pixels e.g:

   lod 300
   molaramsayi_hi.dae
   molaramsayi_shield.dae
   
   lod 100
   molaramsayi_med.dae
   
   lod 50
   molaramsayi_low.dae
   
   collision molaramsayi_coll.dae

Tags

Tags example

Tags are used by Pioneer to attach in-game elements such as weapon mounts, thruster exhaust jets and camera/view placements to a model.

In blender Empties are used as tag points. These are mesh-less objects that represent an x,y,z coordinate, scale and an orientation. Empties can be one of a number of 'types' - while Pioneer does not care what 'type' the Empty object is , it can be useful to use different empty types to represent different in-game elements. The naming pattern of the empty object however, is critical to how it will be used by Pioneer and must be exact.

Tags: Blender Empties
Game Element Empty Type Object Name Pattern Notes
Thrusters Single Arrow thruster.* or thruster_linear.* The orientation of the arrow determines the orientation of the exhaust animation in-game. Thruster fires when the ship is moving in the respective direction, and also when the ship rotates. Thrustrer_linear only fires on movement. The game automatically chooses which thruster to fire for each movement. The scale of this empty determines the size of the jet.
Camera/view ports Arrows tag_camera_(top|bottom|front|rear|left|right){1} Point the Z (blue) axis in the direction of view. Position the Y (green) axis to determine the view orientation (up direction).
Landing point Plain Axes tag_landing This empty represents the lowest coordinate of the ship with gear extended and is used to place the ship on a surface for landing.
Gun mount Single Arrow tag_gunmount.* Determines the position and orientation of the weapon.
Navigation lights Sphere navlight(_red|_green){0,1}.* If the colour of the navigation light is omitted the light is rendered light blue and does not blink.
Label Arrows label.* This is where the ship's name/ID will be placed. With axis Y (green) pointing up and Z (blue) axis point out, the lettering is read in the direction of the X (red) axis. Try to place and orientate this tag on something flat as it will not align itself to a surface.
  • Empty types are suggestions only, and don't export with the file.

Texturing

Texture channels

Baking

AO (Ambient Occlusion)

Ambient Occulsion is a neat trick to giving your ship the illusion of depth without placing additional load on your GPU. It is achieved by baking diffuse shadows into the texture itself.

  • Select UV editing view - you should now be presented with a split screen
    • In the UV window click on the Create new Imagebutton at the bottom of the window (this is a button with [+ New] written on it)
      • Name the new image myship_ao
    • In the 3D View window (the default window) select the object and enter edit mode
      • If you have not done so already uv unwrap your object as mentioned perviously
      • Select all the meshes in the object
    • In the UV window select all of the UV faces
      • Make sure the myship_ao image is selected - click the popup button next to the Create New Image button and select the myship_ao image from the selection
  • Go back to Object mode in the default view
    • Select the object
    • Either go to or open up an "Outliner" window. This lists all of the objects in the current scene
      • Make sure the object you want to bake has Restrict Rendering toggled by selecting little camera icon on the right hand side. Withiout this, you will get an error complaining that there is no object to bake
      • The ambient occlusion calculation will take other sceen objects into account during rendering. If you want these to add to the AO of the current object make sure Restrict Rendering is also toggled for these objects
      • If proximal objects are having an adverse effect on the AO simply toggle off Restrict Rendering for that object
  • Click on the World tab an make sure all the AO settings are correct
  • Click on the Render tab (the little camera icon)
    • Navigate to the output panel
      • Ensure an output path is defined and is set to PNG (not sure this is correct.... but currently if I dont do this I cannot bake)
    • Navigate down the panel to the Bake sub-panel
      • Set Bake Mode to Ambient Occlusion
      • Check "Normalized"
      • Set the Margin to somewhere around 6-8pixels (this is the number of pixels to extend the AO generation from the edge of a mesh seam)
      • Then click on the large Bake button

You should now see the myship_ao image in your UV editor populate with the new AO render. If you navigate back to the 3D View and select Texture from the Method to Display Object menu item at the bottom of the screen, the new AO will be overlaid on the object's mesh. Pretty :)

Things to note:

  • I find texture assignment to groups very fiddly - patience is required...
  • You can only bake one object at a time. If you have multiple objects make sure when arranging your UV map that you leave enough space to unpack other objects. When you bake a different object it will save that bake as a differnet file or overwrite the existing. I get around this by opening the baked output in GIMP as a layer after every group bake. This way I can capture all groups then merge together into a single image. There may be a better way to do this - if so let me know!!

Still on going.....

UV Face Layout

UV Face Layout is an semi transparent representation of the mesh faces/edges of your unwrapped model - similar to what you see displayed in the UV window. This can be imported into your editor of choice and used as a guide when adding texture detail. Being able to see the mesh when painting allows you to see the underlying shape of the model and predict potential distortion. It will also help you line up features that span mesh seams (very helpful!).

  • In the 3D editor
    • ​Select the object in edit mode
  • In the UV editor
    • ​Select all of the faces in the UV
    • Click: [UVs --> Export UV Layout]
    • Save the output as myship_uv_layout.png
  • Import this image into your image editor as a seperate layer.

Sketching texture

Inkscape basis

Painting texture

Distressing

Space travel is a harsh activity, it is therefore not unexpected that a ship should undergo some wear and tear along the way. Distressing your ship can give it that extra element of realism.

Panel Wear

Wear should be applied after the panel lines have been drawn on its own layer. Also consider the edges of panels are likely to undergo more wear than the middle and the leading edges more likely than the trailing.

These are the types of wear as I see them (add more if you feel the need :-):

  • Paint chips - hard edged
  • Worn - lightening of the base material plus small scratches
  • Scuffs and knocks - larger scratches more general placement (can cross panel lines)
  • Whole panel replacements - slight discoloration of entire panels. Panels and components are after all replaced over time (put these on a separate layer).
  • Exhaust burns - sooty black marks around engine/RCS nozzles

Depending on what sort of wear you want will determine the next steps and is entirely up to you.

In GIMP
  • Create a new layer and call it "wear"
  • Select the wear layer. Make sure the panel line layer is visible underneath
  • Mask off a panel using the Free Select Tool i.e. draw around it using the panel line
  • Scratch away!
  • Repeat the process for other panels

Masking off the panel allows you to focus on one panel at a time, it also helps give the illusion the wear is unique to that panel.

Scratches

Scratches can be drawn by hand but this can be somewhat tedious on large models and inconsistent in style. You may want to consider using an existing brush pattern or brush engine for your editor. You might even want to make your own brush pattern!

  • When applying linear scratches they should run roughly along the line of travel
  • Try to keep the brush size range roughly the same across you model
  • Use a limited number of colours and use them consistently
  • If you can, have more than one brush with different patterns handy
  • Vary the angle slightly between applications to give a less uniform appearance
  • Overlap brush strokes
  • Use another unrelated brush with the eraser tool to remove random-ish parts of the scratches you have drawn to break up repeating patterns
  • On mirrored textures think about where the two halves of the ship meet up. It can look very odd to see an exact mirror of the texture next to itself

Postprocessing and compositing

Exporting Textures

When you want to view your texture in game you will need to export the various layers from your gimp .xcf file.

Each Layer will need to be scaled down to 2048x2048 pixels. I usually create my textures in 4096x4096 then scale down - however this can result in unexpected scaling artefacts. The upside is that should Pioneer move to 4096 textures I wont have to redevelop.

If you are scaling down, make a copy of your .xcf. This copy will now be your scaled down source. In tern go through your layers and scale it to 2048x2048. Then under "Image" click "Fit Canvas To Layers". This will shrink the image to the new layer size and is required when exporting pngs.

Pionner requires the following textures to be exported as .dds files:

  • diffuse
  • specular
  • glow

In Gimp go to the "File" menu and click "Export As...". When naming the exported file remember to set the extension as .dds. Gimp will use this to determine the type of export you want to perform. Use the following options:

  • File extension: .dds
  • Compression: BC1/DTX1
  • Save: Selected layer
  • Generate mipmaps: yes

Pionner requires the following textures to be exported as .png files:

  • normal map

It is possible to use compressed DDS normal maps too, but they tend to have visible compression artifacts along thin lines for example, so it's generally better to keep them in a lossless format, like.png

In Gimp go to the "File" menu and click "Export As...". When naming the exported file remember to set the extension as .png.

  • Just use the default setting here

Model and Material setup

Stats setup

Making it into a mod

A mod is a simple way of getting your ship into your local copy of Pioneer. It is also useful as a means of distributing your ship to others for review and testing. Mods are simply zip files containing your ship files and can be created as follows:

Linux

   cp *.model export/models/ships/molaramsayi/
   cp *.dae export/models/ships/molaramsayi/
   cp textures/*.dds export/models/ships/molaramsayi/
   cp molaramsayi.json export/ships/
   cd export
   zip -r molaramsayi.zip models ships
   cp molaramsayi.zip ~/.pioneer/mods

And to view in the pioneer model viewer (assuming pioneer is on your path):

   pioneer -mv

OSX

   cp *.model export/models/ships/molaramsayi/
   cp *.dae export/models/ships/molaramsayi/
   cp textures/*.dds export/models/ships/molaramsayi/
   cp molaramsayi.json export/ships/
   cd export
   zip -r molaramsayi.zip models ships
   cp molaramsayi.zip ~/Library/Application\ Support/Pioneer/mods/

And to view in the pioneer model viewer:

   /Applications/pioneer.app/Contents/MacOS/pioneer -mv

Windows

Bleh....

Testing