Friday 12 April 2013

Final Graphics Post!

This is the last post in this segment of blogs! I will be doing an overview of the material we went over in this class. So lets get right to it.

We learned about shaders and shaders are small programs in the graphics pipeline that give more freedom to the original graphics pipeline. We have three main shaders that we covered in this course, Vertex Shader, Geometry Shader, and Fragment Shader.

The Vertex Shader takes in vertices along with other attributes and uniforms. Then the program does whatever the programmer likes but they usually manipulate the placement of the vertices in a scene. They then output the vertices along with their attributes.

Next in the pipeline is primitive assembly, this is where the triangles are formed and those are passed to the Geometry Shader. The Geometry Shader is used to add geometry to already existing geometry which is mainly used for tessellation  The output would be more vertices or other geometry. This is now passed to our good friend the Rasterizer who gives pixels to our geometry. The shapes use tri linear interpolation between the vertices of the triangles to assign data to each pixel.

The Fragment Shader retrieves these pixels along with the uniforms and any attributes. Then inside the shader is up to the programmers discretion but they are normally manipulating the color of the pixels. The output then would be color of the fragments.

An often used tool with shaders is a frame buffer object or an FBO. There are also vertex buffer objects and vertex array objects or VBO's and VAO's. These are just sources of memory that are either samples of the screen as a texture or an array of vertices for an object.

Now we also went over many different algorithms and shaders during the course of the semester. Here is a list of the different shader techniques:
-Lighting
-Blur/Motion Blur
-Bloom/HDR
-Toon Shading  
-Shadow Mapping
-Deferred Rendering
-Mesh Skinning
-Normal Mapping

There are four different types of lighting: Diffuse, Ambient, Emissive, and Specular. Diffuse lighting requires normals and is calculated by the dot product of the normal vector of a vertex and the vector from the light to the vertex. Ambient is the color of the light. Emissive lighting is the light coming from an object. Specular lighting is calculated by the dot product of the vector from the light to the vertex by the relfected ray vector.

With blur there are two different types we learned, Box and Gaussion. They are done by sampling neighboring pixels and blending them together. Box has uniform weights around the pixel being sampled and Gaussian has a gradient fall off on the weights. The sum of the weights equal 1. There can be an added bright pass which illuminates bright pixels more and makes dark ones darker. Motion blur is done by accumulating frames and blending them together.

Toon Shading is done by sampling from a blocky gradient and applying the level of light to certain gradients. If the level falls into a certain level then use that sample.

Shadow Mapping refers to the depth buffer or Z buffer relative to the light source. It creates a vector from the light to the depth buffer. From the camera perspective we send the position of the fragment in question to the shader. Then we create a vector from that pixel and light and check, if the depth vector is less than the pixel vector, draw that pixel grey, else draw normally.

Deferred rendering is to optimize calculations that forward rendering does. We use this to be able to use several lights in a single scene. Way more can be said about this but my understanding currently is still weak about it.

Mesh Skinning is mainly used in the vertex shader as we are manipulating the vertices of the object being drawn. With mesh skinning, we can deform the skin of a model relative to the weights assigned by an artist to the joints in the skeleton.

Normal Mapping is used to make low poly models look like high poly models. This is done by sampling the normals of the high poly model and applying them to the fragments of the low poly model. There are two different types of normal mapping, object and tangent space normal mapping. Object is relative to the object being normal mapped and tangent is relative to the tangent space of the normal map.

Honorable mention goes out to Displacement mapping as we discussed it but rarely went into depth about it.

This wraps up our class of Intermediate Computer Graphics, I learned so much about this class and enjoyed it so much.

No comments:

Post a Comment