Closed fzlavr closed 6 years ago
Hi @fzlavr - if the vertex data of the obj is in WGS84 coordinates then it should be preserved and drawn correctly in Cesium. Would you mind uploading the obj model and paste the Cesium code you used?
Hi @lilleyse thanks for your reply.. here is my obj model http://www.mediafire.com/file/xw978cg2y7c24ba/photoscan.zip and i use this cesium code
var viewer = new Cesium.Viewer('cesiumContainer', { infoBox : false, selectionIndicator : false, shadows : false, shouldAnimate : true });
function createModel(url, height) { viewer.entities.removeAll(); var position = Cesium.Cartesian3.fromDegrees(121.607209, 23.988376, height); var heading = Cesium.Math.toRadians(135); var pitch = 0; var roll = 0; var hpr = new Cesium.HeadingPitchRoll(heading, pitch, roll); var orientation = Cesium.Transforms.headingPitchRollQuaternion(position, hpr); var entity = viewer.entities.add({ name : url, position : position, orientation : orientation, model : { uri : url //minimumPixelSize : 128, //maximumScale : 20000 } }); viewer.trackedEntity = entity;
} createModel('../Apps/SampleData/wgs84.gltf', 10.0);
i have seen the sandcastle example model. it is very good that has planar position with the ground.. i wonder how it can be like that, because i always had a wrong result position after it convert into gltf/glb
Hi @lilleyse i have solved my problem with Meshlab. i dont know why but every obj that i created even it has georeferenced all of them are seem to be like my previous screenshot. So, i open it in Meshlab and it reveals all the orientation positions perfectly same as Cesium. then, i just set the X rotation to be planar with the ground and i save it. after that the position is perfectly great and just put it into Cesium without any manual set of heading, pitch, and roll.
Ok I'm glad you solved it. I didn't have any luck placing the model correctly myself so that additional X rotation must be the fix.
Hi @fzlavr ,
I'm facing similar issues and have a related question...
Issue Using your very obj file: on meshlab it looks fine, well aligned with xy plan. Yet when I load it on Cesium, it indeed looks in the wrong angle. How exactly did you tilt it back in meshlab? See screenshot below:
Related question About the georeferencing of the obj / glb file: do we have to set the position everytime we load a glb file? Can this information be stored in the glb file during the conversion? Or is there another pipeline that keeps exact georeferencing from photogrammetry software to Cesium rendering? Apologies if this is a beginner question, I'm a beginner with these file formats..
Hi.. i want to kindly ask this question.. i have a 3D model, it has obj file format generated by Photoscan. Then, i want to put it inside cesium. first i need to convert it into gltf/glb. i have successfully converted it. but when i put it inside Cesium the object (gltf/glb) position is not correct. it is tilt. before i genereate the obj file i have change the georeference into WGS84 which is same like Cesium. but why after the conversion into gltf/glb the position is not correct ? is the georeference information has lost after it converted ?
here is the image of tilted model https://imgur.com/6ox0pAP
it always like that after conversion..