脸没有画 [英] Face is not drawn

查看:20
本文介绍了脸没有画的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

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).

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

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

three.js r.58

three.js r.58

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

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆