【Web3D】Shaders

   |   1 minute read   |   Using 110 words

Shaders

  • A material rendered with custom shader is a small program written in GLSL that runs on GPU
    • Use case:
    • Implement an effect not inlcuded with any of the built-in materials。

Uniforms

  • provide us a way to send data from JavaScript to our shader.
  • we can use uniforms both Vertex and Fragment
  • use case:
    • Pass mouse position data
    • Time information
    • Color
    • Textures
    • (etc.)

Vertex Shader

  • The vertex shaser runs first;
  • It will receives attributes, calculates / manipulates the postion of each individual vertex
  • Position the vertices of geometry

Fragment Shader

  • The fragment (or pixel ) shaders runs second;
  • it sets the color of each individual “fragment ” (pixel) of geometry
  • vrDrLT.png


© 2025 by clayliu. All Rights Reserved.