xeokit-sdk icon indicating copy to clipboard operation
xeokit-sdk copied to clipboard

GLTFLoader does not support Vertex Color

Open tgranie opened this issue 8 months ago • 0 comments

Describe the bug

  1. Use the following script with the glb attached : The glb is a Vertex Color Phong Material (Load it in https://3dviewer.net/)
  2. The glb is displayed without the colors
import {
  Viewer,
  GLTFLoaderPlugin,
  OBJLoaderPlugin,
} from "https://cdn.jsdelivr.net/npm/@xeokit/[email protected]/+esm";

const viewer = new Viewer({
  canvasId: "myCanvas",
  transparent: true,
  pbrEnabled: true,
  dtxEnabled: false
});

viewer.camera.eye = [-2.56, 8.38, 8.27];
viewer.camera.look = [13.44, 3.31, -14.83];
viewer.camera.up = [0.1, 0.98, -0.14];

viewer.scene.selectedMaterial.fillAlpha = 0.1;

const gltfLoader = new GLTFLoaderPlugin(viewer);

const sceneModel = gltfLoader.load({
  id: "myModel",
  src: "./Terrain_lv2.glb",
  pbrEnabled: true,
  colorTextureEnabled: true,
  dtxEnabled: false,
  edges: false,
});

sceneModel.on("loaded", () => {
  viewer.cameraFlight.flyTo(sceneModel);
});

viewer.cameraControl.on("picked", function (e) {
  console.log(e.entity.id);
});

window.viewer = viewer;

Expected behavior

Colors should be displayed.

Screenshots

image Terrain_lv2.zip

tgranie avatar May 26 '24 13:05 tgranie