Difference between revisions of "Making your first ship from scratch"
m (→LoDs (Level of Detail)) |
(→LoDs (Level of Detail)) |
||
Line 141: | Line 141: | ||
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. | 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== | ==Exporting the model== |
Revision as of 13:42, 17 March 2016
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.
Contents
- 1 Software
- 2 Folder structure, naming conventions
- 3 Sketching and Brief
- 4 Modeling
- 5 Tags
- 6 Texturing
- 7 Model and Material setup
- 8 Stats setup
- 9 Making it into a mod
- 10 Testing
Software
We will use the following tools:
- Blender - An advanced cross platform Open Source 3D software. If you are new to Blender, the CGCookie basic course will cover the foundations for you.
- GIMP - cross platform 2D raster editor software for creating textures. It's a bit harder to find good basic material for it, but you can try this playlist for example. DIY Graphics also has some videos on GIMP.
- Krita - cross platform painting application which works very nice for texture painting tasks.
- Inkscape - cross platform 2D vector editor for some texture work. The official page has a range of tutorials. DIY Graphics has some tutorials on Inkscape too.
- Model_viewer - the build-in model viewer tool of Pioneer.
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)
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.
Objects and transformations(needs checking for correctness)
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
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 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.
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.
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
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
LoDs (Level of Detail)
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. Merginng 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:
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 myship_hi.dae myship_shield.dae lod 100 myship_med.dae lod 50 myship_low.dae collision myship_collision.dae
Tags
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 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.
Game Element | Empty Type | Object Name Pattern | Notes |
---|---|---|---|
Linear Thrusters | Single Arrow | thruster.* | The orientation of the arrow determines the orientation of the exhaust animation in-game. The scale of this empty determines the size of the jet. |
Camera/view ports | Arrows | tag_camer_(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. |
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.* | The orientation of the arrow determines the 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 using the default colour 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