脸没有画

编程入门 行业动态 更新时间:2024-10-25 18:31:35
本文介绍了脸没有画的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

限时送ChatGPT账号..

我尝试绘制具有多个面的网格.

I try to draw a mesh with several faces.

有些脸是画出来的,有些不是.

Some of the faces are drawn some of them not.

当实例化一个通常不绘制的网格时,与索引相反,它被绘制.

When instantiating a mesh which is normally not drawn, with the index in reverse it is drawn.

以下不起作用:

   geom.faces.push(new THREE.Face3(k,k+1,k+2,myface.normal));

这有效:

   geom.faces.push(new THREE.Face3(k+2,k+1,k,myface.normal));

这对我来说意味着顶点的顺序是错误,所以法线画在相反的方向,但我将正确的法线传递给脸部(我自己计算)即使我尝试否定法线,也不会绘制脸部.

This for me means that the order of the vertices is wrong and so the normal is drawn in the opposite direction, but I pass the correct normal to the face (which I calculate myself) Even if I try to negate the normal, the face is not drawn.

因此,如果我按照我的理解通过了正确的法线,它将使如果将索引倒置或以其他方式放置,则没有区别.

So if I pass the correct normal as I understand it, it would make no difference if the indices are put in reverse or otherwise.

我哪里错了?

推荐答案

脸正面是由缠绕顺序决定的,不是脸法线.默认绕线顺序为逆时针 (CCW).

The face front is determined by the winding order, not the face normal. The default winding order is counter-clockwise (CCW).

查看GeometryputeFaceNormals()的源码,注意计算出的面法线是如何与CCW缠绕顺序一致的.

Have a look at the source of GeometryputeFaceNormals(), and notice how the computed face normal is consistent with a CCW winding order.

three.js r.58

three.js r.58

这篇关于脸没有画的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

更多推荐

[db:关键词]

本文发布于:2023-04-30 16:05:41,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1396250.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!