Hi,
I have a few newbie questions about loading GLB / GLTF files created in Blender…
Our Blender guy exported an object to GLB (a “room”), which I’m trying to load into BabylonJS:
SceneLoader.Append("/sites/docs/environment/", "foo.gltf", scene)
The geometry is loading and rendering fine, but there are no textures, just bare colors. I can see in the GLTF data that some materials are defined (such as “wood floor”).
Are texture images part of the GLB / BIN file, or do they need to be loaded separately? The GLB file is quite large (4.5MB), but the textures I’m using are actually quite a bit larger, so I suspect the GLB file doesn’t include textures images.
I tried creating a StandardMaterial
registered with the same name referenced in the GLTF file and using the JPEG texture for the floor, but that didn’t help. Chrome reports the JPEG is loaded successfully, so it’s not a 404 issue:
const woodFloorMat = new StandardMaterial("WoodFlooringWhiteOak003_3K", scene)
woodFloorMat.diffuseTexture = new Texture("/my-path/WoodFlooringWhiteOak003_COL_3K.jpg", scene)
I’m still just getting a gray floor.
There are some other issues with the GLB, including a few meshes that aren’t rendering at all (or are doing so transparently). I suspect they may just not have a base color defined.
I also installed Blender and tried using the Blender exporter, but it just hung up Blender (I’m using Blender 2.92 on Windows).
Would an exported BabylonJS file from Blender be significantly smaller than GLTF? I.e., might it just contain shape primitives rather than all of the pre-defined vertex information I assume is making up the majority of the BIN/GLB file?
I’ve read the various docs for the GLTF loader, but I’m not finding answers there to these (basic?) questions, so I hope some of you gurus and ninjas can help!