In var options I would like to add a glb file in the createMoldel funcion in line 43 where is the link “…/SampleData/models/CesiumAir/Cesium_Air.glb?raw=true”,
1 - How can I make my github works with this example?
2 - How can I make this work with a external link (not the cesium git hub repository) and/or indicating a file in my computer?
The easiest way to do this is to upload your model to Cesium ion (https://cesium.com/ion/) and that’ll essentially give you a link you can use to load your models into CesiumJS, or any other client.
If you haven’t already seen it, I’d check it out the getting started guide which explains how to set up CesiumJS in an HTML page from scratch (so you could run it locally with files from your computer if you run a local web server): https://cesium.com/docs/tutorials/getting-started/
With the approach you suggested, would it be possible to run this SandCastle example with our model uploaded to Cesium ion, just changing the link to our glb file, in the example itself?
Yup! Inside of Cesium ion you’ll see a “Open complete code example” link that’ll give you a template for loading your model and catching any errors etc.
However, I am afraid I’ll need more guidance if that’s possible, please.
Me and @Rafael_Luan generated a glb file with a 3D model in external software (python), and now we are trying to visualize it in Cesium (this file)
The first approach we tried was to replace the link for the Aircraft (Cesium_Air.glb) in this example with our link. It didn’t work, so @Rafael_Luan started this topic here.
@omar suggested he create a Cesium ion account and upload his model there. Done! And, after several tries, it worked! However:
It worked as a 3DTileset, not a 3DModel. The Aircraft example, the Cesium_air.glb is a 3DModel (I believe, but may be wrong)
it seems possible to change the heading/pitch/roll parameters (and we don’t want that)
So, in the end, what we need is:
Visualize this model with the correct orientation (it usually shows up in the upward position, when we want it in horizontal position)
That it appears over the Globe in the right location, and the user should not be able to rotate in any way (only change transparency)
Questions:
The fact that our model appears in the upward position is related to Cesium or the way we generated the model in Python?
Should it be a 3DModel (I think so) or a 3DTileset?
Is it possible to imbue in the model its coordinates and orientation, to be inside the glb file? Or we can set that only in Cesium?
We may be missing some important tutorial, so feel free to point us toward the right documents to read!
Thanks in advance!!
EDIT 1 - it seems possible for the user to change the:
latitude
longitude
height
heading
pitch
roll
of the 3D model. However, we need that static, maybe with freedom in the model height, only.
I state this because of this image, but I believe there’s probably a way to lock those.
If it’s a glTF model, the Y axis should be the “up” axis. For OBJ, since there isn’t a standard, Cesium ion will do the most commonly used choice (Z as the up axis for 3D Capture, and Y as up axis for “3D Model”).
Generally, if the size of your model is not that big (10 mb or less) then uploading as a glTF model is fine. Otherwise, you should tile it into 3D Tiles. See this thread on when you should choose 3D Model vs 3D Capture: 3D Model or 3D Capture?.
Cesium ion doesn’t currently support georeferenced glTF models (mainly because there isn’t a standard way to georefernece glTF models). What you could do is use the Cesium ion REST API to upload the model, that’ll allow you to pass in a lon/lat/height for the origin of the model so it’s automatically placed in the right location.
For your question about “locking” the orientation/position of the model - do you mean it should not be possible for you to change the model’s position/orientation inside of Cesium ion? Or that your users shouldn’t be able to change the position of the model?
Are your users accessing the model through a custom CesiumJS app, or through Cesium Stories, or something else?
Hi @omar, thanks for the help! Answering your questions:
For your question about “locking” the orientation/position of the model - do you mean it should not be possible for you to change the model’s position/orientation inside of Cesium ion? Or that your users shouldn’t be able to change the position of the model?
users shouldn’t be able to change the position of the model when looking at it on the Globe.
Are your users accessing the model through a custom CesiumJS app, or through Cesium Stories, or something else?
This is currently how it works. You can only change your model’s position inside of your Cesium ion account as the owner of the asset, which your users won’t have access to.
However, due to some project constraints, it is almost a must-have that we load our 3D models (glb) into Cesium/Resium straight from our servers, bypassing Cesium Ion Assets.
It seems to me that the 3D Models examples in SandCastle does it. Am I right?
But generally speaking, what do I need to make it possible? We could make it with Cesium_air.glb, but not with our model, and their size is very similar.
Hi @omar, having second thoughts we decided to try both ways: Cesium Ion Assets vs Local Storage.
We first thought that having our models generated in our servers, then uploaded to Cesium Ion to be delivered to our client cloud be a longer way than delivering straightly.
However, we don’t know how Cesium Ion suits our needs, and may be a better solution. So we are assessing both ways to see which one best fits our needs. However, as a currently non-funded startup, we may face some problems with budget, as we are not going to the market yet but testing our product with clients for free probably.