Making 3D Models
From Blue Mars Developer Guidebook
This page is part of a series on Building for Blue Mars
|A 3D model is a file that describes the shape and other characteristics of an object to be displayed in some graphics engine. Together the characteristics are called the geometry of the object. The geometry is not sufficient by itself. You additionally need texture maps, which are images applied to the surface of the geometry, and material settings which control how the graphics engine converts the geometry and texture maps into the final image on the screen. For example, if the opacity setting is 50%, then the object will be rendered as half transparent. This page will discuss creating the geometry, other pages will discuss texture creation and material settings.|| |
To create a 3D model for Blue Mars, appropriate software is needed. There are numerous such programs in existence, and people who already know how to use them. So rather than build the modeling tools into the Developer Toolkit, the various Editors in the Toolkit accept as input a 3D model in the COLLADA "Digital Asset Exchange" (.dae) file format. This way developers can use a 3D program of their choice, and avoids adding yet another 3D tool to learn to the existing multitude. So besides other technical details of how you make your model, the 3D program needs to be able to save properly to that format. The COLLADA Products Directory lists software with some level of support for the format. The Third Party Software Tools page lists some that are known to work for Blue Mars.
Multiple file conversions are not recommended. For example if your preferred 3D program does not support COLLADA export, and you translate the model through an intermediate one that does, it is more likely to cause errors.
Although the COLLADA file format is fairly common among 3D programs, it is an evolving standard, and not all plugins, importers, and exporters are compatible with each other or with Blue Mars. It is an XML schema, which means it is a human-readable text file, and can be edited with a text editor, so sometimes a file can be fixed manually to work. The [Blue Mars COLLADA compatibility guide] gives technical details of the required file format, though the page has not been updated in a while, so the compatibile software list needs updating.
A 3D model will describe some or all of the following characteristics of an object:
- Vertexes - These are points in a 3D space which are located by three numbers giving the X, Y, and Z axis position relative to an origin point. Blue Mars uses metric centimeters as the measure for individual object.
- Triangles - These are the simplest shapes which have an area, and are therefore universally used in 3D programs to define the shape of an object. One model can have from one to many thousands of triangles. Triangles are defined by the 3 Vertexes which make up it's corners. An edge is derived as the line between a pair of vertexes. A set of triangles which share common vertexes and edges is called a mesh. A full model may have multiple meshes which do not intersect.
- Normals - A normal is a direction perpendicular to some part of a model. The angle between a light source and the normal determines how that part of the model is colored (shaded). For example, if the light source is more than 90 degrees away from the normal, it is behind that part of the model, and will not illuminate it. Normals can be defined per vertex, or given in a normal map which defines it per point on the map. Smoothing will interpolate the normal angle between given points, and so vary the lighting effects gradually over a surface. This tends to make it appear as a smooth surface rather than a faceted geometric shape.
- Material IDs - These define which texture map (image) is applied to a given triangle when the object is displayed.
- UV Coordinates - These define which part of a texture map is applied to what areas of the object.
- Optional Data - The following are not required, but if present will be recognized by the Blue Mars file conversion process: Levels of Detail, Physics Proxy, Occlusion Proxy, Vertex Colors, Breaking Nodes, Animation Rigging
General Model Requirements
- Units Scale - Blue Mars uses metric centimeters as the units for individual object. Terrain maps use metric meters as the units. When making 3D models use centimeters. Normally, you should scale your model to the actual size you want it to be when used.
- Location - The pivot or gizmo for the model should be located at the 0,0,0 position. When imported, the rest of the model will keep the relative location to the pivot. For clothing, it needs to be the correct height above ground as worn by the avatar. The best way to do this is import the avatar reference model to your 3D program, adjust the clothing to fit, and then delete the reference model before export.
- Complexity - A maximum of 64K vertexes, triangles, etc, per object in general. For the avatar body mesh, it must not be changed from the template count of about 20K triangles. For clothing and other attachments to the avatar body, it must be under 5,000 triangles. The exported object may have disconnected meshes which are listed as separate items in the 3D program, except in the case of clothing when they should be merged into a single listed item.
- Clean for Export - The model should not contain any isolated vertices or degenerate triangles (less than 0.005 cm in size), nor any extraneous items like cameras. Any transforms applied should be reset prior to export. Other specific requirements will depend on the 3D program you use.
- Material Assignments - The rendering engines for 3D modeling software are generally different than the CryEngine 2 used for Blue Mars. Therefore most materials settings will not carry over when exported. Typically you need only set up one main material, with some number of sub-material slots, and assign the submaterial IDs to the triangles of the model (one ID per triangle). The maximum is 32 submaterials, but 8-10 is a recommended maximum for performance reasons.
- UV Maps - You can define a custom UV Map for your model. This translates positions on the texture maps to positions on the model when displayed, in other words what part of the image appears on what part of the model. The mapping is numerically exported as part of the .dae file, but you can also save the UV map as an image to guide your texture creation.
Specific Program Workflows
It is beyond the scope of this Developer Guidebook (wiki) to teach general use of any 3D programs. For that, please refer to printed books, the program's manual and built in help, web tutorials and videos, classes, and commercial training. For the more popular software a lot of the above are available. This section will reference specific methods to make things for Blue Mars.
AutoDesk 3ds Max
- 3ds Max Basic Tutorial - This covers plugins, settings, creating a basic box, and importing it to the Blue Mars format.
- 3ds Max - Basic Guide to Exporting .DAE File - Appears to be aimed at older versions of 3ds Max using the the ColladaMax exporter.
- Tutorials - See in particular the Animations, Geometry, and Materials and Textures sections.
Note: The stable version of Blender is version 2.49. Version 2.53 is in Beta, but is not fully ready for Blue Mars production work as of Sep 2010. It needs improvements in documentation and COLLADA export.