NASA-AMMOS / 3DTilesRendererJS

Renderer for 3D Tiles in Javascript using three.js
https://nasa-ammos.github.io/3DTilesRendererJS/example/bundle/mars.html
Apache License 2.0
1.59k stars 286 forks source link

KHR_materials_unlit #242

Closed dmercel3DUN closed 2 years ago

dmercel3DUN commented 2 years ago

Several programs that create 3DTiles are using Draco Compression and particular materials such as KHR_materials_unlit. Is there any plan to implement reading this material type or do you have any adivce for how to implement it? Thanks.

dbuck commented 2 years ago

See examples/gltf.js

You can create and use a GLTFLoader configured however you need it to be by setting it as the loader for specific filetypes in the loading manager, ex, to support draco + basis set it up like this:

  const threeRenderer = ... // THREE.WebGLRenderer
  const manager = tilesRenderer.manager;

  // support draco
  const dracoLoader = new DRACOLoader();
  dracoLoader.setDecoderPath(`......`);

  // and ktx2/basis
  const ktx2Loader = new KTX2Loader();
  ktx2Loader.setTranscoderPath(`......`);
  ktx2Loader.detectSupport(threeRenderer);
  ktx2Loader.manager = loadingManager;

  // set gltf loader to use same manager as the tiles renderer
  const gltfLoader = new GLTFLoader(loadingManager);

  // apply loaders
  loader.setDRACOLoader(dracoLoader);
  loader.setKTX2Loader(ktx2Loader);

  // use the custom gltf loader for the filetypes, rather than creating a new default gltfloader per call
  manager.addHandler(/\gltf$/, gltfLoader);
  manager.addHandler(/\glb$/, gltfLoader);

As far as I know, KHR_materials_unlit is supported by the GLTFLoader out of the box? Is that not what you're seeing?

dmercel3DUN commented 2 years ago

Thanks for this. I can see that KHR_Materials_Unlit is in the loader already but any objects with that material that I have tested do not appear. I am going to conduct some additional tests and see if the issue is maybe related to something else. If you have any working examples it would be interesting to know.

gkjohnson commented 2 years ago

I'll close the issue until it can be demonstrated that something needs to be fixed in this repo, then