-
Notifications
You must be signed in to change notification settings - Fork 135
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
Three.js r102 起光線渲染好像不正常了 #30
Comments
r102起,不仅光线有问题,side也有问题,情况和文档里正好相反,需要 side:THREE.BackSide |
three.js 🦀 |
求大佬快解决,万分感谢哇 |
在 r105 中,Raycaster 工作也不正常了,r102 中工作正常,不知道是否有相关性 |
@deyihu 要解决这个问题,应该需要一些three的分版本处理逻辑 |
刚才我回退到0.5.0是正常的(three.js使用的103版本) https://codepen.io/deyihu/pen/qBWgpXq?editors=0010 问题应该是出在相机矩阵这里, _syncCamera() {
const map = this.getMap();
this.camera.matrix.elements = map.cameraWorldMatrix;
this.camera.projectionMatrix.elements = map.projMatrix;
} 好像102开始,three.js的相机逻辑有改变 |
谢谢@deyihu 看来是camera直接采用外部matrix时的逻辑有什么变化。 |
看了一下 discourse上的讨论,看上去是因为判断面的朝向时,不再考虑camera的矩阵导致的。我猜测是因为maptalks的坐标轴方向和three.js的不同,考虑camera变换后,maptalks和three面的朝向是一致,但去掉camera就出现问题了。 看上去three.js应该是不会回退到原有逻辑的,需要我们自己实现一个workaround。可以考虑通过addMesh时,修改某些参数(或者修改它的matrixWorld)来解决。 目前看来这不是一个容易解决的问题,需要一些时间来调研。 |
@liuxinqiong 可以先用0.5.0,注意一下readme里0.5.0 => 0.6.0的迁移指南就行了 |
已经开始着手解决这个问题: 这样maptalks和three(以及其他webgl库)的坐标系统就能变为一致了 |
哇,感謝 @fuzhenn 兄,一陣子沒注意這問題了 |
Cool! @fuzhenn 感谢,棒棒哒 |
maptalks核心库的修改已经推送到了master分支上,经过验证THREE(包括当前最新的110)能正常工作了。 THREE从103版开始修改了raycaster的射线方向计算方法,改为手动计算camera.projectionMatrixInverse矩阵即能解决,具体可以参考这个pr: #72 |
v0.46.0已经发布,升级到新版本的maptalks即可。 |
Three.js r102 起光線渲染好像不正常了,目前暫時沒空深挖到底發生什麼事,先在此回報。
and Raycaster does not work correctly
The text was updated successfully, but these errors were encountered: