Exporting
To use Maya models in Ygdrasil, you must export them in a format that YG can read. It can't read native Maya files, but can read a number of other 3D formats; a short list of the more popular ones includes:- WaveFront OBJ (.obj)
- AutoCad DXF (.dxf)
- 3DStudio Max (.3ds)
- OpenFlight (.flt and .flt11)
- Designer's Workbench (.dwb)
- McDonnell-Douglas GDS (.gds)
- Open Inventor (.iv)
- Lightscape (.lsa, .lsb)
- MEdit (.medit)
- SideEffects Software PRISM (.poly)
- ArchVision (.rpc)
- Ben's 3D Format (.b3d)
OBJ is probably the most commonly used format; as one of the simplest 3D model formats around, it's compatible with a lot of 3D programs. OBJ does have some limitations, though - no hierarchy, low texture resolution, and from Maya, textures and UV's don't export at all. An alternative to OBJ for working with Maya and Ygdrasil is B3D, which supports hierarchy, hi-res textures, uv mapping, vertex and fragment shaders, multitexturing, flipbook animation, and an assortment of settings and tweaks like wireframe display and optional backface culling. We'll cover the process for exporting and using B3D files here; the process is similar for OBJ or other formats.
Preparing Models
- Save a copy of your Maya file if you're going to do much serious cleanup work on it.
- Clean up your geometry - clean up faces with holes, non-planar polygons, etc
- Convert NURBS and Sub-D's to Polygons
- Remember, Low-Poly Equals Good
- If you don't need history for an object, go ahead and delete it.
- Only apply one material per object; applying more materials to specific faces tends to create strange artifacts.
Loading the Exporter Plugin
All file import and export functions are done through Plugins. Load the plugin in Window->Settings and Preferences->Plugin Manager. Look for B3DExporter. Check "Load" and "AutoLoad".
Exporting
To export everything, go to File->Export All. To export only some of the objects, select them and go to File->Export Selection. For either, choose the Options to get the export options.Export Options
- Export Components (Colors, Normals, UVs) : exports additional data for each vertex - color-per-vertex, normals for each vertex, and texture coordinates.
- Output Verbose Tags: B3D files are just plain text. if this option is checked, everything in the B3D file uses full words to describe it (like "Transform"). if unchecked, the tags in the B3D file are abbreviated (e.g. "xfrm"). This can reduce the file size a bit, but verbose tags are handy if you want to edit anything by hand.
- Re-use materials: if you have a lot of objects that all use the same material, this option tries to define the material once and then just refer back to it for the rest of the objects. There are some bugs with this option so it's safer to leave it off.
- Export Lightmaps: if you've made pre-lighting texture lightmaps using Mental Ray Bake, this option will include them as a layered texture in the B3D file. This will only work if you have the default directories set up in your Project Options - it looks in renderData/mentalray/lightMap for the textures.
- Disable dynamic lighting: normally, lighting on a surface will be a combination of the lightmap and any actual lights in your YG scene. Disabling dynamic lighting just sets the diffuse color of the surface to pure black and the emissive color to pure white, so the surface is not affected by lights in YG at all and you just see the lightmap's shading.
Performer Display Options
- Backface Culling: doesn't draw polygons that are facing away from the camera. For convex solids, like spheres, cubes, etc, these faces are always invisible anyway because they are hidden by the front faces of the object. Culling backfaces speeds up drawing because you're not wasting time drawing things that will be obscured. For non-convex objects, however, this can create strange artifacts as parts of the model disappear from different angles. Which way a face is pointing is defined by its normal.
- Wireframe: draws the object in wireframe instead of shaded polygons
- Use pfdGeoBuilder Functions: OpenGL Performer's 'pfdGeoBuilder' optimizes model geometry by reconstructing it as triangle strips instead of a single arbitrary mesh or 'polygon soup'. Optimized models sometimes draw significantly faster, but have some downsides. Local lighting, like spotlights and point lights, will create jagged artifacts on objects that use the GeoBuilder; they also cannot have multitexturing, lightmaps, or vertex and fragment shaders attached to them.
- Convert to TriStrips: Controls the triangle-strip reconstruction feature of the GeoBuilder. These two options will sometimes give performance gains, but will sometimes cause major artifacts if it rebuilds the surface incorrectly. Default option is Off for both.
Transparency
- Transparency Mode: sets the method used for drawing transparent surfaces, or surfaces with textures with alpha channel. If your objects are opaque, set the transparency mode to "Off". The other two primary options are "Fast" and "Best" to get different methods of transparency blending. The MultiSample modes are apparently only available on hardware with multisample buffers like SGI InfiniteReality. Note that Performer does NOT do per-face depth-sorting, so transparent objects will often produce jagged artifacts unless you also turn on backface culling.
- Alpha Test and Alpha Threshold: Use these to set a cutoff alpha value for whether a fragment should be drawn. On surfaces with textures with alpha channels, for example, you may want to have a threshold above 0 to reduce jaggies around the edge of the image.
Hierarchy
- Full: export the full hierarchy, including nested transforms. Use this if you want to animate your B3D model using the mayaAnimation node in YG, or otherwise need to maintain the parenting structure of your original model.
- Static: export the full hierarchy, but display it as static transforms instead of dynamic ones. (in Performer, this uses pfSCS nodes instead of pfDCS's). This means that the individual parts cannot be animated, but the file still contains the parenting structure.
- Flattened: freeze all transforms and just export polygon meshes without transfom nodes. This is the simplest export method and produces smaller and faster files, but the parenting structure is lost.
- At Origin: this is really only useful if you're exporting a single object. It exports the object from the origin, rather than from its actual location, essentially just ignoring the highest-level transform on the selection. If you have an object placed in Maya, and want to have it placed the same in Ygdrasil, you can use this option, note the actual transform values in the Channel Box, and copy those into the position(), orientation(), and size() messages in the object() node in YG.
Textures
- Export Textures: if off, just ignores all textures on materials.
- Convert Procedural Textures to File Textures: turns Checker, Bulge, Fractal, etc. textures into .rgb files using the MEL convertSolidTx function.
- Overwrite Existing Texture Files: if you're exporting the same model repeatedly after editing things but aren't changing the textures at all, turn this off to save time in the export process.
- Display Textures in Full Color Mode: by default, Performer stores and draws textures in a 16-bit mode - 4 bits for each channel, Red, Green, Blue, and Alpha. This means each channel has a range of just 16 values, as opposed to the 256 values in full color (24 bit / 32 bit) mode. Doing this means you can load more textures at once onto the graphics card, but you'll see a lot of banding and artifacts and reduced color quality on textures with smooth gradients. It's basically like looking at a monitor in 'thousands of colors mode' instead of 'millions,' or exporting graphics as GIFs.
- X,Y Texture Resolution: set the resolution to use when converting procedural textures to file textures. Doesn't change the size of existing file textures.
Animation
- Flipbook: Turns on flipbook animation
- Start, End, FPS : sets the beginning and end range and the frames per second for the flipbook.
This option will produce one B3D file that contains different geometry for each frame in the flipbook range. It makes very, very, very large files, so you should really only do this with short sequences and very low-polygon models. It's quite easy to generate B3D's that are hundreds of MB or even several GB with this. But, it's good for animating characters, fluids, blendshapes, anything that can't be animated just through curves on transforms.
When exporting a flipbook, the safest thing to do is export just one object. If you have multiple objects, group them together, select the group, and use Export Selection. If you just export a bunch of objects using flipbooking, what you'll actually get is one frame for each individual object!
(c) Ben Chang