GLTFExporter exporting model that show nothing at android Scene Viewer

Hi to all, some problem with exported model. Everything is ok, when i export models without boolean operations, but when model is result of subtraction (made with three-csg": “^1.0.6”), model isn’t displayed at android Scene Viewer (https://arvr.google.com/scene-viewer-preview), but still displayed fine at https://gltf-viewer.donmccurdy.com/

three js version - “0.115.0”, model in attachment merged.gltf (53.9 KB)

but with the latest version 0.116.1 same result.

I see something.


maybe the problem is the android scene viewer
1 Like

It looks like this is the case. The asset is also rendered fine using BabylonJS sandbox.

1 Like

@seanwasere, @Mugen87, thanks for the quick answers, i’ll try to ask somebody from ‘android scene viewer’ side. I will inform.

1 Like

boolean operation is nothing to do with it, simple cube created and exported with three js is not displayed too. pure cube.gltf (2.5 KB)

const meshA = new THREE.Mesh(new THREE.BoxGeometry(1,1,1));
meshA.geometry = new THREE.BufferGeometry().fromGeometry(<THREE.Geometry>meshA.geometry);
(<THREE.BufferGeometry>meshA.geometry).deleteAttribute(“color”);

attribute color is deleted cause: [Error]
The glTF contains a vertex color, which is not supported by the Scene Viewer specification.

but if use

const meshA = new THREE.Mesh(new THREE.BoxBufferGeometry(1,1,1));

cube is displayed
cube2.gltf (2.3 KB)

@Mugen87 , Hi again, could you tell me please about indexed and non-indexed geometry. Here https://stackoverflow.com/questions/59458494/how-do-i-export-a-gltf-that-works-with-andorid-scene-viewer ‘brianpeiris’ mentions ’ that Scene Viewer also doesn’t like that the geometry is non-indexed’.

And as i wrote above, BoxGeometry is not displayed BOX.gltf (4.9 KB) , but BoxBufferGeometry is displayed fine cube2.gltf (2.3 KB)

The differences not so big, but only GLTF from BoxBufferGeometry has ‘indices’ property image
is that sign of indexed geometry ?
and how i can make the BoxGeometry look like BoxBufferGeometry with indices property ?

BufferGeometryUtils.toTrianglesDrawMode(meshA.geometry, THREE.TriangleStripDrawMode);

does something similar on what i want, but simple subtract cube from cube looks no good:

image
Triangle.gltf (739.0 KB)

This function is unrelated to this issue. three.js can only export glTF assets with non-indexed geometry.

However, it was possible to do this in the past. The experimental option forceIndices was removed from GLTFExporter with r116 (see GLTFExporter: Remove forceIndices. by mrdoob · Pull Request #19113 · mrdoob/three.js · GitHub). You can try to use three.js and GLTFExporter from r115 and set forceIndices to true.

Nevertheless, this is a really an issue in the viewer and that was one reason why this option was removed from the exporter.

1 Like

thank you very much :star_struck:

https://github.com/google/model-viewer/issues/1224