3D object is moving in Cesium when generated by ContextCapture

425 views
Skip to first unread message

fzl...@gmail.com

unread,
Sep 7, 2017, 2:43:37 AM9/7/17
to cesium-dev
Hi.. i am new Cesium user..
i face a problem, after i generated the 3D object from ContextCapture i got a json file also with Cesium file, because i choose Cesium format options for the output. after that i open it in web browser and i see the object is moving, not stay still on the map when i zoom with mouse and change the angle. it seems like not generated by WGS84 and i found when it generated in Cesium Output the reference coordinate is "Earth Center Earth Fixed", its fix format i cannot change it to WGS84.
anyone know how can i deal with this problem ?

Sean Lilley

unread,
Sep 7, 2017, 7:37:52 PM9/7/17
to cesium-dev
It sounds like the tileset is below the surface. You can see whether that is the case by setting viewer.scene.globe.depthTestAgainstTerrain = true. Depending on how far below the surface it is you may be able to adjust the height of the tileset like this Sandcastle example: https://cesiumjs.org/Cesium/Apps/Sandcastle/?src=3D%20Tiles%20Adjust%20Height.html&label=3D%20Tiles.

Earth Center Earth Fixed and WGS84 (in Cartesian coordinates) are basically equivalent, so that shouldn't be the issue.

If setting the height doesn't work, feel free to send me the tileset and I can see what might be the problem.

Faizal Avr

unread,
Sep 11, 2017, 3:14:41 AM9/11/17
to cesiu...@googlegroups.com
Thank you so much for your kind response..
it seems you are right. it is because of the height of the tileset..
i already set the height but nothing changed. do you know why ? did i miss something ?
here is my tileset 


--
You received this message because you are subscribed to a topic in the Google Groups "cesium-dev" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/cesium-dev/Th7_UhVJAbE/unsubscribe.
To unsubscribe from this group and all its topics, send an email to cesium-dev+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Sean Lilley

unread,
Sep 11, 2017, 7:50:21 PM9/11/17
to cesium-dev
Thanks for sending over the tileset. I think the problem is the version of Cesium bundled in that Context Capture output doesn't support the modelMatrix property.

To fix that you'll need to copy a newer version of Cesium into your project. Download the latest Cesium release here: https://github.com/AnalyticalGraphicsInc/cesium/releases. Then get the Build/Cesium folder and replace the Cesium/App/Cesium folder in your project.

After that, use the following code in main.js:

tileset.readyPromise.then(function(tileset) {
    var height = 200.0; // Set this to anything
    var cartographic = Cesium.Cartographic.fromCartesian(tileset.boundingSphere.center);
    var surface = Cesium.Cartesian3.fromRadians(cartographic.longitude, cartographic.latitude, 0.0);
    var offset = Cesium.Cartesian3.fromRadians(cartographic.longitude, cartographic.latitude, height);
    var translation = Cesium.Cartesian3.subtract(offset, surface, new Cesium.Cartesian3());
    tileset.modelMatrix = Cesium.Matrix4.fromTranslation(translation);
});



To unsubscribe from this group and all its topics, send an email to cesium-dev+...@googlegroups.com.

Faizal Avr

unread,
Sep 14, 2017, 8:13:42 AM9/14/17
to cesiu...@googlegroups.com
perfectly great. That is solved my problem.
Thank you so much for your help. 

To unsubscribe from this group and all its topics, send an email to cesium-dev+unsubscribe@googlegroups.com.

Faizal Avr

unread,
Sep 23, 2017, 2:47:56 AM9/23/17
to cesiu...@googlegroups.com
Hi Sean,

i face another problem that is i want to load a large file (about 80MB) of geojson format in cesium.
i have loaded it and it made the web loading very very slow.

i need your suggestions to make the loading fast enough. do you have any ?

Thank You

Sean Lilley

unread,
Sep 25, 2017, 7:05:14 PM9/25/17
to cesium-dev
Is loading the main issue or is it also performance? You could try splitting the geojson into multiple geojsons and load them individually. One step further is to convert it to 3D Tiles. I'm not sure about the state of open source tools for that, but we are working on our own tilers. Check out https://groups.google.com/d/msg/cesium-dev/xLkYIuku9hA/t_AxUBepAgAJ if you want us to try converting it.

I'm not sure what to recommend for speeding up that process . An alternate solution is to convert geojson to 3D Tiles, if you send me that data I could try experimenting 

Faizal Avr

unread,
Sep 26, 2017, 7:02:41 AM9/26/17
to cesiu...@googlegroups.com
the performance is fine. just loading run very slow. its because loading geojson file that i attach on it. 
i have checked the link that you give me but i still cant get the way how to convert it into 3D tiles. 
here is my geojson file. i wonder how to convert it into 3D tiles. maybe you can share the step to do it..

Thanks in advance 

To unsubscribe from this group and all its topics, send an email to cesium-dev+unsubscribe@googlegroups.com.

Sean Lilley

unread,
Sep 26, 2017, 7:49:09 PM9/26/17
to cesium-dev
The idea behind that link is we are working on 3D Tiles conversion for data sources like GeoJSON and are asking to convert others' data to help improve our tools. All that code is closed-source so I can't recommend an exact procedure if you want to convert it yourself.

I will have a go at converting your GeoJSON file and send you the tileset it produces.

Sean Lilley

unread,
Sep 28, 2017, 9:53:36 AM9/28/17
to cesium-dev
Here is the tileset: https://drive.google.com/open?id=0BwZiE_1SDr-XbW12RXR3RlZ3NzQ

















It's not perfect - some buildings weren't able to process but I didn't look much into why. The buildings are also not aligned exactly with the imagery. But for a rough conversion it seems pretty good and loads fast.

Faizal Avr

unread,
Oct 3, 2017, 3:20:05 AM10/3/17
to cesiu...@googlegroups.com
Thank you so much Sean.. 
it loads faster than before..
i have put it in my localhost and it works and loads perfectly.
but, i have an issue. i add the tileset to my website and somehow it cant be loaded.. 
the tileset cant appear even i already put the script as same as i put it in my localhost...
i wonder why.. is there anything that i miss ?

To unsubscribe from this group and all its topics, send an email to cesium-dev+unsubscribe@googlegroups.com.

Sean Lilley

unread,
Oct 3, 2017, 6:56:30 PM10/3/17
to cesium-dev
I'm not sure... Do you see any errors in the browser's console?
Message has been deleted

Faizal Avr

unread,
Oct 3, 2017, 8:38:43 PM10/3/17
to cesiu...@googlegroups.com
there are 1 warning and 2 errors in console

2017-10-04 8:36 GMT+08:00 Faizal Avr <fzl...@gmail.com>:
Gambar sisip 1
there are some warnings in the console

To unsubscribe from this group and all its topics, send an email to cesium-dev+unsubscribe@googlegroups.com.
image_2017-10-03_17-38-37.png

Left Gully

unread,
Oct 3, 2017, 9:23:45 PM10/3/17
to cesium-dev
Try validating your newroads.json file with this site:
http://geojsonlint.com

pink...@gmail.com

unread,
Oct 4, 2017, 4:28:59 AM10/4/17
to cesium-dev
Hi

a quick question about 3D tiles.
Do they support surfaces identification? aka facades for the buildings?

I see they are of LOD2 (root types and details) but would it be possible to click on individual surfaces as well, similar to GeoJSON's?


Thanks

taki...@gmail.com

unread,
Oct 4, 2017, 5:28:08 AM10/4/17
to cesium-dev
Hello,
i have exactly the same problem. I replaced cesium with the new version but i can not understand where in the main.js file i should copy the code.

here is my main.js code

// Get your own Bing Maps API key at https://www.bingmapsportal.com, prior to publishing your Cesium application:
Cesium.BingMapsApi.defaultKey = 'Al2VHpX7Fw7ooj66DNPJ_8LJSYU20ZRNSGze3Ejf-6Dv6OfAhnjh6vuSSDsGvW1y';

// Construct the default list of terrain sources.
var terrainModels = Cesium.createDefaultTerrainProviderViewModels();

// Construct the viewer with just what we need for this base application
var viewer = new Cesium.Viewer('cesiumContainer', {
timeline:false,
animation:false,
vrButton:true,
sceneModePicker:false,
infoBox:true,
scene3DOnly:true,
terrainProviderViewModels: terrainModels,
selectedTerrainProviderViewModel: terrainModels[1] // Select STK high-res terrain
});

// No depth testing against the terrain to avoid z-fighting
viewer.scene.globe.depthTestAgainstTerrain = false;

// Add credit to Bentley
viewer.scene.frameState.creditDisplay.addDefaultCredit(new Cesium.Credit('Cesium 3D Tiles produced by Bentley ContextCapture', 'Resources/logoBentley.png', 'http://www.bentley.com/'));

// Bounding sphere
var boundingSphere = new Cesium.BoundingSphere(Cesium.Cartesian3.fromDegrees(22.73182731, 37.98228101, 94.3943674), 42.96957873);

// Override behavior of home button
viewer.homeButton.viewModel.command.beforeExecute.addEventListener(function(commandInfo) {
// Fly to custom position
viewer.camera.flyToBoundingSphere(boundingSphere);

// Tell the home button not to do anything
commandInfo.cancel = true;
});

// Set custom initial position
viewer.camera.flyToBoundingSphere(boundingSphere, {duration: 0});

/*---------------------------------------------------------------------------------**//**
* @bsimethod
+---------------+---------------+---------------+---------------+---------------+------*/
// Functions to adapt screen space error and memory use to the device
var isMobile = {
Android: function() {
return navigator.userAgent.match(/Android/i);
},
BlackBerry: function() {
return navigator.userAgent.match(/BlackBerry/i);
},
iOS: function() {
return navigator.userAgent.match(/iPhone|iPad|iPod/i);
},
Opera: function() {
return navigator.userAgent.match(/Opera Mini/i);
},
Windows: function() {
return navigator.userAgent.match(/IEMobile/i);
},
any: function() {
return (isMobile.Android() || isMobile.BlackBerry() || isMobile.iOS() || isMobile.Opera() || isMobile.Windows());
}
};

// Add tileset. Do not forget to reduce the default screen space error to 1
var tileset = viewer.scene.primitives.add(new Cesium.Cesium3DTileset({
url: '../Scene/Production_3.json',
maximumScreenSpaceError : isMobile.any() ? 8 : 1, // Temporary workaround for low memory mobile devices - Increase maximum error to 8.
maximumNumberOfLoadedTiles : isMobile.any() ? 10 : 1000 // Temporary workaround for low memory mobile devices - Decrease (disable) tile cache.
}));

Sean Lilley

unread,
Oct 4, 2017, 7:05:40 PM10/4/17
to cesium-dev
Yes 3D Tiles supports surface identification, though in a more generic way. Any triangle in the tile can be uniquely identified if that's desired. Our work-in-progress GeoJSON outputs 3D Tiles with surface identification of facades, etc.

Sean Lilley

unread,
Oct 4, 2017, 7:06:41 PM10/4/17
to cesium-dev
Place the code right at the end of the file, after the `var tileset` section.

fzl...@gmail.com

unread,
Oct 4, 2017, 10:45:53 PM10/4/17
to cesium-dev
On Wednesday, October 4, 2017 at 9:23:45 AM UTC+8, Left Gully wrote:
> Try validating your newroads.json file with this site:
> http://geojsonlint.com

i have checked in that website and it doesnt have any problem..
newroads.json still can be loaded..

but, i wonder why my tileset can not be loaded in website.

var model = viewer.scene.primitives.add(new Cesium.Cesium3DTileset({
url: '../App/Resources/model/tileset.json',

taki...@gmail.com

unread,
Oct 5, 2017, 4:01:08 AM10/5/17
to cesium-dev
My model stands on the air. If i reduce the value at 0.0 its still on the air.
var height = 200.0; // Set this to anything

i try to use negative values but things get worse.

Sean Lilley

unread,
Oct 5, 2017, 6:53:39 PM10/5/17
to cesium-dev
Sometimes just changing the height won't be enough for the tileset to line up perfectly. But a negative value should help a bit, I'm not sure why it makes it worse.
Reply all
Reply to author
Forward
0 new messages