Cesium开发:调整3dtile高度

在3dtile的制作过程中,如果原始的数据中,模型数据存在高程,在生成的3dtile中也会存在高程的信息,这时就需要在系统中,底图数据的高程也要存在,这样才能和3dtile进行匹配,不过,Cesium的开发文档中,也提供一个在数据加载完成后,动态调整3dtile高度的方式,有一定限制是整体调整3dtile的高度,即改变3dtile的整体高程差。

API文档参照:https://cesiumjs.org/Cesium/Build/Documentation/Cesium3DTileset.html

具体实现的代码如下:

//定义viewer

var viewer = new Cesium.Viewer('cesiumContainer');

var tileset = new Cesium.Cesium3DTileset({

url: '3dtile在线地址',

show: true

});

   //加载3dtile

viewer.scene.primitives.add(tileset);

 //3dtile加载完成后执行

tileset.readyPromise.then(function(tileset) {

// 定位到3dtiles的位置

viewer.camera.viewBoundingSphere(tileset.boundingSphere, new Cesium.HeadingPitchRange(0, -20, 0));

   //高度偏差,向上是正数,向下是负数

var heightOffset = -1063.0;

 //计算tileset的绑定范围

var boundingSphere = tileset.boundingSphere;

 //计算中心点位置

var cartographic = Cesium.Cartographic.fromCartesian(boundingSphere.center);

//计算中心点位置的地表坐标

var surface = Cesium.Cartesian3.fromRadians(cartographic.longitude, cartographic.latitude, 0.0);

  //偏移后的坐标

   var offset = Cesium.Cartesian3.fromRadians(cartographic.longitude, cartographic.latitude, heightOffset);

var translation = Cesium.Cartesian3.subtract(offset, surface, new Cesium.Cartesian3());

   //tileset.modelMatrix转换

tileset.modelMatrix = Cesium.Matrix4.fromTranslation(translation);

});

按照真实数据测试了一下效果,转换后高度是变化了,但是拉到太近,模型会显示不出来,可以根据实际测试一下效果,还是建议在3dtile生成的过程中,完成高度的调整,没有转换过程,也能提高系统的性能。

关注公众号,多多支持!
在这里插入图片描述

  • 1
    点赞
  • 9
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
### 回答1: To add Cesium 3D Tiles with highlighing functionality to an Unreal Engine project, you can follow these general steps: 1. Install the Cesium for Unreal Engine plugin: You can download the plugin from the Epic Games Marketplace or build it from the source code available on GitHub. Follow the instructions provided with the plugin to install it in your Unreal Engine project. 2. Load the Cesium 3D Tileset: You can load the tileset using the "CesiumTileset" actor provided by the plugin. Add the actor to your level and set its properties to specify the URL of the 3D Tileset you want to load. 3. Set up highlighting functionality: To add highlighting to your 3D Tileset, you can use the "CesiumHighlightActor" provided by the plugin. Add the actor to your level and set its properties to specify the materials to use for highlighting and the events that trigger highlighting. 4. Implement the highlighting events: You can use Unreal Engine's blueprint system to implement the events that trigger highlighting. For example, you could use a trigger volume or a line trace to detect when the player's cursor or object intersects with the 3D Tileset, and then use the "Highlight" function of the CesiumHighlightActor to highlight the corresponding tile. 5. Customize the highlighting appearance: You can customize the appearance of the highlighted tiles by modifying the materials assigned to the CesiumHighlightActor. For example, you could change the color, opacity, or texture of the highlighted tiles. These are the general steps to add Cesium 3D Tiles with highlighting functionality to an Unreal Engine project using the Cesium for Unreal Engine plugin. However, the specific implementation details may vary depending on your project requirements and the version of the plugin you are using. ### 回答2: Cesium for UE是一种将Cesium的高亮功能与虚幻引擎(UE)集成的工具。用于在虚幻引擎中高亮3Dtile3Dtile是一种用于存储和传输大规模3D实体数据的文件格式。Cesium for UE可以通过加载3Dtile数据并提供高亮功能,使得在虚幻引擎中展示和编辑大规模3D模型变得更加方便。 通过Cesium for UE,可以在虚幻引擎中使用多种高亮效果,比如边框高亮、颜色高亮等,来突出显示3Dtile中的特定模型或部分。这样可以方便用户对模型进行修改、编辑或者查看。同时,Cesium for UE还提供了实时的高亮更新,使得用户在编辑模型时能够即时看到高亮效果的变化。 使用Cesium for UE高亮3Dtile的过程很简单。首先,需要将3Dtile数据导入到虚幻引擎中,然后使用Cesium for UE提供的蓝图节点或者代码函数来设置高亮效果。用户可以自定义高亮颜色、透明度以及其他相关参数,以满足不同的需求。 总之,Cesium for UE高亮3Dtile是一种集成了Cesium高亮功能的工具,让虚幻引擎用户能够更方便地展示、编辑和查看大规模3D模型数据。通过使用Cesium for UE的高亮功能,用户可以更直观地了解和操作3Dtile中的模型,提高工作效率。 ### 回答3: Cesium for UE 是一种基于CesiumJS的虚幻引擎(Unreal Engine)插件,它可以实现对3D Tile数据进行高亮显示。 3D Tile是一种用于表示三维地理空间数据的开放式标准,它将地图数据分割成小的、可独立加载和渲染的块,使得对大规模地理数据的可视化处理变得更加高效和灵活。 Cesium for UE插件提供了高亮3D Tile的功能,使用户能够以可视化的方式突出显示感兴趣的地理要素。通过对特定3D Tile的修改,可以在场景中加入一些视觉效果,例如改变颜色、增加阴影、调整透明度等,突出显示这些地理要素。这种高亮显示有助于用户更加直观地了解数据的空间分布和特征。 使用Cesium for UE进行高亮3D Tile的操作相对简单。首先,用户需要加载3D Tile数据到虚幻引擎场景中,然后通过插件提供的接口找到要高亮显示的特定Tile。接下来,用户可以通过修改Tile的属性,例如改变材质、调整光照等,实现高亮效果。修改后的Tile会在场景中呈现出高亮的视觉效果,使用户能够快速准确地注意到这些特定地理要素。 Cesium for UE的高亮3D Tile功能可以用于许多应用场景,例如建筑设计中的场景演示、城市规划中的目标指示、地理信息系统中的数据展示等。通过将重要要素高亮显示,用户可以更好地理解和分析复杂的地理数据,提高工作效率和决策质量。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值