Hi,
I’m experiencing some inaccuracies when using the pickFromRay function.
From UAV images I create photogrammetry meshes, export them to 3d tiles and then load those tiles. I also load the aerotriangulated source UAV images in the viewer. Some images have an annotation, that I want to project on the 3d tiled model. In order to do that I use pickFromRay:
function pickFromRay(startPoint, endPoint) {
var direction = Cesium.Cartesian3.normalize(Cesium.Cartesian3.subtract(endPoint, startPoint, new Cesium.Cartesian3()), new Cesium.Cartesian3());
var ray = new Cesium.Ray(startPoint, direction);
var result = viewer.scene.pickFromRay(ray, []);
return result.position
}
var intersection = pickFromRay(cameraOrigin, pointOnImage);
issues.add({
position: intersection,
image: "data:image////",
alignedAxis: Cesium.Cartesian3.UNIT_Z,
scale: 1.0,
color: new Cesium.Color(1, 1, 1, 0.5)
});
I have about 10k of these annotation that I want to project, so when executed, all 10k are processed and projected (through a point/billboard). The precision of the projections/positions vary greatly. Sometimes when I execute the function they are exactly as they are supposed to be (matching the point on the image to the point on the model). Other times they are just off, by a meter or even more. The results vary even when everything else is the same and I just perform a refresh.
I suspect it has something to do with how granular the outline/shapes of the 3d tileset is loaded. If it isn’t loaded all the way perhaps just the general coarse outline is used to perform an intersection test. And perhaps when the tileset is properly loaded all the fine lines are there in order to be able to precisely calculate the intersection.
I can’t seem to replicate when it is precise and when it is not. Sometimes even just running it without zooming in/changing resolution yields perfect results and other times it doesn’t anymore. I have this problem with multiple different tilesets/datasets.
Anyone has an idea?