Convert obj from 3dMax to glTF

Hi, I’m Fan. I have converted obj models exported from 3DMax to glTF by obj2gltf(https://github.com/AnalyticalGraphicsInc/obj2gltf).

But when display the glTF model in Cesium, it shows nothing, can you help me with this problem.

I upload the original obj model and the generated glTF model, mabe you can help me check if there are some format problems on the generated glTF model.

obj.zip (2.09 MB)

glTF.zip (1.77 MB)

The glTF looks fine when I view it standalone (screenshot attached). I had to turn the globe off though because otherwise it isn’t visible. Do you know what coordinate system the file is in?

var viewer = new Cesium.Viewer(‘cesiumContainer’, {

globe : false

});

function createModel(url) {

var entity = viewer.entities.add({

    name : url,

    position : Cesium.Cartesian3.ZERO,

    orientation : Cesium.Quaternion.IDENTITY,

    model : {

        uri : url

    }

});

viewer.trackedEntity = entity;

}

createModel(’…/…/SampleData/test/test.gltf’);

``

It is in WGS84 coordinate system , I know Cesium is in WGS84 the same, so what’s the problem.

I tried bypassing the entity API and constructing a model directly but it still looks like the model is under the surface. To test this I drew a sphere using the max coordinate in the glTF file (661590.1875, 244.36329650878906, -5450425.5), but the center of the sphere is clearly underground. I think this is potentially a problem with the data.

var viewer = new Cesium.Viewer(‘cesiumContainer’, {

//globe : false

});

var scene = viewer.scene;

var camera = viewer.camera;

var model = scene.primitives.add(Cesium.Model.fromGltf({

url : '../../SampleData/test/test.gltf',

modelMatrix : Cesium.Matrix4.IDENTITY,

upAxis : Cesium.Axis.Z

}));

model.readyPromise.then(function(model) {

// Zoom to model

var controller = scene.screenSpaceCameraController;

var r = 2.0 * Math.max(model.boundingSphere.radius, camera.frustum.near);

controller.minimumZoomDistance = r * 0.5;

var center = Cesium.Matrix4.multiplyByPoint(model.modelMatrix, model.boundingSphere.center, new Cesium.Cartesian3());

var heading = Cesium.Math.toRadians(230.0);

var pitch = Cesium.Math.toRadians(-20.0);

camera.lookAt(center, new Cesium.HeadingPitchRange(heading, pitch, r * 2.0));

}).otherwise(function(error){

window.alert(error);

});

var position = new Cesium.Cartesian3(661590.1875, 244.36329650878906, -5450425.5);

var blueEllipsoid = viewer.entities.add({

name : 'Blue ellipsoid',

position: position,

ellipsoid : {

    radii : new Cesium.Cartesian3(2000000.0, 2000000.0, 2000000.0),

    material : Cesium.Color.BLUE

}

});

``

underneath.PNG