B3D Documentation

B3D is a 3D file format similar to OpenInventor or VRML. It includes support for polygon meshes, components (UV's, normals, and colors), transform hierarchy, materials and textures, environment textures, and a few optimization options. It was created specifically for exporting models from Maya into SGI's OpenGL Performer toolkit, though it could certainly be used for other things too. The original impetus was to address limitation of the existing sets of Maya file exporters and Performer file loaders. For instance, the Maya OBJ exporter ignored textures and materials completely, and the OBJ format doesn't include a concept of hierarchy so it's not ideal for complex animations. The Open Inventor exporter solves some of these problems, but the Performer loader tends to lose the names of transform nodes, again creating problems for complex animation techniques. Rather than deciphering and patching existing code, I decided to just start from scratch. I wrote the B3D format as a slightly modified subset of VRML 2.0, with a few special features related to Performer.

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


B3D Maya Exporter

Options for the Maya Exporter plugin:

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.
HierarchyThese 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

Format Specification

Keywords

Keyword ConciseTypeDescription
Transform xfm NodeA 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 nodesa list of child nodes
dynamic dyn boolPerformer 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
PolyMeshpolyNodeA polygonal mesh node
vertices vtxarray of floats [x y z, x y z, ...]list of vertices
normals nrmarray of floats [x y z, x y z, ...]list of normals
uvset uvsarray of floats [u v, u v, ...]list of UV texture coordinates
colors colarray of floats [r g b, r g b, ...]list of per-vertex colors
backfaceCullingboolset to 1 to use backface culling, 0 to show backfaces
maxTriStripLengthintmax 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 grpsarraylist of shading groups
ShadingGroup g nodeshading group node. connects a shader to a set of faces.
Shader shdrnodeShader node, contains material and texture
diffuse dif3 floats (r g b)diffuse color
ambient amb3 floats (r g b)ambient color
emissive emi3 floats (r g b)emissive (incandescent) color
specular spc3 floats (r g b)specular color
transparency trnfloattransparency
reflectivity reffloatreflectivity (shininess)
texture texstringtexture filename
faces fcsarraylist of faces for the shading group
Facefnodepolygon face node
vertexIndex vint array [i1 i2 i3 ...]list of vertex indices (from the vertices list)
normalIndex nint array [i1 i2 i3 ...]list of normal indices
colorIndex cint array [i1 i2 i3 ...]list of color indices
uvIndex tint array [i1 i2 i3 ...]list of UV indices