gpt4 book ai didi

javascript - 三个 js 平滑着色出现平坦

转载 作者:行者123 更新时间:2023-12-02 19:31:57 24 4
gpt4 key购买 nike

我正在加载 .STL 文件,应用 MeshStandardMaterial 而不触及 flatShading 属性,因为默认情况下它是 false

enter image description here

结果在我看来非常平淡。如果我尝试设置 flatShading: true,结果是一样的。

我已经尝试了所有我能想到的方法,但没有任何想法 - 欢迎任何建议,谢谢。

geometry.computeVertexNormals();
geometry.computeBoundingBox();
geometry.computeBoundingSphere();
geometry.normalizeNormals();

最佳答案

The result looks very flat to me. If I try setting flatShading: true the result is the same.

STLLoader 始终返回非索引缓冲区几何(未连接的三 Angular 形汤)。这意味着几何体的面不共享顶点,因此使用 BufferGeometry.computeVertexNormals() 无法生成平滑着色所需的法线。

此外,重新计算边界体积和 BufferGeometry.normalizeNormals() 的使用也与此问题无关。

您可以尝试通过确保 Assets 带有允许平滑着色的法线来解决此问题。或者你给BufferGeometryUtils.mergeVertices()通过合并顶点生成索引几何的尝试。

关于javascript - 三个 js 平滑着色出现平坦,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/61651746/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com