Geometry shader

From Wikipedia, the free encyclopedia

A geometry shader (abbreviated GS) is a shader program, normally executed on the graphics processing unit.

Contents

[edit] Function

A geometry shader can generate new graphics primitives, such as points, lines, and triangles, from those primitives that were sent to the beginning of the graphics pipeline.

Geometry shader programs are executed after vertex shaders. They take as input a whole primitive, possibly with adjacency information. For example, when operating on triangles, the three vertices are the geometry shader's input. The shader can then emit zero or more primitives, which are rasterized and their fragments ultimately passed to a pixel shader.

Typical uses of a geometry shader include point sprite generation, geometry tessellation, shadow volume extrusion, and single pass rendering to a cube map.

A typical real world example of the benefits of geometry shaders would be automatic mesh complexity modification. A series of line strips representing control points for a curve are pased to the geometry shader and depending on the complexity required the shader can automatically generate extra lines each of which provides a better approximation of a curve.

[edit] Programming

Geometry shaders can be programmed in the following languages: assembly, Cg, and Direct3D's HLSL (beginning with DirectX 10) and OpenGL's GLSL.

[edit] See also

[edit] References