GLSL Shaders

Tue, 04 Jul 2023 10:40:08 GMT

 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

  1. Float (float)
  2. Integer (int)
  3. Boolean (bool)
  4. Vector 2 (vec2)
  5. Vector 3 (vec3)
  6. Vector 4 (vec4)
  7. Functions
  8. 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

  1. The vertex shader position the vertices on the render
  2. The fragment shader colors each visible fragment (or pixel) of the geometry
  3. The fragment shader is executed after the vertex shader
  4. Data that changes between each vertices (like their position) is called attribute and can only be used in the vertex shader
  5. 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
  6. We can send data from the vertex shader to the fragment shader using varying

Back to top

 Context