Introduction to Shaders
What are Shaders?
Shaders are a set of software instructions used primarily to calculate rendering effects on the graphics hardware. Shader is a computer program that runs on the graphics processing unit (GPU), and it is used to do shading, lighting, special effects and post-processing.
Types of Shaders
Vertex Shader
The vertex shader runs once for each vertex given to the graphics processor. The purpose of the vertex shader is to transform each vertex's 3D position to the 2D coordinate that appears in the screen. The vertex shader can manipulate properties such as position, colour and texture coordinates.
Geometry Shader
The geometry shader can generate new graphics primitives such as points, lines, and triangles. The geometry shader is written in OpenGL Shading Language (GLSL). The geometry shader can specifically say that a primitive is to be rendered to a certain layer in the framebuffer.
Fragment Shader
The fragment shader is also known as the pixel shader. The fragment shader is used to compute colour and other attribute of each fragment. The fragment shader is where most effects are done in. The fragment shader is used to do colour, lighting, bump mapping, shadow mapping, and many other effects. The fragment shader can modify the depth of the fragment.
No comments:
Post a Comment