Star Wars TIE fighter loaded
with the 3DS importer.
The 3D Studio import library is a collection of classes and structures to allow loading 3ds, mli (material) and prj (project) files into your Delphi and Borland C++ Builder application.
Supported features of the import library and the viewer program Opener
- Loading of all available information from a *.3ds file. If I say all then I mean all. Don't fiddle around with unknown or badly documented chunks. Instead use the provided "database" structure to get hold of anything you like. This includes (among many other things):
- Global settings like versions, background, atmosphere, mesh settings, viewport settings.
- Mesh data like: options (e.g. visible lofter), vertex data, texture data, mapping icon information.
- Omni and spot lights.
- Materials data like: options (e.g. additive transparency), colors, shininess, transparency etc., map settings for all maps used in a *.3ds file (texture 1 and 2, opacity, bump, specularity, shininess, self illumination, reflection).
- Detailed view of the chunk structure (just for reference, you don't need this).
- Keyframer data for all object types (spline values, position and color keys etc.)
- An OpenGL viewer using as much as possible data from a *.3ds file to display it. This includes:
- A very effective algorithm to compute normal vectors from smoothing groups (no implied average angles needed).
- Solid, gradient and bitmap background.
- Fog settings.
- Textures with auto scaling, so they don't need to be a power of 2 in size (supported files are: jpg, tga, gif, bmp, pcx, bw, rgb, cel, pic).
- Auto centering of meshs.
- Alpha blending.
- Line and fill polygon modes.
- Direct and spot lights.
- An improved camera model using focal length for zoom.
- Hierarchical models using keyframer data (including multiple instances of a mesh etc.).
- One Delphi class (TFile3ds) exposes all data of a *.3ds file using a few lists and supports loading from a stream as well.
- Freeware DLL included to enable import of tga, gif, pcx and jpg files (NViewLib.DLL). If this DLL is not available then jpg, tga, gif and pcx files cannot be used by Opener.
- Global texture path as well as a MRU list for already seen 3ds files is implemented (using a simple *.ini file in the application's directory).
- File drop aware application.
Limitations of the viewer program
- The user interface of Opener is somewhat overloaded due to the huge amount of information to be displayed. The program has further limitations like being not sizable due to the overall layout which needs a specific minimal space.
- Visible lofter, matte object, cast/receive shadows, icon mapping and box mapping are not used in OpenGL display.
- Light source exclusion and attenuation are not used in OpenGL display as well as visible cone and projector for spot lights.
- Cameras are totally ignored. Instead an own camera handling is implemented.
- Many of the material properties are not used for rendering as they don't have an equivalent in OpenGL (yet). Only one texture image (Texture 1), colors, shininess, transparency and two sided rendering values are taken into account.
- Keyframer data (placing, rotation etc.) for light sources and cameras is ignored.
- Animation using keyframer data is not implemented.
- Although material transparency is implemented it produces sometimes strange results because for a properly working implementation all polygon meshs would have to be sorted from farthest to nearest (which isn't done in Opener).
- Transparent meshs will still hide those parts of meshs which are farther away (depth testing). One could disable depth testing while drawing transparent meshs but this produces other even stranger results.
- SXP (procedural texture), IFL and TIF texture files will not be loaded.
- Depth cueing atmosphere is not supported, layer fog is handled as normal fog.
- There's a problem with face winding in some models. Sometimes parts of a mesh seems to be stored with the opposite face winding than the rest of the model. I have not found any indication telling this reversed order, so I cannot set it correctly.
- I have not found a rule when to use texture modulation. As this depends on the material color it happens sometimes that parts of a mesh appear very dark (if its diffuse color is nearly black) although they are textured and should display in decal mode. Currently texture modulation is set by default since this looks much better on most models.
These limitations concern only the application and the OpenGL viewer implementation. The import library still exports all available data.
Some *.3ds models have huge extents (45.000 and more units) while usual extents reach from 1 to 100 units. Since the depth buffer looses precision the larger the view range is (near plane / far plane distance) I nailed down the view range (also called: depth of view) to 1000 units, which may result in not visible meshs as they are clipped at this boundary. On the other hand 1000 is a quite high value and may result in socalled depth fighting if depth values of different meshs are relatively near together. By using the overall scale in the viewer window you can set scale values from 0.001 to 30 for the scene. This, though, has side effects. Light source positions are updated correctly but the fog ranges are not. Additionally, if the scale value is not one then auto-normalizing of vertex normals is enabled which lowers (depending on the graphics board and the CPU) the rendering speed remarkably.
The program Openeras well as all included source code (the import library) is freeware for any usage as long as my reference (titel, name, eMail address, copyright) remains in the source and I'm given proper credit in each application where the import library is used. I do still keep all rights on this software and may not be charged for any failure or problem arising from its usage.
|Compile demo application showing the 3D Studio import library in action. It uses OpenGL for display.|
|Version: n/a||Last change: 03. Feb 2007|
|Download count: 73473||Size: 3,569 KB|
|Author: Mike Lischke||Website: www.soft-gems.net|
|Platform: Windows 9x / Me, Windows NT / 2K / XP||Type of download: Application|