Opengl深度缓冲区和剔除 [英] Opengl Depth buffer and Culling

查看:120
本文介绍了Opengl深度缓冲区和剔除的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用背面剔除和OpenGL中的深度缓冲之间有什么区别?

Whats's the difference between use back face culling and a buffer of depth in OpenGL?

推荐答案

背面剔除是OpenGL确定哪些面背对查看器且因此看不见的时候.想想一个立方体.无论您如何旋转多维数据集,始终将看不见3个面.弄清楚这些是哪些面,将它们从要绘制的多边形列表中删除,您只需将绘制列表减半即可.

Backface culling is when OpenGL determines which faces are facing away from the viewer and are therefore unseen. Think of a cube. No matter how your rotate the cube, 3 faces will always be invisible. Figure out which faces these are, remove them from the list of polygons to be drawn and you just halved your drawing list.

深度缓冲非常简单.对于绘制的每个多边形的每个像素,将其z值与z缓冲区进行比较.如果小于z缓冲区中的值,则将z缓冲区值设置为新的z缓冲区值.如果不是,则丢弃像素.深度缓冲可以提供很好的结果,但是会很慢,因为每个像素都需要进行值查找.

Depth buffering is fairly simple. For every pixel of every polygon drawn, compare it's z value to the z buffer. if it's less than the value in the z buffer set the z buffer value as the new z buffer value. If not, discard the pixel. Depth buffering gives very good results but can be fairly slow as each and every pixel requires a value lookup.

实际上,这两种方法之间没有相似之处,并且经常同时使用它们.给定一个多维数据集,您可以先使用剔除法切除一半的多边形,然后使用z缓冲绘制它们.

In reality there is nothing similar between these two methods and they are often both used. Given a cube you can first cut out half the polygons using culling then draw them using z buffering.

剔除可以减少渲染的多边形,但这不是排序算法.这就是Z缓冲.

Culling can cut down on the polygons rendered, but it's not a sorting algorithm. That's what Z buffering is.

这篇关于Opengl深度缓冲区和剔除的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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