When importing the FBX into Blender and exporting to glTF, I see this necklace in gltf-viewer.
The only problem is that Blender does not handle the displacement map when importing. However, displacement maps are not support by glTF yet so it’s not that bad^^.
Okay, I can reproduce a wrong behavior. When loading the FBX file with FBXLoader, rendering is fine (although the displacement map is ignored). But when exporting to glTF and validating the glb in a viewer, it looks like so:
As you can see, only parts of the pearls are rendered.
Thanks @looeee
We are using it on the server side but on some cases we need to export the scene directly from the browser.
@Mugen87 for me R101's GLTFExporter is throwing an exception about an unexciting image in line 710: canvas.width = image.width;
“Cannot read property ‘width’ of undefined”
How did you manage to export a valid GLB file?
BTW, would you consider the FBXLoader displacement map issue a bug?
I have exported the loaded FBX after it was fully loaded (with textures). Just created an instance of the GLTFExporter and called the respective parse() method similar to the official example.
Looking at the code of FBXLoader, it seems that it supports displacement maps.
So I guess it’s worth to investigate why the map is not respected.
It seems like I was indeed calling parse() too soon.
Is there a way to detect if all of the textures has been loaded? GLTFLoader for example does not execute the onload callback until all of scene dependencies has been loaded.
You can use THREE.LoadingManager for this. The corresponding onLoad() callback fires when all (internal) loaders have finished their work. Just pass in the manager to the loader like so:
const manager = new THREE.LoadingManager();
const loader = new THREE.FBXLoader( manager );