Wednesday, September 28, 2016

Confusion: _______surface of the model, fragment __normal to the surface of the model, vertex normal


[References]
1. "OpenGL Pipeline"


  • The surface of the model;
  • The normal for the surface of the model;
  • Vertex Normal;
  • Vertex-Shader-for-Each-Vertex;
  • Geometry-Shader-for-Each-Primitives;
  • Surface-Shader-For-Each-Surface;
  • Fragment-Shader-For-Each-Fragment-or-Pixel;
  • Vertex;
  • Vertex-Triangle;
  • Polygon;
  • Fragment;


[R0]

A fragment shader is the same as pixel shader.
One main difference is that a vertex shader can manipulate the attributes of vertices. which are the corner points of your polygons.
The fragment shader on the other hand takes care of how the pixels between the vertices look. They are interpolated between the defined vertices following specific rules.
  • For example: if you want your polygon to be completely red, you would define all vertices red. If you want for specific effects like a gradient between the vertices, you have to do that in the fragment shader.

Put another way:
  • The vertex shader is part of the early steps in the graphic pipeline, somewhere between model coordinate transformation and polygon clipping I think. At that point, nothing is really done yet.
  • However, the fragment/pixel shader is part of the rasterization step, where the image is calculated and the pixels between the vertices are filled in or "coloured".

Just read about the graphics pipeline here and everything will reveal itself:




No comments:

Post a Comment