Mapbox iOS:在3D建筑图层中加载3D模型问题咨询
Mapbox iOS SDK 3D模型与3D建筑共存问题
重新研究Mapbox原生SDK后发现,加载3D模型的难度远超Mapbox GL JS。我已经实现了3D建筑显示,也能借助SceneKit加载3D模型,但目标是让二者处于同一渲染层级,让3D模型能被建筑遮挡(不是简单把模型放在建筑图层的上方或下方)。
当前实现代码
添加3D模型自定义图层
try! mapView.mapboxMap.style.addCustomLayer( withId: "Custom", layerHost: SceneKitExampleCustomLayerHost( modelOrigin: modelOrigin, renderingWillEndHandler: { [weak self] in self?.finish() }), layerPosition: .default)
更新3D建筑图层
try mapView.mapboxMap.style.updateLayer(withId: layerID, type: FillExtrusionLayer.self) { layer in // Update layer properties layer.source = "composite" layer.minZoom = 15 layer.sourceLayer = "building" layer.fillExtrusionColor = .constant(StyleColor(.darkGray)) layer.fillExtrusionOpacity = .constant(0.8) ... }
遇到的问题
添加自定义3D模型图层后,3D建筑无法呈现挤出的3D效果。放大地图可以看到建筑的几何图形仅显示在地面上,说明数据存在但没有被正确渲染为3D形态:

需求
希望了解Mapbox原生SDK中,动态放置3D模型并与3D建筑共存、实现正确遮挡关系的可行方案与限制,欢迎相关建议与讨论。
内容的提问来源于stack exchange,提问作者Soheil
相关产品推荐
相关产品推荐

