Opengl rendering pipeline pdf




















Tessellation is considered active if a TES is active. Geometry shaders are user-defined programs that process each incoming primitive, returning zero or more output primitives. The input primitives for geometry shaders are the output primitives from a subset of the Primitive Assembly process. So if you send a triangle strip as a single primitive, what the geometry shader will see is a series of triangles.

However, there are a number of input primitive types that are defined specifically for geometry shaders. These adjacency primitives give GS's a larger view of the primitives; they provide access to vertices of primitives adjacent to the current one.

The output of a GS is zero or more simple primitives, much like the output of primitive assembly. The GS is able to remove primitives, or tessellate them by outputting many primitives for a single input. The GS can also tinker with the vertex values themselves, either doing some of the work for the vertex shader, or just to interpolate the values when tessellating them.

Geometry shaders can even convert primitives to different types; input point primitives can become triangles, or lines can become points. After the shader-based vertex processing, vertices undergo a number of fixed-function processing steps. The outputs of the geometry shader or primitive assembly are written to a series of buffer objects that have been setup for this purpose.

This is called transform feedback mode; it allows the user to transform data via vertex and geometry shaders, then hold on to that data for use later. The data output into the transform feedback buffer is the data from each primitive emitted by this step.

Primitive assembly is the process of collecting a run of vertex data output from the prior stages and composing it into a sequence of primitives. The type of primitive the user rendered with determines how this process works.

The output of this process is an ordered sequence of simple primitives lines, points, or triangles. If the input is a triangle strip primitive containing 12 vertices, for example, the output of this process will be 10 triangles.

If tessellation or geometry shaders are active, then a limited form of primitive assembly is executed before these Vertex Processing stages. This is used to feed those particular shader stages with individual primitives, rather than a sequence of vertices.

The rendering pipeline can also be aborted at this stage. This allows the use of Transform Feedback operations, without having to actually render something.

The primitives are then clipped. Clipping means that primitives that lie on the boundary between the inside of the viewing volume and the outside are split into several primitives, such that the entire primitive lies in the volume.

Also, the last Vertex Processing shader stage can specify user-defined clipping operations, on a per-vertex basis. The vertex positions are transformed from clip-space to window space via the Perspective Divide and the Viewport Transform.

Triangle primitives can be culled ie: discarded without rendering based on the triangle's facing in window space.

This allows you to avoid rendering triangles facing away from the viewer. For closed surfaces, such triangles would naturally be covered up by triangles facing the user, so there is never any need to render them. Face culling is a way to avoid rendering such primitives.

Primitives that reach this stage are then rasterized in the order in which they were given. The result of rasterizing a primitive is a sequence of Fragments. A fragment is a set of state that is used to compute the final data for a pixel or sample if multisampling is enabled in the output framebuffer. The state for a fragment includes its position in screen-space, the sample coverage if multisampling is enabled, and a list of arbitrary data that was output from the previous vertex or geometry shader.

This last set of data is computed by interpolating between the data values in the vertices for the fragment. The style of interpolation is defined by the shader that outputed those values. The data for each fragment from the rasterization stage is processed by a fragment shader. The output from a fragment shader is a list of colors for each of the color buffers being written to, a depth value, and a stencil value.

Fragment shaders are not able to set the stencil data for a fragment, but they do have control over the color and depth values. Fragment shaders are optional. If you render without a fragment shader, the depth and stencil values of the fragment get their usual values.

But the value of all of the colors that a fragment could have are undefined. Rendering without a fragment shader is useful when rendering only a primitive's default depth information to the depth buffer, such as when performing Occlusion Query tests. Many of these tests are only active if the user activates them. The tests are:. After this, color blending happens. For each fragment color value, there is a specific blending operation between it and the color already in the framebuffer at that location.

Logical Operations may also take place in lieu of blending, which perform bitwise operations between the fragment colors and framebuffer colors. Lastly, the fragment data is written to the framebuffer. Masking operations allow the user to prevent writes to certain values.

Table of Contents. Improve Article. Save Article. Like Article. Last Updated : 16 May, Rendering Pipeline is the sequence of steps that OpenGL takes when rendering objects.

Vertex attribute and other data go through a sequence of steps to generate the final image on the screen. There are usually 9-steps in this pipeline most of which are optional and many are programmable.

Sequence of steps taken by openGL to generate an image : Vertex Specification : In Vertex Specification, list an ordered list of vertices that define the boundaries of the primitive. Along with this, one can define other vertex attributes like color, texture coordinates etc. Later this data is sent down and manipulated by the pipeline.

Vertex Shader : The vertex specification defined above now pass through Vertex Shader. The ultimate goal of vertex shader is to calculate final vertex position of each vertex. Vertex shaders are executed once for every vertex in case of a triangle it will execute 3-times that the GPU processes.

So if the scene consists of one million vertices, the vertex shader will execute one million times once for each vertex. The main job of a vertex shader is to calculate the final positions of the vertices in the scene. Tessellation : This is a optional stage. In this stage primitives are tessellated i.

Geometry Shader : This shader stage is also optional. The work of Geometry Shader is to take an input primitive and generate zero or more output primitive. If a triangle strip is sent as a single primitive, geometry shader will visualize a series of triangles. Geometry Shader is able to remove primitives or tessellate them by outputting many primitives for a single input. Geometry shaders can also convert primitives to different types. For example, point primitive can become triangles.

Vertex Post Processing : This is a fixed function stage i.



0コメント

  • 1000 / 1000