3DXExp v1.1

June 16, 1997
Copyright Michael Wimmer

Mail:
wimmer#cg.tuwien.ac.at
WWW:
http://www.cg.tuwien.ac.at

Overview

Many models you can download from the Internet are in a very bad shape: they are usually two-sided, slowing down rendering quite a bit, and their face normal vectors point in arbitrary directions. Refining such models is often a tedious task. 3DXExp is a small plugin for the modeling-package 3D Studio MAX which can be used for two purposes:

  1. Export any valid 3DS MAX scene into an easily readable and parsable ASCII-file.
  2. Quickly refine meshes downloaded from the Internet so they have proper normal vectors, material definitions and so on.

 

The following data is exported in the ASCII-file:

 

Some useful modifications can be applied to the object data before exporting them:

 

The plugin consists of two separate parts:

 

Optionally, a scene description-file can be created with some rudimentary information about the lighting of the scene.

There is also a viewer for the .3DX file-format available from the author which works for cards equipped with the 3DFX Voodoo-chipset.

System Requirements

All you need to run 3DXExp is a running 3DS MAX installation. The plugin was written with Version 1.1 of 3DS MAX, yet there is no specific 1.1-code in it and it should also work with 1.0 (please mail me if you encounter troubles).

Installation

Installation of 3DXExp is very simple: just copy the file 3dxexp.dle to the directory "3dsmax\plugins", or "3dsmax\stdplugs", if you like. The next time you start 3DS MAX, both the utility-panel and the export-filter will be available.

Using the Exporter

Step by step instructions

  1. Fire up 3DS MAX and load or create the model you want to export.
  2. If you only want to export a subset of all objects, select those you want to export
  3. Select "Export" from the "File"-menu.
  4. In the drop-down listbox "Filetype" select "ASCII-Export (3DX) (*.3DX)"
  5. Select a filename for the ASCII-file and click "OK".
  6. The dialog-box "3DX Export Options" will appear. Select options that suit your needs and click "OK". (see the description of the options-section further on in the manual!)
  7. That’s all!
  8. Using the Utility-Panel

    Step by step instructions

  9. Fire up 3DS MAX and load or create the model you want to modify.
  10. On the right-hand side of the screen, click on the tab for the "Utility"-panel (which has a hammer-icon on it).
  11. In the "Utilities"-dropdown listbox, select "3DX Utility".
  12. The panel will now be filled with options quite similar to those in the "3DX Export Options" dialog-box. Select a set of options you want to apply to all or only the selected objects in the scene.
  13. When you have selected all options you want, click on the "Apply"-button at the bottom of the panel. All the modifications will be applied to selected or all objects, depending on the "Apply to selected only"-checkbox.
  14. Go to 4. until you are happy with the results.

Description of all available options

Options specific to the "3DX Export Options" dialog-box:

By default, all objects in the scene are exported. If this checkbox is checked, only the objects currently selected are exported.

Select whether you want to export face normals. If you don’t want normals, the number of normals indicated in the file will be "0" and no normals are saved. Otherwise, the number of normals will read "1", and each face will have a normal vector attached.

Checking this checkbox will cause all information necessary for texture-mapping to be exported. This includes texture vertices with u/v-coordinates, texture faces for each face with indices into the texture vertex array and the name of the texture bitmap in the material info.

This name can have three different meanings:

Whether all exported objects should be centered around the bounding box surrounding those objects

Should material information be exported? If checked, each object will have a list of materials specifying their diffuse and specular (optional) RGB color and the type of their texture. If an object has more than one material, the material to be used for each face is specified after the face itself.

Selects whether also the specular information should be saved for each material: RGB color, shininess (size of highlight), shining strength (strength of highlight)

If this option is checked, a file with the extension .scn is also created which represents a minimal scene database, especially including lighting. See in the file format description for details.

By default, all modifications you select in the dialog box are only applied to the exported file. By checking this box, you can decide to also apply the modifications to the scene loaded in 3DS MAX (most times it is easier to do this with the utility-panel, though).

Options specific to the "3DX Utility"-panel:

With this option, you can decide whether to apply the selected modifications to all objects in the scene or only to the selected ones.

Options in both panels:

This will declare all (selected) materials as one-sided, meaning backface culling may be applied. Two-sided materials will slow down rendering considerably because backface-culling cannot be applied, as even the backside of a face might be visible.

For most imported objects, it is worth trying this out and looking whether the result still looks the same. If some faces really need the two-sidedness, the two-sided property can be applied selectively to those faces.

If some objects need two-sidedness, declare them as such with this option.

Some meshes simply have all normals defined the wrong way and will look funny. This option can be used to repair them.

This is probably one of the most important features for imported meshes: it will try to make all normal vectors belonging to a surface point to the correct side of that surface. In some imported meshes, every other normal is pointing the wrong way and the result will look very funny – this option usually repairs this, although a little bit of hand-tweaking might be necessary.

Remove any faces which only represent a point or a line (i.e., which have no area)

Smooth flat-shaded objects based upon the angle between adjacent faces: all faces which have an angle below the threshold angle between each other will belong to the same surface and will be drawn smoothly. All faces of a sphere will belong to the same surface (or smoothing-group), for example. The angle should not be higher than 90 degrees, or almost anything will be smoothed, even if there should actually be sharp edges.

Reduce the complexity of a mesh by removing faces. The "Normals threshold" parameter specifies the angle (in degrees) below which faces adjacent to each other may be collapsed into one face. The "Edge threshold" specifies the same parameter for faces that have "open" edges, i.e., edges with only one face attached. Increasing the Bias (between 0 and 1) reduces the number of degenerate (long, thin) faces.

This is an experimental function which should apply a u/v-mapping to the selected objects. This is necessary for texture mapping, so that texture-vertices with u/v-coordinates can be generated. You can specify the number and direction of tiles in both u and v-direction. At the moment, only the "Cylindrical"-mapping works, so I would suggest not using this function and using the appropriate 3DS MAX modifier instead.

Description of the 3DX file-format

The 3DX file-format is completely in ASCII and easily machine-readable. The file is case-sensitive. Each line can contain either some specified data at the beginning of the line, be completely empty (newline) or contain some comment after one of the following comment characters: " " (space), ":", "#" and ";". I will describe the file-format by placing comments in a sample file:

; Compulsory header:

3DX File 1.0

 

; Number of objects in the file:

NumObjects: 1

 

; First object description (includes 3DS MAX-name):

Object 0: Box01

 

; Object properties:

Vertices: 8 TVertices: 0 Faces: 2 Materials: 1 Normals: 0

; number of vertices, number of texture vertices (if this is

; >0, also texture faces will be in the file), number of

; materials (if >1, each face will have a material index),

; info whether face normals are stored in the file ([0|1])

 

; ---------------------------------------- Material section

; The following material-section appears only if materials>0:

Material list:

 

; One material info, including 3DS MAX name:

Material 0: graymtl

; Diffuse R/G/B-color and Alpha (=opacity) value:

Diffuse: R: 0,333333 G: 0,313726 B: 0,309804 A: 1,000000

; specular component only if selected in Export Options:

Specular: R: 0,298039 G: 0,298039 B: 0,298039 Shininess: 0,110000 Shiningstrength: 0,170000

; R/G/B color of specular component. Shininess specifies size

; of highlight (it is the x in (N.H)^x), Shiningstrength

; specifies the strength of the highlight

 

; Is this material two-sided or not ([1|0]) (i.e., is backface

; culling allowed?)

Twosided: 0

 

; the Texture can be a valid bitmap-filename,

; "NODIFFUSE" if there is no diffuse map at all, and

; "NOBITMAP" if the map is no bitmap (e.g., a procedural map)

Texture: NODIFFUSE

 

; ... insert other materials here

 

; -------------------------------------------- Vertex section

; Compulsory:

Vertex list:

 

; One vertex information:

Vertex 0: X: -31,090403 Y: -31,958305 Z: -23,771324

; X/Y/Z information comes with 6 digits of precisions (more

; doesn’t make sense, as 3DS MAX uses float)

 

; ... insert other vertices here

 

; The Texture-Vertex section will be only inserted if

; TVertices > 0:

TVertex list:

 

; U/V coordinates for one Texture Vertex:

TVertex 0: U: 0,300000 V: 0,400000

 

; ... insert other TVertices here

 

 

; ----------------------------------------------- Face section

; Compulsory:

Face list:

 

; One face information:

Face 0: A: 3 B: 0 C: 1 AB: 1 BC: 1 CA: 0

; A/B/C are indices into the vertex list. AB/BC/CA specify

; whether the corresponding edge should be drawn or not

; (interior edges will have 0 here)

Smoothing: 1

; a 32-bit integer containing the bitwise OR of the 32

; possible smoothing groups for that face (so "3" would

; indicate that the face belongs to group 1 and 2). "0"

; specifies that the face should be flat-shaded.

 

; the following Texture Faces appears only after each face

; if TVertices > 0:

TVFace 0: TA: 0 TB: 2 TC: 1

; TA/TB/TC are indices into the Texture Vertex list

 

; the material index is only inserted if Materials > 1:

Material: 2

; the index can be > Materials, it will simply be wrapped

; (taken modulo Materials)

 

; ... insert other faces (+tvfaces) (+material indices) here

 

; ------------------------------ End of one object definition

 

; ... insert other object definitions here

 

; ------------------------------ End of 3DX file

 

Description of the .SCN file-format

The .scn file-format is mainly used by my other interactive previewer, View3DFX, to provide information about the contents of a scene. It has information about:

 

On demand, the 3DX exporter can generate a standard .SCN-file which sets the camera at an initial location, specifies a default global ambient light, contains all the lights in the 3DS MAX scene (but not with all their properties), and contains exactly one actor, which is the .3DX-file currently exported. I will again describe the file format via an annotated example.

Again, the file is case sensitive, comment rules are the same as for the .3DX file-format. Some of the lines are optional, but if they appear, they must be in the order shown (i.e., you cannot exchange to optional lines).

; Compulsory header:

Actor Database

 

; Optional: path to .3DX and texture bitmap files.

; this path can be relative

ObjectFilePath: objects\

 

; Optional: a global specularity factor to multiply with

; each individual material specularity to obtain the specular

; exponent. The default value for this is 400

Specularity: 390

 

; Optional: global ambient color (R/G/B values):

Ambient Color: R: 1 G: 1 B: 1

 

; Optional: global ambient color intensity. If a color is also

; specified, this is a multiplier. If not, it is interpreted

; as monochromatic global ambient color:

Intensity: 0.02

 

; Compulsory: Number of actors and number of Lights:

Actors: 1 Lights: 2

 

; Compulsory: initial camera location. Will be set to

; the following by the 3DX exporter:

Camera: X: 0 Y: -1000 Z: 0

 

; ------------------------------------------ Light section

 

; Compulsory (even if Lights == 0): light list:

Light List:

 

; One light description (including 3DS MAX name):

Light 0: Light01

 

 

; The Type can be one of the following:

; DIRECTIONAL: monochromatic, directional light

; OMNI: monochromatic, not attenuated light

; (those two are not generated by the exporter – they

; allow for faster rendering, but are not as flexible)

; GLDIRECTIONAL: OpenGL-like directional light with

; optional color and intensity

; GLOMNI: OpenGL-like point light source with optional

; color, intensity and compulsory attenuation

; GLSPOTLIGHT: OpenGL-like spot light source with all

; properties of GLOMNI, plus a direction, Cutoff angle

; and spotlight exponent

Type: GLSPOTLIGHT

 

 

; for OMNI, GLOMNI and GLSPOTLIGHT: light position:

Position: X: 0 Y: 0 Z: 0

 

; for DIRECTIONAL, GLDIRECTIONAL and GLSPOTLIGHT: light

; direction (need not be normalized):

Direction: X: 0 Y: 0 Z: 1

 

; for GLOMNI and GLSPOTLIGHT: Attenuation and bounding sphere:

; A/B/C specify the constant/linear/quadratic attenuation for

; the following formula, if d is the distance to the light:

; "attenuation = 1 / (A + B * d + C * d^2)", which will be

; multiplied to the lighting factor. "Radius" specifies a

; bounding sphere for the light, any objects farther away

; are not lit by this light.

; NOTE: 3DS MAX attenuation is not mimicked! You can only

; export the "Radius" by specifying a valid "Attenuation End

; Range" in 3DS MAX and "Use Attenuation". A/B/C will have

; the following default values in any case:

Attenuation: A: 1.0 B: 0 C: 0 Radius: 5000

 

; for GLSPOTLIGHT: Cutoff angle (in degrees) and spotlight

; exponent. Any vertex which deviates more than the cutoff

; angle from the light direction will not be lit. This defines

; the spotlight cone. The spotlight exponent specifies how

; bright the spotlight is in the center and at the border:

; "factor = (cosine of angle between light direction

; and vertex) raised to the power of Spotexponent"

; View3DFX only calculates this accurately for powers of 2,

; (0, 1, 2, 4, 8, ...), for other values a (fast)

; approximation is used.

; NOTE: 3DS MAX spotlights are not mimicked! You can only

; export the "Falloff Size" (which translates to "Cutoff"),

; but not the "Hotspot Size"!

; The spotexponent will have the following default value:

Cutoff: 30 Spotexponent: 1

 

; Optional for any GL-light: RGB-color

Color: R: 0.3 G: 0.3 B: 0

 

; Optional for any light: Intensity (if no color specified,

; monochromatic light is assumed).

; NOTE: the Intensity of a light may assume NEGATIVE values!

; this allows to specifies areas of darkness!

Intensity: 0.7

 

; optional for any light: should this light be enabled or not

; ([1|0]):

Enable: 1

 

; ... insert other lights here

 

; ---------------------------------------- Actor section

 

; Compulsory keyword:

Actor list:

 

 

; one Actor definition, including initial position:

Actor 1: X: 0 Y: 0 Z: 500

 

; Filename for the Actor 3DX-file (including extension):

Filename: 1701d.3dx

 

; Optional: Specify an RGB-diffuse color for this actor,

; which is used if it contains no materials. Also the

; Alpha-value (= opacity) must be specified, then.

; The following default will be used if it is not specified:

Color: R: 0.5 G: 1 B: 1 A: 1

 

; Optional: Specify an RGB-specular color for this Actor

; which will be used if it contains no materials.

; The following default will be used if it is not specified:

Specular: R: 0.7 G: 0.7 B: 0.7

 

; Optional: Specify a scale for the object with which all

; Vertex coordinates are multiplied when loading

Scale: 1

 

; Optional: specify whether all normals should be reversed

; when loading this actor ([0|1]):

Flipnormals: 0

 

; Optional: Specific to the program View3DFX, this specifies

; that a BSP-tree should be generated on startup for this

; actor. This is mainly to allow antialiasing. The number

; controls the accuracy (and the computing time) for the

; BSP tree. 0.1 usually is quite fast, but will have errors,

; 0.01 is slow but will be correct almost always. Anything

; lower than 0.01 will take forever if the mesh is complicated

GenerateBSP 0.1

 

; ... insert other actors here

 

; Compulsory end of file:

End Database

What’s new in this release (v1.1, June 16, 1997)?

The main improvement of this release compared to the one available on the Web for some time (v1.0, May 2, 1997) is the addition of a possibility to create a default scene file including lighting information. One checkbox to allow this has been added to the Export Options dialog box. Please see the description of the .scn file-format for usage and restrictions of this feature!

Disclaimer

Under no circumstances will Michael Wimmer be liable for any damages or losses arising from the use or misuse of this software. If you use this software, you agree to these terms.

This production is the intellectual property of Michael Wimmer with the following exceptions:

3D Studio MAX by Kinetix

All trademarks are the copyright of their respective owners.

Distribution

This production is freeware, and must be distributed freely through public information exchange mediums like BBSs and Internet provided it is unmodified and distributed along with all accompanying files. No monetary gain is allowed through the distribution of this production. Distribution on CD-ROMs or any other forms sold for money requires special permission granted by Michael Wimmer.