Geometry Shader

7,521 views

Published on

A brief overview of geometry shaders based Level Of Detail implementation.

Published in: Technology, Art & Photos
0 Comments
2 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
7,521
On SlideShare
0
From Embeds
0
Number of Embeds
58
Actions
Shares
0
Downloads
111
Comments
0
Likes
2
Embeds 0
No embeds

No notes for slide

Geometry Shader

  1. 1. Optimizations with Geometry Shaders Alessandro Rigazzi Data Analysis and Visualization Group May 27, 2008
  2. 2. Geometry shader: what and where <ul><li>Programmable stage of the rendering pipeline </li></ul><ul><li>In Open GL: takes any primitive as input, can output: </li></ul><ul><ul><li>Points </li></ul></ul><ul><ul><li>Line Strips </li></ul></ul><ul><ul><li>Triangle Strips </li></ul></ul><ul><li>Basically: can add geometry which is not stored </li></ul>Vertex Shader Geometry Shader Fragment Shader
  3. 3. Some potential uses <ul><li>Mesh refinement </li></ul><ul><ul><li>Send few triangles to video memory and refine them in shader </li></ul></ul><ul><li>Frustum culling </li></ul><ul><ul><li>Discard triangles outside of rendered scene before fragment processing </li></ul></ul><ul><li>Level Of Detail </li></ul><ul><ul><li>Refine mesh according to distance from camera </li></ul></ul><ul><li>We merge these three ideas in one sample application </li></ul>
  4. 4. Sample application: first stage, refinement <ul><li>We draw spheres: for each sphere we just send two pyramids ( eight triangles ) to the video memory and we refine them three times in the geometry shader </li></ul>Input Geometry Output Geometry
  5. 5. Sample application: second stage, LOD <ul><li>We dynamically subdivide the spheres, depending on their distance to the camera, framerate is more than doubled (four levels of detail) </li></ul>Input Geometry Output Geometry
  6. 6. Sample application: third stage, frustum culling <ul><li>We do not process triangles which are completely outside of the frustum : the image is the same, but we get an 11x improvement of the framerate </li></ul>Input Geometry Output Geometry
  7. 7. Benchmark
  8. 8. Limitations <ul><li>Geometry shaders require Shader Model 4 , i.e., for Open GL two extensions are needed: </li></ul><ul><ul><li>GL_EXT_geometry_shader4 </li></ul></ul><ul><ul><li>GL_EXT_gpu_shader4 </li></ul></ul><ul><li>Extensions supported in modern graphic cards (e.g. nVidia G80 or later) </li></ul><ul><li>Limited number of primitive and vertices which can be emitted by the vertex shader (commonly, at most 1024 floating points components can be emitted) </li></ul>

×