What are Geometry Shaders?

941 views

I studied game programming a short while back, I enjoyed our time learning about shader programming.

At the time I learned about 2 types of shader, vertex and fragment shaders. I have a novice’s grasp of these, but I understand them to control the transformations of vertices and the rasterisation of pixels respectively, but I offhandedly heard someone mention geometry shaders recently and wondered how they factor into a process I’ve only understood so far to utilise two different types of shader.

I ask here because I’m no longer pursuing the subject and don’t have a deep understanding of graphics programming.

Thank you!

Answered in comments.

In: Technology

2 Answers

Anonymous 0 Comments

[Here’s](https://upload.wikimedia.org/wikipedia/commons/5/54/Geometry-shader-pipeline-simple.png) a graphic of a shader pipeline.

While the vertex shader gets verticies as input and the fragment shader gets pixels as input, the geometry shader gets whole primitives (a Polygon for example) as input. He then can transform this primitive. It’s possible to for example convert a point into one or more triangles or one triangle into 5 triangles. It is also possible to just to emit the same geometry that was received but with additional information like generated normals.

Anonymous 0 Comments

Fragment shaders change the color of a pixel on screen. Vertex change the position of a vertex. Geometry shaders come after the vertex shader and can use these vertices to create *new* geometry that didn’t exist before.