openGL中的顺时针面是什么 [英] what is a clockwise face in openGL

查看:29
本文介绍了openGL中的顺时针面是什么的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在背面剔除中,您可以使用面部法线来查看面部是否远离相机,如果三角形是顺时针或逆时针绘制,您可以使用一些技巧.

In back face culling you may either use the face normals to see if the face is pointing away from the camera of you may do some technique with if the triangle is drawn clock wise or counter clock wise.

我对这种技术与顺时针方向感到困惑.似乎使用这种方法,发送到显卡的顶点数据的顺序决定了它是面向还是背离相机.我不明白这有什么意义,因为相机可以朝任何方向看,就好像顶点数据必须根据相机位置而改变,而这显然不是在 CPU 上完成的.

I am confused about this technique with the clockwise. It seems like with this method, the ordering of the vertex data that gets sent to the graphics card decides whether it is facing towards or away from the camera. I don't see how this makes sense because the camera can be looking in any direction, it's as if the vertex data would have to change based on the camera position and that is obviously not done on the CPU.

我怎么理解这个?

推荐答案

这是从对边看的一个三角形:

This is one triangle viewed from opposite sides:

3D 空间中的 3 个点定义了一个三角形.此外,如果这些点是有序的(如这里),它们也确定了三角形的两条边(面):顺时针和逆时针(它们由放置在面内的时钟指向其顶点的顺序确定)

3 points in 3D space are defining a triangle. In addition, if those points are ordered (like here) they are also determining two sides (faces) of a triangle : clockwise and counter-clockwise (they are determined by the order clock put inside a face would point its vertices)

在上面的例子中,三角形是逆时针纹理的

In above example triangle is textured counter-clockwise

现在想象这个三角形是一个骰子的元素:

Now imagine this triangle is an element of a dice:

如果你掷骰子(或围绕它旋转相机),我们的逆时针三角形变为顺时针,我们不希望它再有纹理.

If you roll the dice (or rotate camera around it) our triangle from CCW becomes CW and we don't want it to be textured any more.

这个骰子实际上是由 12 个这样的三角形构成的,如果我们正确地对它们进行排序,我们将一次只对 6 个面向相机的三角形进行纹理化.

This dice would be in fact built out of 12 such triangles and if we order them properly we will be texturing only 6 that are facing camera at a time.

这篇关于openGL中的顺时针面是什么的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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