## Appendix D: The Conv3ds.exe Utility

The Conv3ds.exe utility converts 3-D models produced by Autodesk 3-D Studio and other modeling packages into the Microsoft® DirectX® file format. By default, the utility produces binary .x files with no templates.

### Using Conv3ds.exe

You can run Conv3ds.exe with no options, and it will produce an .x file containing a hierarchy of frames. For example, consider the command:

    conv3ds File.3ds

This command will produce an .x file called File.x from the .3ds file. You can use IDirect3DRMFrame::Load to load the frame.

### Conv3ds.exe Optional Arguments

Conv3ds.exe -A

If the .3ds file contains key frame data, you can use the -A option to produce an .x file that contains an animation set. The command for doing this would be:

    conv3ds -A File.3ds

The File.3ds parameter is the name of the file to be converted. You can use IDirect3DRMAnimationSet::Load to load the animation.

Conv3ds.exe -m

Use the -m option to make an .x file that contains a single mesh made from all the objects in the .3ds file.

    conv3ds -m File.3ds

Use IDirect3DRMMeshBuilder::Load to load the mesh.

Conv3ds.exe -T

Use the-T option to wrap all the objects and frame hierarchies in a single top-level frame. Using this option, all the frames and objects in the .3ds file can be loaded with a single call to IDirect3DRMFrame::Load. The first top-level frame hierarchy in the .x file will be loaded. The frame containing all the other frames and meshes is called "x3ds_filename" (without the .3ds extension). The -T option will have no effect if it is used with the -m option.

Conv3ds.exe -s

The -s option allows you to specify a scale factor for all the objects converted in the .3ds file. For example, the following command makes all objects 10 times bigger:

    conv3ds -s10 File.3ds

The following command makes all objects 10 times smaller:

    conv3ds -s0.1 File.3ds

Conv3ds.exe -r

The -r option reverses the winding order of the faces when the .3ds file is converted. If, after converting the .3ds file and viewing it in Direct3D, the object appears inside-out, try converting it with the -r option. All Lightwave models exported as .3ds files need this option. See 3DS Files Produced from Lightwave Objects for details.

Conv3ds.exe -v

The -v option turns on verbose output mode. Specify an integer with it. The following table shows the currently supported integers.

Option | Meaning
-v0 | Default. Verbose mode off.
-v1 | Prints warnings about bad objects, and prints general information about what the converter is doing.
-v2 | Prints basic key frame information, the objects being included in the conversion process, and information about the objects being saved.
-v3 | Very verbose. Mostly useful for the debugging information it provides.

Conv3ds.exe -e

The -e option allows you to change the extension for texture map files. For example, consider the command:

    conv3ds -e"ppm" File.3ds

If File.3ds contains objects that reference the texture map file Brick.gif, the .x file will reference the texture map file Brick.ppm. The converter does not convert the texture map file. The texture map files must be in the D3DPATH when the resulting .x file is loaded. The D3DPath is an environment variable that sets the default search path.

Conv3ds.exe -x

The -x option forces the Conv3ds.exe utility to produce a text .x file, instead of a binary .x file. Text files are larger but can be hand-edited easily.

Conv3ds.exe -X

The -X option forces the Conv3ds.exe utility to include the Direct3D Retained Mode .x file templates in the file. By default, the templates are not included.

Conv3ds.exe -t

The -t option specifies that the .x file produced will not contain texture information.

Conv3ds.exe -N

The -N option specifies that the .x file produced will not contain normal vector information. All the Direct3D Retained Mode load calls will generate normal vectors for objects with no normal vectors in the .x file.

Conv3ds.exe -c

The -c option specifies that the .x file produced should not contain texture coordinates. By default, if you use the -m option, the mesh that is output will contain (0,0) uv texture coordinates if the .3ds object had no texture coordinates.

Conv3ds.exe -f

The -f option specifies that the .x file produced should not contain a frame transformation matrix.

Conv3ds.exe - z and Conv3ds.exe -Z

The -z and -Z options allow you to adjust the alpha face color value of all the materials referenced by objects in the .x file. For example, the following command causes Conv3ds.exe to add 0.1 to all alpha values under 0.2:

    conv3ds -z0.1 -Z0.2 File.3ds

The following command causes Conv3ds.exe to subtract 0.2 from the alpha values for all alphas:

    conv3ds-z"-0.2" -z1 File.3ds

Conv3ds.exe -o

The -o option allows you to specify the file name for the .x file produced.

Conv3ds.exe -h

The -h option tells the converter not to try to resolve any hierarchy information in the .3ds file (usually produced by the key framer). Instead, all the objects are output in top-level frames if the -m option is not used.

### 3DS Files Produced from Lightwave Objects

There are several issues with .3ds files exported by the Trans3d plug-in for Lightwave. These are best handled using the following Conv3ds.exe command:

    conv3ds -r -N -f -h -T|m trans3dfile.3ds

All the .3ds objects produced by Trans3d and the Lightwave object editor need their winding order reversed. Otherwise, they appear inside-out when displayed. They contain no surface normal vector information.

### Hints and Tips

If you cannot see objects produced by Conv3ds.exe after loading them into the Direct3D Retained Mode viewer, use the scale option -s with a scale factor of approximately 100. This will increase the scale of the objects in the .x file.

If, after loading the object into the viewer and switching from flat shading into Gouraud shading, the object turns dark gray, try converting with the -N option.

If the textures are not loaded after the object is converted, check whether the object is referencing either .ppm or .bmp files by using the -e option. Also check whether the textures' widths and heights are a power of 2. Make sure the textures are stored in one of the directories in your D3DPATH.

Currently, Conv3ds.exe cannot handle dummy frames used in .3ds animations. It ignores them. However, it will convert any child objects.

© 1997 Microsoft Corporation. All rights reserved. Terms of Use.