Metal is Apple's graphics and compute API. Its shader language is the Metal Shading Language (MSL).
The homogeneous coordinate, sometimes referred to as the w coordinate. It serves 3 primary purposes. 1. Perspective Division --- objects farther away appear smaller (screen_x = x /w, etc.) 2. Matrix Multiplications --- the w coordinate allows for elegant handling of affine transformations via matrix multiplications. 3. Clipping and Depth Buffering --- helps determine whether an object is visible and its depth relative to other objects. TODO: sounds like a moron wrote this
If the points are ordered counterclockwise, then the triangle is facing the camera. This incidentally aligns with historical conventions like the right-hand rule and Euler angles.
Yaw --- flatspin; use rudder to control. Pitch --- backflip; use elevator to control. Roll --- barrel roll; use ailerons to control.
Every pixel that ends up on your screen has associated to it at least one fragment. The fragment usually describes what color the pixel will be. Fragment shaders take as input vertices (which already have been processed by a vertex shader) and produce fragments as output.
It stores all the *unique* vertices of the triangles you're drawing. You'd then use an index buffer to identify specific vertices in the vertex buffer with specific vertices in your triangles.
R = R_z(𝛼) R_y(β) R_x(𝛾)
matrix multiplication is not commutative so order matters
1-5 milliseconds
{{ s_x, 0, 0, 0}, { 0, s_y, 0, 0}, {0, 0, s_z, 0}, {0, 0, 0, s_w}}
R_z(𝛼) = {{cos 𝛼, -sin 𝛼, 0}, {sin 𝛼, cos 𝛼, 0}, {0, 0, 1}}
{{ cos θ, -sin θ, 0}, {sin θ, cos θ, 0}, {0, 0, 1}}
A swapchain is a series of images presented to the display. It is handles buffering and synchronization between the display and the GPU to prevent artifacts like tearing. Related topics: double buffering, triple buffering, vsync
R_x(𝛾) = {{1, 0, 0}, {0, cos 𝛾, -sin 𝛾}, {0, sin 𝛾, cos 𝛾}}
A graphics API developed by Khronos Group. Its shader language is GLSL. Its successor is Vulkan.
Mipmaps (also MIP maps) or pyramids are pre-calculated, optimized sequences of images, each of which is a progressively lower resolution representation of the previous. The height and width of each image, or level, in the mipmap is a factor of two smaller than the previous level. They are intended to increase rendering speed and reduce aliasing artifacts. The letters MIP in the name are an acronym of the Latin phrase multum in parvo, meaning "much in little".
WGSL stands for WebGPU Shading Language. It is the shading language for WebGPU. It's development focuses on converting WGSL shaders to into the shader language corresponding to whatever backend you're using. For example, the backend for Vulkan is SPIR-V; for Metal it's MSL; for DX12 is HLSL; for OpenGL it's GLSL. Apparently SPIR-V is going to be replaced by WGSL.
It transforms your shapes/objects to look the way you want it (where it's positioned, how it's oriented, etc.).
It is used in conjuction with a vertex buffer --- the set of unique vertices in your triangles --- to associate specific vertices in your vertex buffer to specific vertices in your triangles.
A BindGroup describes a set of resources and how they can be accessed by a shader. TODO: maybe this is a WGSL thing, not a wgpu thing.
The region of space of the modeled world that may appear on screen. Frustum etymology: Latin for "piece cut off"
column-major
Shaders are mini-programs that you send to your GPU to perform operations on your data. There are three main types of shaders: vertex, fragment, and compute. Vertex shaders transform your shapes to look the way you want. Fragment shaders convert the transformed vertices into fragments. Each pixel that gets drawn on your screen has at least one fragment. Usually the fragment has a color that gets copied to the pixel.
R_y(β) = {{cos β, 0, sin β}, {0, 1, 0}, {-sin β, 0, cos β}}
Normal mapping is a texture mapping technique used for faking the lighting of bumps and dents – an implementation of bump mapping. It is used to add details without using more polygons. A common use of this technique is to greatly enhance the appearance and details of a low polygon model by generating a normal map from a high polygon model or height map.
{{1, 0, a}, {0, 1, b}, {0, 0, 1}}
A graphics API developed by Khronos Group. Its shader language is currently SPIR-V, but there are plans to replace it with WGSL.
DirectX 12, a graphics API developed by Microsoft and NVIDIA. Its shader language is the High-Level Shader Language (HLSL).
A system of coordinates used in projective geometry. 1. Formulas involving homogeneous coordinates are often simpler and more symmetric than their Cartesian counterparts; projective transformations are easily represented by a matrix. 2. Coordinates of points, including points at infinity, can be represented using finite coordinates. 3. Modern graphics APIs and graphics cards take advantage of homogeneous coordinate systems by using vector processors with 4-element registers (X, Y, Z, W).
width : height
Trans(a, b) Rot(θ) Trans(-a, -b)
Yes, typically
linear
A uniform is a global Shader variable. These act as parameters that the user of a shader program can pass to that program.
Uniforms are so named because they do not change from one shader invocation to the next within a particular rendering call thus their value is uniform among all invocations. This makes them unlike shader stage inputs and outputs, which are often different for each invocation of a shader stage.
16.666 milliseconds
5-10 milliseconds, but it's somewhat irrelevant because this trip is not involved in the path from CPU to what you see on your screen.