thebookofshaders
thebookofshaders copied to clipboard
usage of semantically undefined term: st
similar to #62 but for st. what does st mean?
maybe point out what the words mean to make learning them easier.
stickler meeseeks out**
s and t are used in opengl to denote texture coordinates. traditionally, texture coordinates are denoted with u and v (and... they still are, it depends on the programmer, or the context), but the next letter being w for 3d textures (such as cubemaps for example), other letters are preferred since w is already used for the clip coordinate as a convention. it is a convention used so frequently that it is part of the GLSL language to indicate the components of a vec4. given a : vec4, you may access its components using a.s, a.t, a.p, a.q, and you are able to use swizzling operations and grouping operations the same way as with the other notations (xyzw, rgba).
since in the examples we're operating on a grid of fragments covering the window (because the input to the vertex shader is the vertices of a rectangle covering the camera space, the result of the rasterization is giving us a grid of fragments covering the window to work with), it is intuitive to think of fragment coordinates as coordinates of a texture -- after being normalized by dividing the window coordinates by the viewport resolution.