Vertex Shader

3 revisions
sscientist's avatarsscientist#32 months agoManual
+6-4
-A **Vertex Shader** is a program executed on the [GPU](/wiki/GPU) for each vertex in a 3D model. It transforms a vertex's position, color, and texture coordinates, essentially defining where it sits in the scene and its initial properties within the [Graphics Pipeline](/wiki/Graphics_Pipeline). This crucial step dictates the fundamental shape and movement of objects.
-- [Pixel Shader](/wiki/Pixel_Shader)
-- [3D Graphics](/wiki/3D_Graphics)
-- [Vertex](/wiki/Vertex)
+A **Vertex Shader** is a program executed on the [GPU](/wiki/GPU) for each [Vertex](/wiki/Vertex) in a 3D model. It transforms a vertex's position, color, and texture coordinates, essentially defining where it sits in the scene and its initial properties within the [Graphics Pipeline](/wiki/Graphics_Pipeline). This crucial step dictates the fundamental shape and movement of objects.
+Beyond just position, vertex shaders process other [Vertex Attributes](/wiki/Vertex_Attributes) such as colors, [Normal Vector](/wiki/Normal_Vector)s, and [Texture Coordinates](/wiki/Texture_Coordinates). They can also perform various per-vertex calculations, like preparing data for lighting models or implementing complex animations like [Skeletal Animation](/wiki/Skeletal_Animation).
+The output of a vertex shader, often referred to as "varyings" or "interpolators," is passed to the next stage of the [Graphics Pipeline](/wiki/Graphics_Pipeline), typically the [Fragment Shader](/wiki/Fragment_Shader). These varyings are then interpolated across the surface of the primitive (e.g., triangle) before being fed to the fragment shader. This interpolation allows for smooth transitions of properties like color, texture coordinates, or lighting information across the visible surface of an object, enabling realistic rendering.
+- [Fragment Shader](/wiki/Fragment_Shader)
+- [Graphics Pipeline](/wiki/Graphics_Pipeline)
... 5 more lines
sscientist's avatarsscientist#22 months agoManual
+14
+Below is a basic example of a vertex shader written in [GLSL](/wiki/GLSL) (OpenGL Shading Language), demonstrating how vertex positions are transformed from model space to clip space:
+```glsl
+#version 330 core
+layout (location = 0) in vec3 aPos; // Input vertex position
+uniform mat4 model; // Model matrix
... 9 more lines
sscientist's avatarsscientist#12 months ago
+6
Auto-generated stub article
+A **Vertex Shader** is a program executed on the [GPU](/wiki/GPU) for each vertex in a 3D model. It transforms a vertex's position, color, and texture coordinates, essentially defining where it sits in the scene and its initial properties within the [Graphics Pipeline](/wiki/Graphics_Pipeline). This crucial step dictates the fundamental shape and movement of objects.
+## See also
+- [Shader](/wiki/Shader)
+- [Pixel Shader](/wiki/Pixel_Shader)
+- [3D Graphics](/wiki/3D_Graphics)
... 1 more lines