Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

添加人物模型有问题 #471

Open
AndyCheung-Hub opened this issue Jul 8, 2022 · 6 comments
Open

添加人物模型有问题 #471

AndyCheung-Hub opened this issue Jul 8, 2022 · 6 comments
Labels

Comments

@AndyCheung-Hub
Copy link

AndyCheung-Hub commented Jul 8, 2022

S%WDDK3KZO`U(CMX5(X)TKU
触发方式:添加绑定了骨骼、带动画的模型,并缩小到人在地图上的实际大小,会触发,模型变成像素
但是同样绑骨、有动画的挖掘机模型是正常的,我猜想是因为人的动画会形变,挖掘机是固定的转动,那么带形变动画的就会触发。
我用Sketchfab上的模型https://sketchfab.com/3d-models/man-woman-walk-bbaa566445074509a32ef5059a9d0bc2
测试了各版本的threejs,排除了three版本和模型的问题,我想问题应该是在mtk.three里。

@AndyCheung-Hub
Copy link
Author

8{V ~2} E2637L0NM`L4 DA
左边是绑定骨骼、动画的,右边没有

@deyihu deyihu added the bug label Jul 11, 2022
@deyihu
Copy link
Collaborator

deyihu commented Jul 11, 2022

已经复现了这个bug,但是我还么有找到问题出在哪里

@AndyCheung-Hub 你可以用纯three测试看看,注意,要把three相机拉的很近,即模型缩放的很小很小很小的那种,否则测不出问题,因为我测试发现当mtk.three地图放的很大的情况下才出现这个问题

@AndyCheung-Hub
Copy link
Author

AndyCheung-Hub commented Jul 11, 2022

@deyihu 是的,已经测试过几个版本的纯three没有这个问题。我想mtk.three出现这个问题应该和地图放大应该无关。我认为相机拉得很近和模型缩小是不一样的。本质上拉远拉近,模型的大小都是scale控制。问题可能是出在gltf导进去之��的Object3D上,模型出现这个问题,像是精度被降低了,看起来跟像素一样

@deyihu
Copy link
Collaborator

deyihu commented Aug 13, 2022

@AndyCheung-Hub 问题已经定位到

  • 当设置模型的位置后(gl位置有经纬度转的gl坐标),
 model.position.copy(threeLayer.coordinateToVector3(map.getCenter()));

如果得到的gl坐标值很大,就会出现这种抖动问题,比如gl坐标值:

x: 27762.879813320105
y: 67849.86624477465
z: 0

你可以用three测试看看,把模型的位置设为上面我给的这个值

本质是一个webgl丢失精度问题 https://zhuanlan.zhihu.com/p/141970923

你可以不设置模型的位置(模型默认会被加到地图的0,0位置),直接加到地图上试试(这时需要把地图的中心点设为[0,0])

20220813_101804.mp4

我来看看这个问题怎么解决

@deyihu
Copy link
Collaborator

deyihu commented Aug 16, 2022

@AndyCheung-Hub 这个问题还不好解决,我仔细的研究下,要想解决这个问题,估计还得从模型入手

  • 不是所有的模型都存在这个问题
  • 存在问题的模型都是其attribute positon值的精度太高导致的比如其值 0.002380284这种,当模型设置了position后,最后传入到webgl就是 179898.002380284 这样,导致模型精度丢失
  • 你先可以试试看是不是所有模型都有同样的问题,我测试发现存在问题的模型都是 模型attribute positon 值太小导致的(类似:0.00323323233这样的值)
@xieyl2021
Copy link

@deyihu 这个问题有解决方案吗?使用@maptalks/gl-layers方式,gltfCoordinateSystem设为"gltf",可以在相同坐标位置正常加载模型

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3 participants