Importing models

A model is a 3D object that represents a physical object such as a car or, in our case, a spaceship. ShiVa has basic modeling capabilities such as adding shape primitives and we may actually use some of them later, but as our ship is the focal point of our entire game—it's our main character—we should make it interesting. There are many places to find pre-made models and even some good software we can use to make our own (see Appendix B, Additional Resources), but for this book, we are going to stick to the pre-made option—making our own models could be an entire series of books on its own.

For this model, I went to www.turbosquid.com and found a free model called FV X1 Fighter by a user named pinarci. The model was created in Blender (free 3D modeling software), but since ShiVa can't import .blend files, I opened it in Blender and exported it to the Collada (.dae) format. You can find the Collada version of the model in the downloadable content. To import a model, click on Import | Model in the Data Explorer window.

The Import a Model dialog window will open and, for the most part, we will accept the defaults, but we do need to make sure that the Convert from Z to Y up axis option is checked. Blender uses the z axis as the vertical axis, but ShiVa uses the y axis. If we don't check this option, the model will be displayed sideways. Just click on the button to browse for our model and click on the Import button.

Importing models

ShiVa will begin importing the model including the materials and show the progress. If you see that the model is imported properly, you can then click on the OK button. To view the model, simply double-click FV_X1_Fighter in the Data Explorer window. If you don't see it, make sure the Model folder is selected in the Data Explorer tree-view.

Importing models

Hold on; that doesn't quite look right. The model is solid black and we can't make out any details. Don't worry, it happens every time and there is a perfectly rational explanation. Since ShiVa controls the lighting in the game, we need to tell ShiVa that the ship materials should react to game lighting. A material is a way to define what an object's surfaces look like, it can be complex with many layers or simply a color. Let's switch over to the Material Editor window and get this fixed. The Material Editor window is part of another of the standard editor views, so click on Design in the upper right-hand corner of the editor window.

The Design window gets a bit crowded because the view includes six modules, but we are only going to focus on the Scene Viewer and the Material Editor windows for now. To open the ship's material, just click on the centre of the Material Editor window and select the material from the dialog that pops up.

Let's start with the main theme material, that is, FV_X1_Fighter_FV_X1_main_theme-material. Once the material loads, you should see all kinds of information in the Material Editor window. Select the Lighting tab and click on the Receive Dynamic Lighting checkbox—the Per Vertex checkbox should be checked by default. Immediately, we can see that the material has been updated and now it is possible to see the ship details and see the shading from the light. These settings are shown in the following screenshot:

Importing models

The backs of the engines still look black and featureless, so let's switch to the other material by clicking on Material | Open in the Material Editor window and selecting the particle drive material, that is, FV_X1_Fighter_Blue_partical_drive_g-material. Repeat the lighting changes from before and then scroll further down the lighting section to the Colors subsection. Let's make the engines a bit more exciting than just the plain blue they were previously.

Importing models

Adjust the Diffuse and Emissive settings to be something similar to the settings shown in the previous screenshot. The Diffuse color is what you see on the object and the Emissive color is the color of the light that radiates from the object. We added the emissive color, because the engines look more dramatic with a glow. Last, but not least, click on Materials | Save All to save the changes to both the materials we have open.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.15.14.98