The latest releases of Performer include a Maya to .PFB exporter, which perhaps makes B3D moot; however, I find it handy to have a file format which can be extended in future if necessary for features like real-time shaders, skinning, etc. Another option would be, of course, to use X3D - but it seemed quicker to just make up my own language than learn another one.
B3D uses a concept of Nodes, such as a Transform node or a PolyMesh node. Each node has a set of fields, which can be single values, arrays, other nodes, or arrays of nodes. Coordinates and other multi-value types are written without commas. Commas are used to separate items in an array, such as vertices in a vertex list. Curly brackets { } are used to define the contents of Nodes, while square brackets [ ] are used to define arrays.
One unusual feature of the B3D format is the Shading Group. Geometry is defined in PolyMeshes, stored as an array of vertices. Individual faces are created by indexing into the array of vertices. The lists of faces are contained in Shading Groups. Each Shading Group also contains a Shader, which specifies the material properties and texture for that set of faces. The idea is that one mesh can have several materials applied to different areas. This is, coincidentally, the way Maya represents poly meshes, though many other formats split the mesh into different ones for each material.
Any node can be named - for example, Transform transform1 { translate 1 2 3 }
creates a transform named "transform1". For most
nodes this doesn't really matter. For transforms, naming is important if you're going to try to animate them. For Shaders, you can reference
already-created Shaders with the USE command, as in VRML:
(in one PolyMesh)
Shader red {
diffuse 1 0 0
}
.
.
(in another)
Shader USE red
colors | export color-per-vertex |
normals | export normals per vertex |
uvs | export texture coordinates |
Output Verbose Tags | verbose B3D files are easier to read & edit by hand; concise mode gives smaller file sizes. |
Backface Culling | enables backface culling. backface culling improves performance by not drawing polygons facing away from the viewer. backface culling can make faces seem to disappear on non-convex models, or models that you view from inside. |
Convert to .pfb (unimplemented) | convert B3D file to .PFB file after exporting |
Convert to Tristrips | use tristrip meshing Performer optimizes geometry by breaking it up into fast-drawing triangle strips. This gives an impressive performance improvement, but can create the appearance of faceting on flat planes when using local lights (point lights or spotlights). |
wireframe (unimplemented) | Draw the object in wireframe instead of shaded mode. |
Display Textures in Full Color Mode | tells Performer to load textures as full 24 bit images. non-full color mode, 16 bit images, draw faster and take up less memory; however, they will not appear as smooth. |
Hierarchy | These options control the way hierarchical transforms are handled. Full: export the full hierarchy. Performer will load transforms as DCS's, which can be animated. Static: export the full hierarchy, but load as static SCS's. These are faster than DCS's but can't be animated. Flattened: freeze transforms, exporting only objects. The transform hierarchy is removed. At Origin: Ignore the top transform in the hierarchy, exporting the object as if it were at the origin. Use this to position an object in Maya but not export it at that position, if you want to position it (say, for animation, setting up triggers, etc) in your VR application. |
Include Textures | export texture files |
Convert Procedural Textures | convert procedural textures in Maya into file textures. Otherwise, they are ignored. |
Use original file | For file textures, this option tells the exporter to convert the file into a .RGB texture file directly. If it is unchecked, the exporter will use the MEL convertSolidTx function, which re-resamples the whole shader network. This takes longer and is sometimes redundant, but useful if you have complex shaders. |
Convert to .pfi (Unimplemented) | convert .rgb textures into .pfi's after exporting |
Overwrite existing textures | if you are re-exporting a model but the textures are still the same, uncheck this to save a little time |
Bake lighting (Unimplemented) | a variation on convertSolidTx that bakes lighting from Maya lights into the textures |
Keyword | Concise | Type | Description |
Transform | xfm | Node | A Transform Node |
scale | scl | 3 floats (x y z) | |
translate | tra | 3 floats (x y z) | |
rotate | rot | 3 floats (rx ry rz) | |
children | chl | array of nodes | a list of child nodes |
dynamic | dyn | bool | Performer option: include this keyword to make Performer create a DCS for animation.
Leave it out to create a static SCS, which provides a performance boost. |
pivot | piv | 3 floats (x y z) | pivot point of the transform |
PolyMesh | poly | Node | A polygonal mesh node |
vertices | vtx | array of floats [x y z, x y z, ...] | list of vertices |
normals | nrm | array of floats [x y z, x y z, ...] | list of normals |
uvset | uvs | array of floats [u v, u v, ...] | list of UV texture coordinates |
colors | col | array of floats [r g b, r g b, ...] | list of per-vertex colors |
backfaceCulling | bool | set to 1 to use backface culling, 0 to show backfaces | |
maxTriStripLength | int | max length of tristrips that the Performer mesher should make. Ignore or set to higher numbers for speed optimizations; set to 0 to disable mesher and avoid problems with surfaces appearing faceted under local lighting. | |
shadingGroups | grps | array | list of shading groups |
ShadingGroup | g | node | shading group node. connects a shader to a set of faces. |
Shader | shdr | node | Shader node, contains material and texture |
diffuse | dif | 3 floats (r g b) | diffuse color |
ambient | amb | 3 floats (r g b) | ambient color |
emissive | emi | 3 floats (r g b) | emissive (incandescent) color |
specular | spc | 3 floats (r g b) | specular color |
transparency | trn | float | transparency |
reflectivity | ref | float | reflectivity (shininess) |
texture | tex | string | texture filename |
faces | fcs | array | list of faces for the shading group |
Face | f | node | polygon face node |
vertexIndex | v | int array [i1 i2 i3 ...] | list of vertex indices (from the vertices list) |
normalIndex | n | int array [i1 i2 i3 ...] | list of normal indices |
colorIndex | c | int array [i1 i2 i3 ...] | list of color indices |
uvIndex | t | int array [i1 i2 i3 ...] | list of UV indices |