RenolY2 / SuperBMD

A library to import and export various 3D model formats into the Binary Model (BMD) format. (Nintendo GC/Wii)
37 stars 10 forks source link

SuperBMD

A tool for converting various formats into BMD/BDL (Model format of some of Nintendo's GameCube and Wii games).

This API uses the Open Asset Import Library (AssImp). A list of supported model formats can be found here. Recommended: .dae/.fbx.

This is a fork of SuperBMD that supports generating triangle strips (a more space-efficient way to represent faces in a model) and extracting and applying BMD material data as JSON, maintained by Yoshi2 (RenolY2 on github).
Please report any issues you find here: https://github.com/RenolY2/SuperBMD/issues Please add any source files that are useful to recreating the issue.
New compiled releases (and their source code) are found here: https://github.com/RenolY2/SuperBMD/releases

Usage

SuperBMD.exe can be used to convert models to the BMD format and BMD models to the DAE format.

To convert a model, drag it onto the executable or run the program via command line:

SuperBMD.exe <model path>

If model path is a BMD, it will be converted to DAE, its textures will be dumped as .PNG and its material data will be dumped as JSON in the same folder as the DAE and the textures.

If model path is a model but not BMD, it will be converted to BMD. By default triangle strips are generated for static meshes but not rigged meshes. See below for more options on this.

Full usage

SuperBMD.exe <input path> [output path] [--mat <material path>] [--outmat <material path>] [--texheader <texheader path>] [--tristrip (all/static/none)] [--rotate] [--bdl] [--profile] [--nosort] [--onematpermesh]
Arguments in square brackets are optional. If output path is left out it is created from the input path by replacing the extension either with .bmd, .bdl or .dae, depending on input.

Any model -> BMD/BDL:

BMD/BDL -> DAE:

Notes

Modeling

Skinning

Vertex Colors

Textures

Mipmaps

Converting BMD to DAE

When you drop a BMD on SuperBMD.exe, it will be converted into DAE. When you import the DAE into 3DS Max, in the Import options that appear you need to go into Advanced Options->Units, uncheck "Automatic" and set File units converted to Meters. Otherwise the imported dae will be very big.

Materials

Material presets

This release has some bat scripts that apply some included materials.

These material presets are not always the best and you are encouraged to find other presets by experimenting with material data from models and making new scripts. You can combine options if wanted. For example, you can add the --rotate option from superbmd_rotatemodel.bat to the other bat scripts if you want shaded and rotated models, or you can add the --bdl option from superbmd_createbdl.bat to the other scripts for shaded BDL models.

Billboarding

You can billboard an entire mesh by adding BillXY (billboard on both axes) or BillX (billboard only on X axe) to a mesh name. If your mesh is part of a skinned mesh, it is recommended for the billboarded mesh to be weighted entirely towards one bone.

Texture header info

When dumping BMDs to DAE you will find a texheader json file. It contains some data from the BTI headers of the textures stored in the BMD. Of note are the Format (sets the texture format) and the WrapS/WrapT (affects the way UV maps will wrap when going beyond the edges) attributes. They are applied in a similar way to materials, using --texheader to specify the path to such a file. Header data is applied to textures with a matching name. Please note: If you use a texture header file then the file needs to contain the headers for all the textures you are using in the model.

Supported texture formats: I4, I8, IA4, IA8, RGB565, RGB5A3, RGBA32, and CMPR. Supported wrap modes: ClampToEdge, Repeat and MirroredRepeat When using I4 or I8, note that intensity equals alpha.

Textures can be specified in the texture header file multiple times. In that case the texture data is stored only once but multiple headers are written. Different instances of the texture are referenced by the material in the material json file. Example: texture:1 means that the material references the second instance of a texture named texture inside the texture header file.

Attribution

Special thanks to Gamma (Sage-of-Mirrors) for creating SuperBMD, to LagoLunatic for the work on their fork that this fork is now based on (based on LagoLunatic's fork from December 2018), and to Hackio for their contributions to this fork. And special thanks goes out to everybody who uses this fork, reports issues and helps makes it a better tool.

This project uses a number of external libraries or parts of them in the code which will be listed here together with their license if necessary:

If you acquired a compiled release of SuperBMD, the following licenses also apply:

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
Neither the name of the assimp team nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

<br>

* Json.NET: (Newtonsoft.Json.dll)

The MIT License (MIT)

Copyright (c) 2007 James Newton-King

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

<br>

* OpenTK (OpenTK.dll)

Further details about the license of OpenTK: https://github.com/andykorth/opentk/blob/master/Documentation/License.txt

The Open Toolkit library license

Copyright (c) 2006 - 2013 Stefanos Apostolopoulos stapostol@gmail.com for the Open Toolkit library.

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.