question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

GLTFExporter: Add support for KHR_mesh_quantization.

See original GitHub issue

In the past, my model was compressed with draco, and it was displayed on the web page normally, and it was also normal to export the file with GLTFExporter. However, due to the draco compressed model, the decompression speed is relatively slow, and the display is no problem if it is changed to GLTFPACK compression. But when I want to export the page, I am prompted that the bufferAttribute component type is not supported.

var loader = new THREE.GLTFLoader();
loader.setMeshoptDecoder(MeshoptDecoder);
loader.load(model_path, function(gltf) {
theModel = gltf.scene;
theModel.position.y = -1.2;
modelg.add(theModel);
});
var urlsave = ‘http://192.168.101.113:8080/customProduct/saveCustomProduct’;
var qhxhr = new XMLHttpRequest();
qhxhr.open(‘POST’, urlsave, true);
var blobfile = null;
var fdata = new FormData();

var btnsave = document.getElementById(‘savejm’);
btnsave.addEventListener(‘click’, saves);
function saves() {
var exporter3D = new THREE.GLTFExporter();
exporter3D.parse(modelg, function(glbfile) {
if (glbfile instanceof ArrayBuffer) {
saveArrayBuffer(glbfile, ‘customize1.glb’);
} else {
var scenejson = JSON.stringify(glbfile, null, 2);
saveString(scenejson, ‘customize.glb’);
};
}, binary = true, onlyVisible = true );
};
function saveString(text, filename) {

  save(new Blob([text], {
  	type: 'text/plain'
  }), filename);
};
function saveArrayBuffer(buffer, filename) {
save(new Blob([buffer], {
type: ‘application/octet-stream’
}), filename);
};
function save(blob, filename) {
fdata.append(‘file’, blob, ‘customize.glb’);
qhxhr.upload.addEventListener(“progress”, function(result) {
if (result.lengthComputable) {
var percent = (result.loaded / result.total * 100).toFixed(2);
console.log(percent);
}
}, false);
qhxhr.send(fdata);
console.log(“ff”);
};

Hope to support bufferAttribute component type in GLTFExporter.

微信截图_20201008112427

Issue Analytics

  • State:open
  • Created 3 years ago
  • Comments:5

github_iconTop GitHub Comments

1reaction
Mugen87commented, Nov 24, 2020

Small update on this issue: When fixing a bug in context of interleaved data, I’ve also made a test with glTF-Quantized 2.zip since it contains interleaved data.

I’ve realized it will be a bit complicated to add support for KHR_mesh_quantization since the exporter actually uses buffer data at various places. At least when recomputing normals, data of typed arrays which are not Float32Array have to be decoded into floats and then encoded back after the computation.

Besides, it’s necessary to honor specific (byte) strides and padding values in order to write valid buffer data for quantized values.

1reaction
donmccurdycommented, Oct 11, 2020

I suspect it’s any model using KHR_mesh_quantization that will cause this error. If so, this file should reproduce the issue:

glTF-Quantized 2.zip

Read more comments on GitHub >

github_iconTop Results From Across the Web

GLTFExporter – three.js docs
GLTFExporter supports the following glTF 2.0 extensions: ... Instantiate a exporter const exporter = new GLTFExporter(); // Parse the input and generate the...
Read more >
glTF Exporter - Babylon.js Documentation
Export options. Excluding geometry. Supported features. Coming soon. The glTF Exporter allowsBabylon.js models to be exported to the glTF 2.0 format.
Read more >
glTF Exporter in three.js and A-Frame
After all the previous work described above it was trivial to add support to export to gltf in A-Painter. Include the aframe-gltf-exporter- ......
Read more >
glTF Exporter in Code Plugins - UE Marketplace - Unreal Engine
This plugin exports glTF version 2.0, either to '.gltf' (JSON) or '.glb' (binary) files. It supports export of. Material (including textures as ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found