|
Author
|
||||
|
Related articles
|
||||
|
More in Development
|
||||
In this, the final part of the series, we'll cover the long-awaited subject of 3D models, as well as highlighting some of the possible problems you may have as you attempt your own 3D games.
Importing models
Sadly, we're not talking about shipping beautiful women into the country, but rather the process that you'll go through to get more elaborate 3D geometry into your games.
By this point, you'll probably be feeling a bit constrained by the limited number of 3D primitives offered by Game Maker. This is understandable – you can't very well build your next 3D shooter using nothing but spheres and cubes (although it could be interesting to try). Still, being able to create 3D models to represent game objects is preferable.
If you peruse the GM help, you'll notice that there are a large range of commands to define models. Sadly, these require you to go about building the model point-by-point, manually inserting vertices, normals and all the other data you need with line after tedious line of GML scripting. As much fun as manually defining models is (not), an enterprising Hungarian named Zoltan Percsich has come to your rescue with a neat little freeware script for GM called Mosaic Light. This script allows you to import 3D model files in .OBJ format, allowing you to build and export them from a more user-friendly 3D modelling program like Blender and pull them into your game for easy use. As a result, we won't be going into all those model commands, although you might want to take a look at them on your own later. Rather, we'll be looking at using Mosaic Light to import and draw a 3D model in our game.
In my case, I'll be importing the building model that you see here as an example. I whipped it up in Blender, but you can use whatever 3D program suits you:
Firstly, I'll need to export the model from whatever 3D program I'm using. This naturally differs depending on the package, but most should have the option to export to .OBJ format. Ensure that you select the option to export normal data if you want to do lighting.
Also ensure that the origin point of the model is where you want it. Some 3D programs export models with their positions relative to the world origin, meaning that you'll need to reposition your model before you export. Fail to do this and your model will be off-centre when you draw it in GM.
Secondly, we need to put the Mosaic script in our game. The file that you download from the link above will contain a sample Game Maker file that contains a basic importer and the scripts. You can merge this file with your project, but all you really need is the "createFromObj" script. This is the script we'll run to pull our models in.
|
Words from the readers
|
||||
|
I'll see what I can do for you.
Posted by Chippit at 22:17:29 on 29 June 2009
Can you please release the gmk of this tut, because I have follow everything in this tut but somethings aren't working correctly and I dunno why? Thanks.
Posted by Giorgio at 22:52:04 on 22 June 2009
Have your say:
|
||||