GLSL Shaders
Tue, 04 Jul 2023 10:40:08 GMT — Properties
Properties
Key | Value |
---|---|
Identifier | glsl-shaders |
Name | GLSL Shaders |
Type | Topic |
Creation timestamp | Tue, 04 Jul 2023 10:40:08 GMT |
Modification timestamp | Wed, 05 Jul 2023 15:29:01 GMT |
Shaders
Pending
GLSL
Pending
Types
- Float (float)
- Integer (int)
- Boolean (bool)
- Vector 2 (vec2)
- Vector 3 (vec3)
- Vector 4 (vec4)
- Functions
- Native functions
Vertex Shader
The vertex shader's purpose is to position the vertices of the geometry by sending it the positions, the mesh transformations (i.e., position, rotation and scale) and the camera information (i.e., position, rotation and field of view) after which the GPU will follow the instructions in the vertex shader to process all of this information in order to project the vertices on a 2D space which, in turn, will become the render.
gl_Position
Pending
Position Attributes
Pending
Matrices Uniforms
Pending
Fragment Shader
Pending
Precision
Pending
gl_FragColor
Pending
Attributes
Pending
Varyings
Pending
Uniforms
Pending
Textures
Pending
Color Variations
Pending
RawShaderMaterial
Pending
ShaderMaterial
Pending
Summary
- The vertex shader position the vertices on the render
- The fragment shader colors each visible fragment (or pixel) of the geometry
- The fragment shader is executed after the vertex shader
- Data that changes between each vertices (like their position) is called attribute and can only be used in the vertex shader
- Data that doesn't change between vertices (like the mesh position or a color) is called uniform and can be use in both the vertex shader and the fragment shader
- We can send data from the vertex shader to the fragment shader using varying