Problem with loading a 3D module

When I loaded my 3D module,I have the same problem as the picture(pic1) shows.

As you answer the problem is the model url is a relative path to a local file and most browsers won’t let me load it unless everything is running in a local server.

I have put Taipei 101 model in the same path as other sample models(pic2,pic3), but it still hav
e RuntimeError: Failed to load model: [object Object] problem (pic4)

How do I put everything in a local server? Could you give me more detailed explanation?

Please help me solve the problem, thank you so much.

It looks like the path to your models is not correct (too many …/). Should be ‘…/…/SampleData/models/CesiumAir/Cesium_Air.glb’.

Scott

Hi, did you find the solution?

I dealing with the same thing, here is my code.

this.loadModel(marker.nombre,‘http://192.168.1.7:8887/models/Bienestar/blender.glb’, marker.geometry.coordinates[0],marker.geometry.coordinates[1],0); ** (don’t work)**

//this.loadModel(marker.nombre,’…/…/SampleData/models/Bienestar/blender.glb’,marker.geometry.coordinates[0],marker.geometry.coordinates[1],0); ** (don’t work) **

//this.loadModel(marker.nombre,’…/…/SampleData/models/CesiumBalloon/CesiumBalloon.glb’,marker.geometry.coordinates[0],marker.geometry.coordinates[1],0); (this works)

I made a function to load a local 3D model, the blender.glb is a simple cube por the instance but it triggers this error.

Cesium.js?367c:119152 RuntimeError {name: “RuntimeError”, message: “Failed to load model: http://192.168.1.7:8887/models/Bienestar/blender.glb”, stack: “Error↵ at new RuntimeError (webpack-internal://… at processQueue (webpack-internal:///238:1122:4)”}

Could you help me?, I have create a server for the model as long as I saw something about the local paths.

hello ,
can you able to tell how to create a json from from a given b3dm file …

You must provide a valid URL for the model. Are you serving the model at a url that is accessible to the Cesium server?

I see you’re using webpack, make sure you are using the right configuration, including using binary loaders if needed, see cesium-webpack-example issue #10.

Thanks Gaby for paying attention to this.

I’ve trying with models on a server like this

This is what i did

var modelMatrix = Cesium.Transforms.eastNorthUpToFixedFrame(Cesium.Cartesian3.fromDegrees(-78.669713,-1.663594, 0.0));

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

url : ‘http://192.168.1.7:8887/models/Wood_Tower.gltf’,

modelMatrix : modelMatrix,

scale :5.0

}));

var entity = viewer.entities.add({

name : nombre,

position : position,

orientation : orientation,

model : {

//uri : direccion,

uri : ‘http://192.168.1.7:8887/models/CesiumMilkTruck.glb’,

minimumPixelSize : 64,

//maximumScale : 10

},…

And it renders properly as the capture shows…

Indeed, I’m using webpack, I will attached my webpack configuration…

You said that I need to add the proper loaders, I tried to add a gltf and a bin loader but webpack-dev-server brokes fatally… but I think that if the samples models load, the loaders should be properly added, is it?

I added the capture2 with the folders of the library added because I’m using the pre-built option (It was a configuration I found for vue-webpack and cesium wich works)

I thought it was an error on the model but I tried loading it on the autodesk viewer and it look correct

I think that the sample models have some code to allow cesium load them or to recognize them by default , idk.

Any hint to help me with this I will be glad because I have been long time stuck

webpack config.txt (1.89 KB)

scene.glb (73.1 KB)

Capture2.PNG

Hi Mayra,

If you don’t use the loaders, and the webpack build does not error, you are still getting an error in the console correct? Can you check the Network tab of the developer tools and check if the model is being successfully requested?

This is definitely a server configuration issue, so you will probably have more luck on a webpack forum or something similar. There’s nothing wrong with the .glb file itself, I was able to serve it locally and load it in Sandcastle:

Thanks,

Gabby

After I change the path, it still has error as below:

RuntimeError: Failed to load model: [object Object]
undefined
Error
    at new RuntimeError (https://cesiumjs.org/Cesium/Build/CesiumUnminified/Cesium.js:4363:19)
    at https://cesiumjs.org/Cesium/Build/CesiumUnminified/Cesium.js:154243:40
    at Promise.then (https://cesiumjs.org/Cesium/Build/CesiumUnminified/Cesium.js:1184:33)
    at https://cesiumjs.org/Cesium/Build/CesiumUnminified/Cesium.js:1264:13
    at processQueue (https://cesiumjs.org/Cesium/Build/CesiumUnminified/Cesium.js:1614:4)
    at _resolve (https://cesiumjs.org/Cesium/Build/CesiumUnminified/Cesium.js:1300:4)
    at promiseReject (https://cesiumjs.org/Cesium/Build/CesiumUnminified/Cesium.js:1333:11)
    at Promise.then (https://cesiumjs.org/Cesium/Build/CesiumUnminified/Cesium.js:1184:33)
    at https://cesiumjs.org/Cesium/Build/CesiumUnminified/Cesium.js:1265:7
    at processQueue (https://cesiumjs.org/Cesium/Build/CesiumUnminified/Cesium.js:1614:4)
RuntimeError: Failed to load model: [object Object]
undefined
Error
    at new RuntimeError (https://cesiumjs.org/Cesium/Build/CesiumUnminified/Cesium.js:4363:19)
    at https://cesiumjs.org/Cesium/Build/CesiumUnminified/Cesium.js:154243:40
    at Promise.then (https://cesiumjs.org/Cesium/Build/CesiumUnminified/Cesium.js:1184:33)
    at https://cesiumjs.org/Cesium/Build/CesiumUnminified/Cesium.js:1264:13
    at processQueue (https://cesiumjs.org/Cesium/Build/CesiumUnminified/Cesium.js:1614:4)
    at _resolve (https://cesiumjs.org/Cesium/Build/CesiumUnminified/Cesium.js:1300:4)
    at promiseReject (https://cesiumjs.org/Cesium/Build/CesiumUnminified/Cesium.js:1333:11)
    at Promise.then (https://cesiumjs.org/Cesium/Build/CesiumUnminified/Cesium.js:1184:33)
    at https://cesiumjs.org/Cesium/Build/CesiumUnminified/Cesium.js:1265:7
    at processQueue (https://cesiumjs.org/Cesium/Build/CesiumUnminified/Cesium.js:1614:4)

Please help me solve the problem, thank you so much!
Besides,I still have no idea how to put everything in a local server?
Could you give me more detailed explanation?

You should be able to use any static web server, there are lots if you google web development resources. Cesium also includes a sample development one, server.js.