docs: standardize cross-reference link format to markdown

This commit is contained in:
2026-05-30 20:31:59 -05:00
parent 6d72ecf45d
commit f9010f9234
5 changed files with 62 additions and 62 deletions

View File

@@ -4,7 +4,7 @@
Your window is a grid of pixels: 800×600 in our configuration. The 3D scene you want to render spans from -∞ to +∞ in every direction. The GPU cannot reason in window pixels because every window has a different size. It cannot reason in world space because that is application-defined. The GPU needs a standard intermediate coordinate space.
That space is [[ndc]](GLOSSARY.md#ndc), Normalized Device Coordinates.
That space is [ndc](GLOSSARY.md#ndc), Normalized Device Coordinates.
## NDC Definition
@@ -48,7 +48,7 @@ In a real application, vertices live in arbitrary world units and you apply a se
## Homogeneous Coordinates
The GPU vertex shader outputs a `vec4<f32>`, not a `vec3<f32>`. The fourth component `w` is the [[homogeneous coordinates]](GLOSSARY.md#homogeneous-coordinates) value that enables the clip space → NDC conversion.
The GPU vertex shader outputs a `vec4<f32>`, not a `vec3<f32>`. The fourth component `w` is the [homogeneous coordinates](GLOSSARY.md#homogeneous-coordinates) value that enables the clip space → NDC conversion.
When the vertex shader outputs `vec4<f32>(x, y, z, w)`, the GPU performs a step called **perspective division**: it divides every component by `w`. The result is `(x/w, y/w, z/w)` — this is what lands in NDC.
@@ -66,7 +66,7 @@ Our triangle uses `w = 1.0` because we have no camera and no perspective — jus
## Clip Space
Before NDC, there is [[clip space]](GLOSSARY.md#clip-space). This is the coordinate space the vertex shader outputs into. Clip space is a pyramid (for perspective projection) or a box (for orthographic projection) that the GPU clips against. Geometry outside the clip-space boundaries is discarded by hardware before perspective division. Our triangle is entirely inside the clip space pyramid, so nothing is clipped.
Before NDC, there is [clip space](GLOSSARY.md#clip-space). This is the coordinate space the vertex shader outputs into. Clip space is a pyramid (for perspective projection) or a box (for orthographic projection) that the GPU clips against. Geometry outside the clip-space boundaries is discarded by hardware before perspective division. Our triangle is entirely inside the clip space pyramid, so nothing is clipped.
## Viewport Transform (Automatic)
@@ -77,7 +77,7 @@ screen_x = (ndc_x + 1.0) / 2.0 * window_width
screen_y = (ndc_y + 1.0) / 2.0 * window_height
```
This step is automatic. You never write it in code. It is configured by the [[viewport transform]](GLOSSARY.md#viewport-transform) fields in your `SurfaceConfiguration`, specifically the `width` and `height` values. When the surface configuration says 800×600, the GPU maps NDC `[-1, +1]` onto `[0, 800]` and `[0, 600]`.
This step is automatic. You never write it in code. It is configured by the [viewport transform](GLOSSARY.md#viewport-transform) fields in your `SurfaceConfiguration`, specifically the `width` and `height` values. When the surface configuration says 800×600, the GPU maps NDC `[-1, +1]` onto `[0, 800]` and `[0, 600]`.
You do write code to update the viewport transform — but only when the window size changes. At that point, you create a new `SurfaceConfiguration` with the new dimensions and configure the surface. The GPU then uses the updated mapping on subsequent frames.
@@ -87,7 +87,7 @@ For our triangle, every vertex follows this path:
1. **Vertex data:** Stored as `vec3<f32>` in the vertex buffer. Values are already in NDC.
2. **Vertex shader:** Wraps in `vec4(f32)` by appending `w = 1.0`. This is clip space (which, for identity `w`, equals NDC).
3. **Perspective division:** GPU divides by `w = 1.0` → identity. Vertex is now in [[ndc]](GLOSSARY.md#ndc).
3. **Perspective division:** GPU divides by `w = 1.0` → identity. Vertex is now in [ndc](GLOSSARY.md#ndc).
4. **Viewport transform (automatic):** GPU scales NDC to window pixel coordinates. The triangle appears on screen.
In a real 3D application, this journey includes model, view, and projection matrices before clip space. For the rainbow triangle, the journey is three steps through identity transforms. The hardware pipeline stages are the same regardless.