What are GLB Files?
GLB is a binary file format used for the representation of 3D models saved in the GL Transmission Format (glTF). The GLD file format contains the following three 4-byte entries.
- uint32 magic
- unit32 version
- unit32 length
This format is based on little-endian, and the structure of the same is as shown in the below screenshot.
- It has a 12-byte preamble that has the header entitled.
- One or more chunks that contain binary data and JSON content.
The chunks in the GLB file has the following structure:
- chunkLength - This unit represents the length of the chunkData in bytes.
- chunkType - This unit represents the type of the chunk.
- chunkData - This unit contains the binary payload of the chunk.
Create GLB Files Using Maya and Substance Painter
One can add the GLB file to the product in the Shopify admin page using the Maya and Substance Painter software. For the same, follow the below steps:
- Prepare the 3D model for export using Maya software
- Export the mesh from Maya
- Import and prepare the OBJ file using the Substance Painter software
- Export the GL Transmission Format (glTF) file from Substance Painter
- Create a GLB file
Prepare the 3D model for Export in Maya
Make sure that the model you are going to create and export is a single mesh and has a single material applied to it.
- Navigate to the ‘Import’ section under the ‘File’ menu.
- Choose the 3D file you want to export and click the ‘Import’ button.
- After that, navigate to ‘Mesh’ and click the ‘Combine’ option to combine the mesh into a single material or object.
- Make sure that the model has no UVs overlap after unwrapping it to the 0-1 UV space.
- Then, right-click on the model and select the ‘Assign New Material’ option to select the ‘Phong’ as the material type.
Export the Mesh from Maya
After changing the material type, follow the below steps to export the mesh from Maya.
- Select the entire mesh and then select the ‘Export Selection’ option under the ‘File’ menu.
- Fill the filename and the path in which you want to store the mesh.
- After that, select the ‘OBJexport’ as the type of the file from the drop-down menu.
- Finally, click the ‘Export Selection’ option.
Import and Prepare the OBJ File in Substance Painter
To import and prepare the OBJ file using the Substance Painter software, follow the below steps.
- Open the Substance Painter and create a new project by clicking the ‘New’ option under the ‘File’ menu.
- In the ‘New Project’ window, click the ‘Select’ option to choose the mesh.
- In the selection window, select the OBJ file that you exported from Maya. After that, click ‘Open’, and when prompted, click ‘Ok’.
- Go to the ‘Texture set list’ panel to verify that you have exported the correct mesh, and it has only one texture set.
- If you only have a single texture set, click the ‘+’ button as shown in the below screenshot to add channels from the ‘Texture set settings’ panel. After that, select the channel type from the drop-down list.
- The recommended channel is ‘Ambient Occlusion’.
- If the model has any components that emit light, then choose the ‘Emissive’ channel.
- If the model has transparent components in them, then choose the ‘Opacity’ channel.
6) After the selection of the channel, click the ‘Bake Mesh Maps’ option and then paint the textures on to the model.
After the import, you should see only one texture set, but if there is more than one texture set, then you had done one of the following wrongs when you exported the mesh from Maya.
- You have not combined the mesh into a single object.
- The mesh had multiple textures assigned to it.
If that is the case, export the mesh from Maya again and follow the above steps.
Export the glTF File from Substance Painter
- In Substance Painter, navigate to the ‘File’ menu and click the ‘Export Textures’ option.
- Select the ‘glTF PBR Metal Roughness’ option from the ‘config’ drop-down menu.
- Select the location/path where you want to save your textures.
- Select the document size of the texture file to determine its size. We recommend you choose 1024 x 1024 px as the size to reduce the total file size.
- After the selections, click the ‘Export’ option.
Compress Texture Files
After the export of the model, you should see the following files:
The selection of the ‘glTF PBR Metal Roughness’ configuration makes sure that the texture files get exported in PNG format. We recommend compressing the texture files and converting those texture files that do not need an alpha channel to JPG format to reduce the total file size. It is best to keep the total file size 4MB or less.
Create a GLB File
To create a GLB file that you can use in your Shopify admin page, follow the below process.
- Visit https://glb-packer.glitch.me/
- On the GLB Packer webpage, drag-and-drop the glTF file exported from Substance Painter.
- The above step downloads a file named ‘out.glb’ on to the system. After the download, rename the file and upload it to the Shopify admin page.