three.js: THREE.ColladaLoader: Undefined sampler

Description of the problem

Hi, Sorry for ticketing so many issues lately 😅

Some meshes started showing this error after upgrading to the new Collada, e.g. this mesh.

So after some debugging, in the loader at this line it is trying to find texture0 in the samplers, while the correct sampler is texture0-sampler .

This workaround solves it for me.

var sampler = effect.profile.samplers[ textureObject.id ] || effect.profile.samplers[ textureObject.id + '-sampler' ];
Three.js version
  • Dev
  • r87
  • …
Browser
  • All of them
  • Chrome
  • Firefox
  • Internet Explorer
OS
  • All of them
  • Windows
  • macOS
  • Linux
  • Android
  • iOS
Hardware Requirements (graphics card, VR Device, …)

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Reactions: 1
  • Comments: 20 (5 by maintainers)

Commits related to this issue

Most upvoted comments

I figured out a clean way that should solve the issue.

In your files, it looks like the blender exporter is properly giving the sampler’s id to the channel’s texture, whereas meshlab’s present kind of the same problem as Maya 2017’s here, giving the image id instead of the sampler id to the channel’s texture. Feels like a collada exportation plugin problem…

@LuckXP Can you please share the model in this thread? I’ll have a look.

@russdanner your model is loading fine for me. @Mugen87 here’s the file heart-dae.zip

Is it possible to provide the entire model as a zip file again? 😊 Makes it easier to see if the texture is actually applied.

I’m confused why the usage of the sampler just fails in your case 🤔 . We tested with so many examples where this was no problem.

Your proposed fix might work in your case but it does not look like a generic solution to me. I need to debug this one…