User Controls

glsl coding

  1. #1
    Industrial Houston
    what's a good way to learn shader coding without mongoloid video tutorials? i get how to code, generally get the inputs and outputs, but don't actually understand how the function's effect changes over time
  2. #2
    SBTlauien African Astronaut
    This looks like it could be a good start...

    https://kat.cr/opengl-4-shading-language-cookbook-dbw-t11939755.html
  3. #3
    Industrial Houston
    This looks like it could be a good start…

    https://kat.cr/opengl-4-shading-language-cookbook-dbw-t11939755.html

    thanks so much dudeee
  4. #4
    Parker Brother Yung Blood [the valiantly arthrosporous wyatt]
    …but don't actually understand how the function's effect changes over time

    The fragment shader is run for each pixel on the surface of the polygon. When drawing the polygon, the vertices and other values output from the vertex shader are blended depending on the current position on the surface of the polygon.

    For example, look at this triangle here:



    This is your classic OpenGL triangle. One of the first things you draw when learning OpenGL.

    Each vertex in the triangle has a different color. When the triangle is drawn, the three colors are blended depending on the position of the current pixel inside the polygon: more red the closer to the red point, more green the closer to the green point, etc. Half way between the red and green points, red and green are blended 50/50, giving orange. In the absolute center of the triangle, all three colors are blended equally, each contributing 1/3 of the final color.

    The coordinate system used to determine how to blend the values is called Barycentric Coordinates. For more information look here:

    http://www.scratchapixel.com/lessons/3d-basic-rendering/ray-tracing-rendering-a-triangle/barycentric-coordinates
Jump to Top