google / google/draco

Do we have any examples of rendering a .drc model with materials using THREE.js?

Open
#364 11 comments 0 reactions 0 assignees View on GitHub
documentation
Dominant language
C++
Stars
7.5k
Forks
1.1k
Avg merge
47m
Merged PRs (30d)
1

Description

I've looked and haven't found a working example of rendering a .drc model with materials with THREE.js. Ive used the the `mtl-loader` and `drc-loader` to load my model, however, associating the material with the model has been a challenge. For example:

```js
// Bluebird promise API
return new Promise.props({
material: new Promise((res) => {
_mtlLoader.setPath(path);
_mtlLoader.load(mtl, (material) => {
material.preload();
res(material)
});
}),
model: new Promise((res) => {
_drcLoader.load(`${path}${drc}`, (geometry) => {
res(geometry);
});
})
});
```

When I receive the `model` (i.e. `BufferGeometry`) and `material` (i.e. THREE.MTLLoader.MaterialCreator) which comprises `4` materials, I am not able to render the model with the following:

```js
const mesh = new THREE.Mesh(model, material);
this._scene.add(mesh);
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.