-
Notifications
You must be signed in to change notification settings - Fork 20
Usage
This addon will add two new submenus in Blender under File -> Export. The option LibGDX G3D text format will export files to LibGDX JSON format (*.g3dj) while the option LibGDX G3D binary format will export files to LibGDX binary format (*.g3db).
These are the current options you can use to configure the exporting process.
- Forward and Up - Bleder uses a Z-up coordinate system while LibGDX by default uses a Y-up coordinate system. Here you can configure what to use Blender "Y" (forward) coordinate for and what to use Blender "Z" (up) coordinate for. The default is use Blender "Y" as LibGDX "-Z" and Blender "Z" as LibGDX "Y". Both Blender and LibGDX uses a right-handed coordinate system so whatever axis left will always point right. Ex: if you select "Z" as forward and "Y" as up then the exporter will user "negative X" as right.
- Selection Only - Only export selected objects and armatures. The exporter is only able to export mesh objects and armatures; lights, cameras and other kind of objects are always ignored. Default is unchecked.
- Apply Modifiers - Apply modifiers to meshes before exporting. Any extra geometry generated by the modifier will reflect on the exported mesh and the original file won't be affected. Generated vertices will inherit bone weights from the original vertices except on the mirror modifier with Mirror Vertex Groups checked - in that case if you have mirrored vertex groups (ex: bone.L and bone.R) vertices generated from a vertex weighted to bone.L will be weighted to bone.R and vice versa. Default is checked.
- Export Armatures - Uncheck to ignore armatures even if Selection Only is unchecked. Default is checked.
- Bone Weights per Vertex - Defines the maximum number of bones a vertex can be weighted to, after which bones will be just ignored. The default for both the exporter and LibGDX basic shader is 4, since for a triangle (three vertices) it will make a maximum of 12 bones per face which is a safe number for most devices.
- Export Actions as Animations - Check to export actions as bone animations. Only used actions are exported, if you have several actions for a single armature use the FAKE USER option in Blender to make all actions used (have at least one user). Default is checked.
- Export Tangent and Binormal Vectors - Calculate tangent and binormal vectors for each vertex (used for Normal Mapping). You need to create an UV map for your model. The tangent and binormal will be exported as the TANGENT and BINORMAL vertex attributes. Default is unchecked.
-
Use Old UBJSON Datatypes - This is exclusive to the "LibGDX G3D binary format" option and defines if the exported file will use the old data type sizes or the newer sizes that are compatible with the current UBJSON specification. When loading G3DB models LibGDX UBJSON reader (class
com.badlogic.gdx.utils.UBJsonReader
) has a public undocumented boolean flag that defines if it will use the "old format" or not (UBJsonReader.oldFormat
, the default is true). What this does is change the size in bits for certain UBJSON types, for example the 'i' type (INT8 by UBJSON specification) is read as a short on the old format (16 bit signed integer) and as a byte if old format is false (8 bit). From what I can understand setting old format to false is more conformant to the current UBJSON specification but for some reason LibGDX default is true and this flag is undocumented, meaning 99.999% of the time people won't ever bother to touch this flag. For that reason the exporter's default is also checked but since setting this to unchecked usually produces slightly smaller file sizes this option exists for anyone who wants to use it. Notice that setting one format and loading another in your code will most likely result in LibGDX being unable to parse your file.
After choosing the desired options just press G3DJ/G3DB Exporter (depending on the exporter you chose). All meshes will be exported to the G3D format under the folder you chose (or only the selected meshes and armatures if you checked Selection Only). Lamps, cameras and all other Blender objects that are neither meshes nor armatures will be ignored, so you don't need to check Selection Only if you want all meshes exported but you have cameras and lamps on your scene.