Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update broke fbx loader, doesn't load textures #22285

Closed
Heaust-ops opened this issue Aug 6, 2021 · 9 comments · Fixed by #22289
Closed

Update broke fbx loader, doesn't load textures #22285

Heaust-ops opened this issue Aug 6, 2021 · 9 comments · Fixed by #22289
Labels

Comments

@Heaust-ops
Copy link
Contributor

FBXLoader doesn't load textures,
I tried swapping out the threejs lib in the node modules to an older one (a month old) and it works,
so some update happened which either broke it or changed the way it works?

Import:
import { FBXLoader } from "three/examples/jsm/loaders/FBXLoader";

Code:

  loadFBXModel(path, modelFile, pos = [0, 0, 0], size = 0.1) {
    const loader = new FBXLoader();
    loader.setPath(path);
    loader.load(modelFile, (fbx) => {
      fbx.scale.setScalar(size);
      fbx.traverse((c) => {
        c.castShadow = true;
      });
      fbx.position.copy(new THREE.Vector3(...pos));
      this._scene.add(fbx);
    });
  }

how it is with older version:
image

how it is in the current version:
image

@Mugen87 Mugen87 added the Loaders label Aug 6, 2021
@Mugen87
Copy link
Collaborator

Mugen87 commented Aug 6, 2021

Do you mind sharing the FBX asset with all textures in this thread?

@Heaust-ops
Copy link
Contributor Author

Heaust-ops commented Aug 6, 2021

Do you mind sharing the FBX asset with all textures in this thread?

Sure,
https://drive.google.com/drive/folders/1iGboxEd-4Z8xodyxjSqoU1qV_CRM6rfY?usp=sharing
(I don't have separate textures, I downloaded it from mixamo, also idk how to upload files on github comments so here's a drive link : ) )

@guerreroje
Copy link

I also have the same problem with some FBX models that in previous versions worked correctly for me. It throws me these warnings:
THREE.Material: 'map' parameter is undefined.
THREE.Material: 'normalMap' parameter is undefined.
THREE.Material: 'specularMap' parameter is undefined.
THREE.FBXLoader: Vertex has more than 4 skinning weights assigned to vertex. Deleting additional weights.

@Mugen87
Copy link
Collaborator

Mugen87 commented Aug 6, 2021

@camnewnham Do you mind having a look at this issue?

camnewnham added a commit to camnewnham/three.js that referenced this issue Aug 6, 2021
Resolves mrdoob#22285

`texture.image` will always be undefined here as the textures are asynchronously loaded.
@worstpractice
Copy link

worstpractice commented Aug 6, 2021

I can confirm this issue.

This repo should have everything you need, just make sure you have the pnpm package manager installed (npm i -g pnpm) and you should be good to go (pnpm i && pnpm start).

I primarily dev on Windows (10), so apologies if any platform-specific code snuck in. I always try to write portable code, even for personal toy projects like this one.

I recently bumped three-js, and now the sword guy looks just like on the "after" sceenshot posted by @Heaust-ops above.

@camnewnham
Copy link
Contributor

Thanks for the reports and providing the sample files.
This was caused by #22114 and is resolved by #22289

@worstpractice
Copy link

worstpractice commented Aug 6, 2021

@camnewnham I can further confirm that #22289 has indeed fixed the issue.

Thank you!

@Heaust-ops
Copy link
Contributor Author

That does solve the problem thank you so much!! :D
(not closing the issue rn cause it isn't merged yet)

Mugen87 pushed a commit that referenced this issue Aug 7, 2021
Resolves #22285

`texture.image` will always be undefined here as the textures are asynchronously loaded.
@Mugen87
Copy link
Collaborator

Mugen87 commented Aug 7, 2021

PR is now merged so the module version of FBXLoader is now fixed on dev 👍 .

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants