镶嵌着色器和几何着色器的区别 [英] Difference between tessellation shaders and Geometry shaders

查看:1350
本文介绍了镶嵌着色器和几何着色器的区别的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想开发图形管线的高层次的理解。有一件事,并没有太大的意义,我就是几何着色器的存在。无论是曲面细分和几何着色器似乎做同样的事情在我身上。有人能向我解释什么是几何着色器做的镶嵌着色器证明它的存在有什么不同?

I'm trying to develop a high level understanding of the graphics pipeline. One thing that doesn't make much sense to me is why the Geometry shader exists. Both the Tessellation and Geometry shaders seem to do the same thing to me. Can someone explain to me what does the Geometry shader do different from the tessellation shader that justifies its existence?

推荐答案

镶嵌着色器是递归的细分。一个重要的特点是邻接信息,所以你可以做正确的平滑,而不是风与差距。你可以做一些有限的细分与几何着色器,但是这不是真的是它对。

The tessellation shader is for recursive subdivision. An important features is adjacency information so you can do smoothing correctly and not wind up with gaps. You could do some limited subdivision with a geometry shader, but that's not really what its for.

几何着色器每个基本操作。例如,如果你需要做的东西,每个三角形(如<一个href="http://stackoverflow.com/questions/25434419/glsl-custom-no-interpolation-of-triangles-with-vertex-colors/25508724#25508724">this),做一个几何着色器。我听说过正在做影子挤出量。还有保守光栅化,你可能会延长三角形的边框让每一个相交的像素被一个片段。示例是特定pretty的应用程序。

Geometry shaders operate per-primitive. For example, if you need to do stuff for each triangle (such as this), do it in a geometry shader. I've heard of shadow volume extrusion being done. There's also "conservative rasterization" where you might extend triangle borders so every intersected pixel gets a fragment. Examples are pretty application specific.

是的,他们也可以产生比输入更多的几何形状,但是他们做的没有的很好地扩展。他们工作的伟大,如果你想画的颗粒并把积分兑换成非常简单的几何体。我实现了移动立方体一些使用几何着色器太次。工作原理与变换的反馈以保存生成的网格。

Yes, they can also generate more geometry than the input but they do not scale well. They work great if you want to draw particles and turn points into very simple geometry. I've implemented marching cubes a number of times using geometry shaders too. Works great with transform feedback to save the resulting mesh.

变换反馈也被用于与几何着色器做更多的计算操作。一种特别有用的机制是,它并流压实你(包其变化的输出量的紧密所以有得到的数组中没有间隙)。

Transform feedback has also been used with the geometry shader to do more compute operations. One particularly useful mechanism is that it does stream compaction for you (packs its varying amount of output tightly so there are no gaps in the resulting array).

另外很重要的事情几何着色器提供的路由到分层渲染目标(纹理数组,多维数据集,多视口的面),有事必须按原始完成。例如,您可以通过复制和投影几何6次,每个立方体的面孔呈现立方体阴影贴图点光源在一个单一的通行证。

The other very important thing a geometry shader provides is routing to layered render targets (texture arrays, faces of a cube, multiple viewports), something which must be done per-primitive. For example you can render cube shadow maps for point lights in a single pass by duplicating and projecting geometry 6 times to each of the cube's faces.

不完全是一个完整的答案,但希望给出了不同的要点。

Not exactly a complete answer but hopefully gives the gist of the differences.

另请参见:

这篇关于镶嵌着色器和几何着色器的区别的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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