Main Page » Milkshape3d


Revision as of 19:17, 2 June 2006
Deathstryker (Talk | contribs)
Implementation
← Previous diff
Current revision
Deathstryker (Talk | contribs)
fixed a couple of picture links. Don't have access to the first 2 so they will have to stay dead.
Line 63: Line 63:
'''Example 1''' '''Example 1'''
-http://www.scorched3d.co.uk/phpBB2/files/example_1_141.jpg+http://img175.imageshack.us/img175/7711/example1u.jpg
Line 70: Line 70:
'''Example 2''' '''Example 2'''
-http://www.scorched3d.co.uk/phpBB2/files/example_2_858.jpg+http://img9.imageshack.us/img9/5181/example2ra.jpg
That's pretty much all there is to implementing alpha textures. If you need help using the Texture Coordinate Editor to align your textures to your model, there are plenty of tutorials available on the Internet to show you how to do so. That's pretty much all there is to implementing alpha textures. If you need help using the Texture Coordinate Editor to align your textures to your model, there are plenty of tutorials available on the Internet to show you how to do so.

Current revision

Contents

Implementation

The first step in making a model for Scorched in Milkshape is to actually make the model in Milkshape. A userguide to Milkshape is a little beyond the scope of this article, but are available at other places online.

A note about textures at this point: Currently, Scorched 3D only supports bitmap (.bmp) textures. These textures must be square and have a pixel resolution of a power of 2 (ie. 16x16, 32x32, 64x64, 128x128, 256x256, 512x512, 1024x1024). Textures should be kept in the same directory as the model (personally I like to place each Milkshape model and its associated textures in a seperate directory). Also, all file names should be lowercase only, since Scorched works on multiple file systems and differing file systems are case sensitive, the general rule of thumb is to always keep filenames lowercase. Alpha textures are supported as well (see below), but must meet the above specifications. All objects in the model must be textured, with the exception of the turretpivot and gunpivot objects (see below).

Once you've completed the model you should start naming the seperate components. All objects with a name that starts with "gun" are considered part of the gun (IE. gunbarrel, gunsight, gunlength), and all objects that name starts with turret are considered part of the turret (ie turretcenter, turrettop, turretwing). The turret rotates around the Y axis, along with the gun, to indicate rotation, and the gun rotates vertically to represent the elevation of the shot.

Turretpivot

turretpivot.png

Gunpivot

gunpivot.png


Unless otherwise specified, the gun and the turret rotate around the center of the turret. If this isn't the desired behavior you can specify pivot points for the gun and the turret. These pivots should be called "gunpivot" and "turretpivot" respectively, these objects ARE NOT DRAWN and don't need to be textured. All objects that start with "turret" are rotated around the center of "turretpivot" object along with all objects that belong to the gun including the gunpivot. All objects that start with "gun" are rotated around the gunpivot.

Once you've completed these steps, export the model (File>Export>Milkshape 3D ASCII...), then transfer you tank model directory to the "scorced3d/data/tanks" directory.

Now open scorched/data/tanks.xml in a text editor (usually notepad) and place an entry like this:

<tank>
         <name>My Model</name>
         <model type="MilkShape">mymodeldir/mymodel.txt</model>
</tank>


All paths in the tanks.xml file are relative to scorched/data/tanks so the above code assumes that your model is called "mymodel" and it's in a "mymodeldir" directory.

If you want to make a category for your own models, just place a category tag in your tank's XML tag (illustrated in bold) like this:

<tank>
        <name>My Model</name>
        <catagory>My Category</catagory>
        <model type="MilkShape">mymodeldir/mymodel.txt</model>
</tank>

(Note that the tag itself is misspelled and is required for it to work properly.)

That's all there is to making a tank in Scorched 3D.


Things To Keep in Mind

1) Turret must not have shared vertices with the stationary part of the model.

2) Gun must not have shared vertices with the turret.

3) Not all parts of a certain group (turret, body, gun) have to be connected together to work.

4) Although sometimes you may encounter a model that won't require a "turret", you should include an "invisible" one inside of your model anyway, or your gun placement may not be aligned properly.

5) If your tank's turret rotates down instead of up when increasing elevation you may have created the tank backwards If this is the case, just rotate the entire model around the Y axis by 180 degrees, and re-export the file to the location specified in the tanks.xml file.

6) Don't worry about the scale of your model. Scorched automatically scales the models to fit inside the tank's bounding area... Hence all tanks are approximately the same size.

Transparency Guide

Scorched does transparency through alpha textures. An alpha texture is a greyscale texture that specifies transparency values that are applied to your normal texture. The darker the pixel (black), the more transparent it will be. The lighter the pixel (white), the less transparent it will be.

The first part of this guide is actually dealing with making the textures themselves. I have constructed an (crude) example showing what I'm talking about. In "Example 1," you can see that where we have the window frame on the normal texture (left), it is completely white on the alpha texture (right). That's because we don't want to see through the frame. As for the window panes themselves you can see we have a darker color for transparency. Note that it's not completely black. If it were, it would be completely transparent and we wouldn't see the original texture.

Example 1

example1u.jpg


Now, after you've made your textures, it's time to import them into Milkshape (assuming you have your model done). To do this, click on the Materials tab and add the normal texture (in this case, "Window") as the first texture and add the alpha texture ("Window Alpha") as the second texture. You can see how it's oriented in "Example 2". (Note that I have labeled the textures clearly for better understanding. In actuality, you should probably avoid spaces and capitalization in your texture file names for compatibility reasons).

Example 2

example2ra.jpg

That's pretty much all there is to implementing alpha textures. If you need help using the Texture Coordinate Editor to align your textures to your model, there are plenty of tutorials available on the Internet to show you how to do so.


Things To Keep in Mind

1) An alpha texture does not have to be all one shade. You can have many shades.

2) The alpha texture must be the same size as the normal texture. Sizes and formats are specified above.

3) Take note that the greyscale values of the alpha texture must be aligned perfectly well to your normal texture beforehand as you cannot align the the alpha texture separately from your normal texture within Milkshape.

How to Make a Custom Projectile

Scorched 3D allows you to make a custom projectile that will replace (and only replace) the default baby missile model. To make a custom projectile, make a model like usual (only place it so the front of the model is pointing upwards) and place it in the data\accessories directory (preferably in its own directory). To implement this model into Scorched 3D, search in the tanks.xml file for the tank you want to add the projectile to and add the following line (illustrated in bold) to it:


<tank>
        <name>My Model</name>
        <catagory>My Category</catagory>
        <modeltype="MilkShape">mymodeldir/mymodel.txt</model>
        <projectilemodeltype="MilkShape">myprojectiledir/myprojectile.txt</projectilemodel>
</tank>


FAQ

Q: I get an error that says "Incorrect mesh name format..."

A: You have a space in one of your group names. You can change this in your model text file by simply removing the space in the group name.


Q: I get an error that says "Failed to find texture..."

A: Make sure you placed the texture(s) in the same directory as your model. Also, make sure the model txt file itself is listing the correct directory for your texture. To do this, open the txt file and look beneath the section that says "Materials:" and make sure the directory for your texture is listed correctly. It should say ".\texture.bmp."


Q: I added a texture but it doesn't show up on my model!

A: Make sure it is BMP file format and that it meets the dimension requirements listed at the top.

This short tutorial was written by both Cambo and Deathstryker.


Resources

To download Milkshape 3D and view tutorials, visit the official Milkshape 3D site.

Donate to Scorched3D Get it from CNET Download.com! 5 Stars