If you've only used the Game Maker 3D functions before, this feature will amaze you. With Game Maker it is really complicated to load a model. In Ultimate 3D you simply call one function. It can load animated *.an8, *.3ds, *.md2, *.x, *.ms3d and *.u3d files. Just by being able to load models you can create extremely complex scenes with many different cool objects. And you will not find many modeling programs that can not export to one of the file formats supported by Ultimate 3D. So you have the choice.
If you haven't had any modeling experience so far I recommend getting started with modeling by learning how to use Anim8or by Steven Glanville at www.Anim8or.com . It's a very user-friendly modeling program that can be used to make quite complex models. It also has a very cool system to animate objects using skeleton animation. The best part is that Ultimate 3D supports Anim8or files (*.an8). If you are looking for a more professional free modeling program I recommend trying Blender at www.blender.org . Getting started with it is really difficult, but there are really good tutorials linked on the website and once you know how to use it you will love it. It can export to almost every popular file format. In the Ultimate 3D Community there's a pinned topic in the sub category Game graphics that contains a list of modeling programs and other things you need to make 3D games.
Every file format supported by Ultimate 3D has its advantages and disadvantages. Here's a list of them including their individual characteristics.
*.3ds
The 3ds file format is great for a very simple reason. It's supported by many modeling programs. Originally it was the file format of 3D Studio Max, but for some unknown reason it has become kind of standard for many modeling programs. *.3ds files support skeleton animation. Unfortunately there aren't that many non-commercial programs that are able to export animated *.3ds files. Furthermore, the *.3ds model file format is a little outdated because it does not support vertex skinning - which is important when animating characters - and it does not store the normals of vertices.
*.an8
The big disadvantage of the Anim8or file format is that Anim8or is the only modeling program that supports it. The advantage is that it supports skeleton animation. This way Anim8or can be used to create animated models for Ultimate 3D. Unfortunately, the animation support of Ultimate 3D for *.an8 is not absolutely complete because Steven Glanville (the maker of Anim8or) hasn't documented all chunks that are needed to load scenes from Anim8or files yet. But figures and sequences are supported completely, including animations that use bone influences or skin weights. So you can make animations for characters and other objects using *.an8 files. Before loading an *.an8 file with Ultimate 3D you have to convert all the geometry in it to meshes (Build->Convert to Mesh). Despite you should be careful with the power factors in the "Material Editor". By default they are 0.3, 0.7, 0.2, 0.0. It is usually better to set them to 1.0, 1.0, 0.0, 0.0. Otherwise your model will be quite dark in Ultimate 3D.
*.md2
The *.md2 file format is very special. Originally it was used by the Quake II engine to save the player models. The unusual thing about it is that it uses a different method for creating animations than all other supported model file formats. Instead of connecting single meshes using so-called bones and saving the transformation of these bones (this technique is called skeleton animation), it saves one mesh for every single frame. In Ultimate 3D v. 1.31 you always got quite unsmooth animations when using *.md2 files because they did not contain enough frames. Ultimate 3D v. 2.0 uses a technique called vertex tweening to interpolate between the single frames of the *.md2 files. This way you get totally smooth animations. The disadvantages of *.md2 files are that they take more memory than other model files and that their animations can not be manipulated. Their advantages are that some programs that do not support other animated model file formats do support animated *.md2 files, and that there are tons of cool *.md2 models on the web because people have been designing characters for Quake II.
*.x
*.x is the DirectX model file format. It's quite old, but it is pretty decent and most professional modeling programs, like Blender, 3D Studio Max, Maya, Milkshape 3D and many others support it through plugins. Many of these plugins can be found on this website. It supports animations with or without vertex skinning, materials and whatever else a game developer could wish for.
*.ms3d
*.ms3d is the model file format of the modeling program Milkshape 3D. It supports multiple materials and animations with or without vertex skinning. There are plugins to export it for many different modeling programs. If you are having difficulties with a *.x export plugin, the *.ms3d model file format may be the perfect solution.
*.u3d
As the name implies, *.u3d is the Ultimate 3D model file format. Currently there are only two programs that can export it. Ultimate 3D itself (and all applications, which are based upon it) and Blender through this export plugin. There's a couple of different reasons for its existence.
The first one is that it can save an Ultimate 3D model object as is. All effects and changes that have been applied to it will get saved. When you read on to the advanced chapters you will see that this can make things a lot easier. A nice example for this is the fire from the Fire and Water Demo. It requires quite a lot of code to apply the effect to it, but you can simply export the complete model to a *.u3d file. When loading this single model file you'll have animated fire. Also, some computing time intensive data like multiple levels of detail can be saved to Ultimate 3D model files. This can shorten the loading time significantly.
The second one is that you can export all textures and effect files that are used by a model object to the *.u3d file as well. This way you can hide your resources.
And the last reason is that the Ultimate 3D model file format features a decent password encryption mechanism. So if you want to hide your resources from those who play your games, this is no problem. You can simply export all your models and textures to encrypted *.u3d files. Exporting model objects to Ultimate 3D model files will be dealt with in the chapter about advanced model management.
Comment: If you want to add support for the Ultimate 3D model file format to an application that is not based upon Ultimate 3D you can find chunk descriptions on Ultimate3D.org.
As I already said you need only one tiny function to load a model. But since every model object requires an instance of a Game Maker object it can be associated with, you have to set up a few variables first:
file
The model file. I recommend putting all models into a sub-directory called models, but that's up to you. If you have set up textures for particular materials of your model you have to place them in the folder gfx. Ultimate 3D will load them from there automatically then.
password (optional)
If file
refers to an encrypted Ultimate 3D model file, this variable has to be set to a string giving the password. Otherwise you do not need to set up this variable.
After setting these variables you can call LoadMesh()
to create the model object. The name of this function is another remaining from earlier versions of Ultimate 3D. They supported only *.x files and those were handled as one single mesh. Now LoadMesh() can load models that are made up of lots of meshes with skeletons and animations. Since model objects can be transformed in the same way as primitives (using the variables x
, y
, z
, scalx/y/z
and rotx/y/z
) you have to put Step() in the step event of the model object again. As usual, you have to call Destroy() in the destroy event.
There are a few more variables to handle the animation. Here's a list of them:
frame
If this variable has a positive value, this frame will be used. If frame
is negative, the value will be used as animation speed. So if frame
is equal to -1 you get a new frame every step.
first_frame, last_frame
These two variables define a range of frames through which Ultimate 3D cycles if frame
is negative. If first_frame
is bigger than last_frame
the animation will run backward.
To find out which frame of the animation of the model is currently displayed, you can call GetCurrentFrame()
. It does not take any parameters and returns the frame that's currently displayed for the model object it's called by. For *.md2 models there's also another variable you already know from primitives. Since *.md2 files do not contain information about their texture, you set up the texture for *.md2 models in the same way as for primitive objects: by setting the variable texture
to the index of a texture loaded using LoadTexture(...).
© Christoph Peters. Some rights reserved.