----------My process workflow----------
1. Photogrammetry (Photoscan,GCP Proccessed)
2. Export obj (Photoscan,Local Coordinate)
3. Convert to b3dm (obj23dtiles command line tools, --tileset option)
4. move b3dm, tileset.json files to one directory(in my case 'http://localhost:8080/Apps/SampleData/models/test2/'
5. Test in Sandcastle, I could see my model, but location was wrong.
My model's right location is Korea, but it showing in USA.
I wanna move my model to right position(Korea)
2. A minimal code example. If you've found a bug, this helps us reproduce and repair it.
-------------javascript code------------
var viewer = new Cesium.Viewer('cesiumContainer');
var tileset = new Cesium.Cesium3DTileset({
url: 'http://localhost:8080/Apps/SampleData/models/test2/'
});
viewer.scene.primitives.add(tileset);
viewer.zoomTo(tileset);
---------------tileset.json-------------
{
"asset": {
"version": "0.0",
"tilesetVersion": "1.0.0-obj23dtiles",
"gltfUpAxis": "Z"
},
"geometricError": 200,
"root": {
"transform": [
0.9686356343768793,
0.24848542777253738,
0,
0,
-0.15986461316605738,
0.6231776341036305,
0.7655670720519978,
0,
0.1902322613874096,
-0.7415555464951368,
0.6433560897277117,
0,
1215022.9309072953,
-4736352.219974792,
4081639.203163236,
1
],
"boundingVolume": {
"region": [
-1.3197046886133135,
0.6988739942707489,
-1.3197020262666388,
0.6988744679437489,
0,
10.101737976074219
]
},
"geometricError": 0,
"refine": "ADD",
"content": {
"url": "objlocal.b3dm"
}
}
}
3. Context. Why do you need to do this? We might know a better way to accomplish your goal.
I wanna move my model to korea from wrong position.
Right position of My model is logitude, latitude (129.191971, 35.173105) by degree
logitude, latitude(2.254825261091031, 0.6138864903996801) by radian
How can i move my model to this coordinate ??
What i have to modify ??
4. The Cesium version you're using, your operating system and browser.
cesium version : Lastest Version(Maybe 1.43)
System : Win 10 64bit, 16gb ram, gtx970, i7-4790
Browser : Chrome, Firefox
var viewer = new Cesium.Viewer('cesiumContainer');
var tileset = new Cesium.Cesium3DTileset({
url: '../../SampleData/test/objlocal'});viewer.scene.primitives.add(tileset);
tileset.readyPromise.then(function(){ var longitude = 2.254825261091031; var latitude = 0.6138864903996801; var height = 0.0; var cartesian = Cesium.Cartesian3.fromDegrees(longitude, latitude, height); var transform = Cesium.Transforms.headingPitchRollToFixedFrame(cartesian, new Cesium.HeadingPitchRoll()); tileset._root.transform = Cesium.Matrix4.IDENTITY; tileset.modelMatrix = transform; viewer.zoomTo(tileset, new Cesium.HeadingPitchRange(0.0, -0.5, tileset.boundingSphere.radius / 4.0));});
The
customTilesetOptions.json
can have options bellow, and these are fake values, please only add properties you need, other value will be auto calculate through.obj
file.
It's work with custom longitude and latitude.
Now i can move my model to custom position.
My code is under here.
--------------------javascript code------------------
var viewer = new Cesium.Viewer('cesiumContainer');
var tileset = new Cesium.Cesium3DTileset({
url: 'http://localhost:8080/Apps/SampleData/models/test5/'
});
viewer.scene.primitives.add(tileset);
tileset.readyPromise.then(function(tileset) {
viewer.camera.viewBoundingSphere(tileset.boundingSphere, new Cesium.HeadingPitchRange(0, -0.5, 0));
viewer.camera.lookAtTransform(Cesium.Matrix4.IDENTITY);
});
---------------------tileset.json---------------
{
"asset": {
"version": "0.0",
"tilesetVersion": "1.0.0-obj23dtiles",
"gltfUpAxis": "Z"
},
"geometricError": 200,
"root": {
"transform": [
-0.7749404279524483,
-0.632034281605734,
0,
0,
0.3641343205358554,
-0.4464669313052492,
0.8173576180955096,
0,
-0.5165980349679692,
0.633403462357128,
0.5761306485001776,
0,
-3298600.4110291977,
4044430.6401747838,
3654103.3849516404,
1
],
"boundingVolume": {
"region": [
2.2547854736485844,
0.6138257242719676,
2.255169112331271,
0.6141415062719675,
0,
50
]
},
"geometricError": 0,
"refine": "ADD",
"content": {
"url": "objlocalbig.b3dm"
}
}
}
----------------------------------------------------------
Next step, How to locate b3dm model to model's original position(example, coordinate contains in obj file, not custom position)
I mean obj file has original coordinate. it's not custom longitude, latitude
i wanna locate my b3dm model to really right position
Sorry, my english is not good.
Maybe it's hard to understand my question
Ok. I share 3 obj files.
All file is same model but just coordinate system is different each other.
Check Please!!
And obj position have to ECEF coordinates ??
Unable other coordinate system?(like, WGS84(EPSG:4326), WGS84/UTM zone(EPSG:32652)
https://drive.google.com/file/d/1VET1-YoHo4B6Efe0S9-kB_RoseIiBD-g/view?usp=sharing
https://drive.google.com/file/d/1dvHjed_hEH-p9Jz2nrOru80xtcXj-2Ga/view?usp=sharing
https://drive.google.com/file/d/18-R93yqxWumwMrzt6GkSzAuwTsevB58F/view?usp=sharing