Vertex (computer graphics): Difference between revisions
m robot Adding: cs:Vertex |
Removed disinformation (See talk page) |
||
Line 2: | Line 2: | ||
==Application to object models== |
==Application to object models== |
||
[[Image:Utah teapot simple 2.png|thumb|200px|The [[Utah teapot]], a model by [[Martin Newell (computer scientist)|Martin Newell]] (1975).]] |
|||
In computer graphics, objects are most-often represented as triangulated [[Polyhedron|polyhedra]]. Non triangular surfaces can be converted to an array of triangles through [[tesselation]]. The vertices of triangles are associated not only with position but also with other graphical attributes used to [[render]] the object correctly. Such attributes can include color at the vertex point, reflectance of the surface at the vertex, textures of the surface at the vertex, and the normal of an approximated curved surface at the location of the vertex. These properties are used in rendering by a [[vertex shader]] or [[vertex pipeline]]. |
In computer graphics, objects are most-often represented as triangulated [[Polyhedron|polyhedra]]. Non triangular surfaces can be converted to an array of triangles through [[tesselation]]. The vertices of triangles are associated not only with position but also with other graphical attributes used to [[render]] the object correctly. Such attributes can include color at the vertex point, reflectance of the surface at the vertex, textures of the surface at the vertex, and the normal of an approximated curved surface at the location of the vertex. These properties are used in rendering by a [[vertex shader]] or [[vertex pipeline]]. |
||
The normal can be used to determine a surface's orientation toward a light source for flat shading using [[Lambert's cosine law]], or the orientation of each of the vertices to mimic a curved surface with [[Phong shading]]. |
The normal can be used to determine a surface's orientation toward a light source for flat shading using [[Lambert's cosine law]], or the orientation of each of the vertices to mimic a curved surface with [[Phong shading]]. |
||
The [[Utah teapot]], a widely used sample 3D graphics object, is described by approximately 100 vertices. Its smooth appearance in rendered images is the result of shading using vertex attribute data. |
|||
==Vertex attributes== |
==Vertex attributes== |
Revision as of 05:33, 9 June 2011
A vertex (plural vertices) in computer graphics is a data structure that describes a point in 2D or 3D space. Display objects are composed of arrays of flat surfaces (typically triangles) and vertices define the location and other attributes of the corners of the surfaces.
Application to object models
In computer graphics, objects are most-often represented as triangulated polyhedra. Non triangular surfaces can be converted to an array of triangles through tesselation. The vertices of triangles are associated not only with position but also with other graphical attributes used to render the object correctly. Such attributes can include color at the vertex point, reflectance of the surface at the vertex, textures of the surface at the vertex, and the normal of an approximated curved surface at the location of the vertex. These properties are used in rendering by a vertex shader or vertex pipeline.
The normal can be used to determine a surface's orientation toward a light source for flat shading using Lambert's cosine law, or the orientation of each of the vertices to mimic a curved surface with Phong shading.
Vertex attributes
Most attributes of a vertex represent vectors in the space to be rendered. Vectors can be 1 (x), 2 (x, y), or 3 (x, y, z) dimensional and can include a fourth homogeneous coordinate (w).
The following is a table of built in attributes of vertices in the OpenGL standard.
GL attribute name | attribute defined (data value size) |
---|---|
gl_Vertex | Position (vec4) |
gl_Normal | Normal (vec4) |
gl_Color | Primary color of vertex (vec4) |
gl_MultiTexCoord0 | Texture coordinate of texture unit 0 (vec4) |
gl_MultiTexCoord1 | Texture coordinate of texture unit 1 (vec4) |
gl_MultiTexCoord2 | Texture coordinate of texture unit 2 (vec4) |
gl_MultiTexCoord3 | Texture coordinate of texture unit 3 (vec4) |
gl_MultiTexCoord4 | Texture coordinate of texture unit 4 (vec4) |
gl_MultiTexCoord5 | Texture coordinate of texture unit 5 (vec4) |
gl_MultiTexCoord6 | Texture coordinate of texture unit 6 (vec4) |
gl_MultiTexCoord7 | Texture coordinate of texture unit 7 (vec4) |
gl_FogCoord | Fog Coord (float) |
References
- ^ Christen, Martin. "Clockworkcoders Tutorials: Vertex Attributes". Khronos Group. Retrieved 26 January 2009.