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

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

问题描述

在背面剔除中,您可以使用脸部法线来查看脸部是否指向远离相机的位置,如果三角形以时钟方式绘制或逆时针方向绘制,则可以采用一些技巧。



我对顺时针方向的这项技术感到困惑。对于这种方法来说,发送给显卡的顶点数据的排序决定了它是朝向还是远离相机。我不明白这是否合理,因为相机可以朝任何方向观看,就好像顶点数据必须根据相机位置改变,这显然不会在CPU上完成。



我怎么理解这个?

解决方案

/ p>



<3>三维空间中的3个点定义了一个三角形。另外,如果这些点是有序的(就像这里),它们也决定了一个三角形的两个面(面):顺时针和逆时针(它们通过放置在面内的顺序时钟来确定它的顶点)



在上面的例子中,三角形的形状是逆时针的。

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

>



如果您掷骰子(或围绕它旋转相机),CCW的三角形就会变成CW,我们不希望它再被纹理化。



这个骰子实际上是由12个这样的三角形构成的,如果我们正确地命令它们,我们将一次只能纹理6个纹理。


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.

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.

How can I understand this?

解决方案

This is one triangle viewed from opposite sides:

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.

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天全站免登陆