Adding 3D Models to Aleph One

From AlephWiki

Jump to: navigation, search

Adding Static 3d Models to Aleph One.

While this seems a very hard and vague area for many, it is actually quite simple if you've got even slightest knowledge of 3D modeling. I've made this quick tutorial because the one originally made by Maarten Tromp (Jemmet) is a bit outdated (focussed around Mac Os 9) and on his own website. If it gets offline, all his info is lost... Though I've learned a lot from Jemmet on this area, I believe his way of doing it is a bit of a complicated and slow way of getting the job done. So here we go:

To start with, I only have experience with 3d Studio Max and static models in Aleph One only. Static models are 3d models without animation and are mainly there to add detail to a map. Static models are best used to replace the items or scenery slots in Marathon and shouldn't be used for characters. I've worked with animated models in DiM3 and Aleph One but that's still a very buggy area. Just for the info: currently it's not possible to add 3d models to the weapon-in-hand collection.

I'll try to explain everything as simple and clearly as possible, cause it really isn't that complicated once you keep a couple of things in mind.

Basically , you'll need 3 things. to get a 3d model inside Aleph One

1. A Model 2. A Texture 3. A MML script

For number one you'll need a 3D application to make the model in. For this tutorial I'll go with 3D Studio Max cause that is what I work with mostly. I'm lucky to have an original copy but it's very expensive. Though there should be a learning / student edition for around a 100 bucks I think. Anyways, the overall process should be fairly the same when using other 3d applications. Keep in mind, 3d Studio Max is only for Windows. I've got it installed on Bootcamp on my Mac Pro, I don't think it runs well (if at all) under Parallels or Virtual PC.

For number two you'll need an app. called UV Mapper. It's both for Win and Mac (even os9) and it's free. So no sweat here.

http://www.uvmapper.com/

And of course an application to edit images with, I'm a big fan of Adobe Photoshop but again, this is quite an expensive app. You could use 'Paint' I guess but trust me, the layers in Photoshop really could come in handy.

Number 3 is simply the MML script, good old simpletext does the job but I recommend an app. called Smultron. It's free and has a build in syntax for XML which is really handy when building MML scripts. It also counts lines, which is very nice when AO gives a syntax error at Line X.

http://smultron.sourceforge.net/

Ok, before you start modeling, you should know a couple of basic things.

1. When making a model to replace something in Marathon (scenery, item, whatever) keep in mind that the model will completely replace the entire sequence. It doesn't go by bitmap as with sprites or texture replacements.

2. A 3d model ignores all settings made in Anvil / Hakvil to the sequence. Changing the scale, key-point or light value etc. wont have any effect on the model at all.

3. Though you want to make sure, the key-point is placed in the center, so that if you want to make the model solid with MML it calculates from the middle. Keep in mind that making scenery solid goes with a cylinder from the center. (like on the Alien Trashcan or Security Monitor in Marathon) and wont follow the models outlines.

4. Make sure you keep things low poly. Let the texture do the detail. Depending on the model I usually stick with 300 poly's at max. Models with lot's of poly's are also very very hard to texture. I'd say beyond 1000 gets pretty much impossible, but you'll get that when you get to the UV Mapper part ^^

5. Try to always make sure a model is placed on it's own polygon in Forge. If you make it cross lines or vertices it could start to act weird.

6. Somehow, objects like cones or cylinders tend to be a little slower to render in Aleph One than models in a sort of box shape. Try to build your models clever and leave out what you don't really need.

7. This speaks for itself, but keep in mind that using models will slow your game down!

8. For the best results and best model support, make sure you've got the latest version of Aleph One.

Ok, how to start:

Building Your Model

Fire up 3D Studio Max. and start making your model, I usually start off with drawing something on paper and rebuild it in 3D. Oh, before you start modeling away, you should know that the grid in 3ds max is actually the floor in Marathon! Don't ask me why but it somehow is. So with that in mind, make sure your model's bottom is always placed on top of the grid. Scaling your model in 3D Studio Max also scales the model in Aleph One! So don't go all nuts with rotating and scaling as the model will exactly appear that way in Aleph One judging from the grid.

Also make sure, your model is in the middle of the grid or else the pivot point will be off and you will have to manually adjust the model in Forge on every map to get it in the right place :S (like the key-point in Anvil).

Ok with all of this in mind, you're good to go. When you're done modeling, export the model as a .OBJ (Wavefront Object).

On the .OBJ export pop-up in 3d Studio Max, make sure "Model rotation" and "Texture coordinates" are checked 'Off'. And the faces should be on "Triangles".

Ok, so there's your basic model. You can't use this in Aleph One yet. Because there's no texture and there are no texture coordinates included. If you add a model at this stage to AO it will probably wrap around the map and gives you major graphical errors. So don't be a batty and be patient :)

Texturing Your Model

Ok, Now import your .obj model into UV Mapper. At first you'll probably be only staring at the blank screen. To make your model appear you'll need to add texture coordinates to it. To do this, go to "Map" in the top menu in UV Mapper and choose one of the mapping types. I almost always go with "Box" as it seems to work best.

Image:UV Mapper Map Menu.jpg

When you select 'Box' you'll get a pop up screen with a couple of options. Check all 3 options. The "Map Size" is probably on 640, put this on 1024, atleast that's what I usually do :).

Image:UV Mapper Box Mapping Dialog.jpg

Now you'll see your model laid out in small pieces. Don't worry if the model seems slightly out of dimension, this wont be the case in your final model. The application itself is a bit buggy, but you're now able to drag your model's parts around. Just select and drag parts, you can also select and then use the arrow keys to fine-tune.

It doesn't really matter where you put all the parts as long as you sort of know which part belongs where. Just spread them out logically. If you want to get the most out of your model. You can use the "+" and "-" keys to make certain parts bigger and smaller, making the texture on those area's 'sharper'. If your model is really large and complex you can group things together in 3d Studio Max. UV Mapper will recognize the groups and divide them in colors to make your life less of a drag.

Dragging parts around wont mess up your model.

Ok, when you think you've got it laid out nicely and in a logical way. You have to export both a texture map and the model itself again. This because your model now has proper texture coordinates included.

In UV Mapper, select "Export Model" from the "File" menu and export your model. Rename your model so there's .obj at the end of it's name. The export options should be as followed, though I think they're like this on default. (I could be wrong though).

Image:UV Mapper Export Dialog.jpg

Ok, now export your texture from UV Mapper; go to "Export Texture Map" again under "File" and export you texture map as 'TIFF'. Again go with 1024 in both width and height. This is the best for most textures. You could always scale it down to 512 or 256 in photoshop if it's to heavy. Though I've made very large models work in Aleph One with texture maps in sizes of 2048x2048 or even 4096x4096. Remember, it's always better to start with a huge file and scale it down later on, than starting with a tiny texture only to find out it looks blurry in Aleph One.

Open your saved texture map in Adobe Photoshop and

make sure you first flip the texture vertically.

Start putting textures on top of the parts you've just laid out. This is the shittiest part. It depends on how you've laid out your model but you'll get a feel for it in the end :) Texturing is mainly just practice and trying stuff out in both UV Mapper and Photoshop.

When you've textured all the parts save your texture map as a .PNG. To quickly try out your model in Aleph One you could also fill all the parts with a solid color and see how it looks in-game first. Not a bad idea, as it could be that you've spend hours on texturing only to find out your model was messed up somehow.

Keep in mind that the Aleph One engine doesn't have real time lighting effect or actual light sources. I usually pre-shade the texture in Photoshop so that it looks like it is catching shadow from something in-game. Without this, your model will look very flat.

The MML Script

Now you've got a model and texture, but you'll need to let Aleph One know that you want to insert the model. This is what an example of the MML script basically looks like:

<marathon>
<opengl>
<model coll="7" seq="1" file="Data/Fusion.obj" type="wave" scale="1" x_rot="0" y_rot="0" z_rot="0"
 x_shift="10" y_shift="0" z_shift="0" side="0" norm_split="1" light_type="0">
<skin clut="-1" normal_image="Data//Fusion.dds"/>
</model>
</opengl>
</marathon>

<model> holds all options for the model itself. "coll" refers to the graphic collection the model is in. So for example if you want to replace the fusion pistol item with a 3d version you'll go with collection 7 , which is the items.

Then "Seq" refers to the Sequence that you want to replace, this is the number of the sequence in Anvil. Type="wave" refers to the type of model which in our case is a Wavefront Object (.obj) so it should be on "wave". The scale is how big the model is, depending on how large you've made it in 3d Studio Max, you can scale it up or down to a degree.

The rest of the stuff is also to adjust the model or to rotate it. Do not use this to change the models facing, you can do this in Forge. (I'll explain later on).

<Skin> is simply the texture. "Clut" defines the clut in Anvil 0-7 and let's you load in different textures on the same model instead of different colors. -1 will tell AO to use this for all 'colors'. Make sure the file-paths are correct for both the model and texture and you're ready to go. I recommend converting your .PNG texture to .DDS with Aorta for the best performance and quality with your model. It is also possible to add glow maps to your texture. For more MML options with models:

http://stderr.org/doc/alephone/MML.html#opengl

Adding The Model to Your Map in Forge.

You can now place your static model in Forge by selecting the item you've replaced with your model. If you've sticked to the grid in 3ds max, your model will be exactly where you place it in Forge and there should be no offset and no need to place it higher or lower unless you want to do so on purpose of course.

As you'll notice you can't change the facing on scenery and items like you can on the player or on monsters in Forge. But not to worry, if you place a player object for example and set it's facing it will keep these settings in mind if you change the player into a scenery or item obect. So, in fact you can alter the facing of your model by first making it an player object and after adjusting the facing there you can change it (back) to your model.

Ok that's pretty much it, I tried to explain it as clearly as possible, but the truth is, you'll just have to try stuff out for yourself following these basic outlines. And get a feel for it.

Happy modeling! :)

-Tim Vogel

Personal tools