Skip to content

Commit c9803a0

Browse files
committed
change(/wiki/coordinate-systems): Many changes. Much links.
1 parent 09b1447 commit c9803a0

File tree

1 file changed

+56
-21
lines changed

1 file changed

+56
-21
lines changed

content/wiki/coordinate-systems/index.md

Lines changed: 56 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -18,43 +18,78 @@ As such, it is a good idea to do one or more of these:
1818
- Restrict the mixing of coordinate-systems, by using a type-system that let's you create [new types](https://www.worthe-it.co.za/blog/2020-10-31-newtype-pattern-in-rust.html) from existing types.
1919
- Document the coordinate-systems of function parameters.
2020

21-
## Terminology
21+
Note that, depending on the software you are using, the concrete definition and usage of coordinate-systems can vary *wildly*...
2222

23-
Now then, let's get to the various coordinate systems!
23+
{% figure(caption="Commonly Used Coordinate Systems",author="Freya Holmér",license="[Copy embedded with permission.](https://twitter.com/FreyaHolmer/status/1530167901436649472)",class="full") %}/wiki/coordinate-systems/coordinate-systems.png{% end %}
24+
<div style='height:0.5rem'></div>
25+
{% info_notice() %}
26+
**Authors Opinion:**
27+
I recommend using a right-handed coordinate-system with Z-up or, if you prefer, Y-up.
2428

25-
{% todo_notice() %} Add descriptive diagrams to all definitions. {% end %}
29+
- Blender, SketchUp and various Autodesk products use it.
30+
- Z-up, so that a sheet of graph-paper represents the X/Y plane.
31+
{% end %}
2632

27-
### World Space
33+
Also, keep in mind that the great majority of 2D renderers *and displays* available use a X-right + Y-*down* system, mainly due to western writing systems being oriented that way.
2834

29-
The global coordinate system that is the entire scene. This is where almost all the (gameplay-related) math will occur.
35+
## Terminology
3036

31-
Depending on the software you are using, this can vary *wildly*...
37+
Now then, let's get to the various coordinate systems!
38+
39+
The order in which they are listed is *kinda important*, so try to keep it in mind. ;)
3240

33-
{% figure(caption="World-Space Coordinate Systems",author="Freya Holmér",license="[Copy embedded with permission.](https://twitter.com/FreyaHolmer/status/1530167901436649472)",class="full") %}/wiki/coordinate-systems/coordinate-systems.png{% end %}
41+
{% todo_notice() %} Add descriptive diagrams to all definitions. {% end %}
3442

35-
### Chunk/Object/Local Space
43+
### Voxel/Sample Space
44+
<img src="/favicon-32x32.png" width=32 style='float:right'></img>
45+
The 'inner' coordinate system of an *individual voxel*.
3646

37-
<img src="/favicon-32x32.png" width=32></img>
38-
The local coordinate system of an [individual chunk](/wiki/chunking) or object.
47+
### Object/Local/Chunk Space
48+
<img src="/favicon-32x32.png" width=32 style='float:right'></img>
49+
The local coordinate system of an individual object, such as an entity or a [chunk](/wiki/chunking).
50+
51+
### World/Scene Space
52+
<img src="/favicon-32x32.png" width=32 style='float:right'></img>
53+
The global coordinate system that is the entire scene. This is where almost all the (gameplay-related) math will occur.
3954

40-
### Voxel Space
55+
### View/Camera Space
56+
<img src="/favicon-32x32.png" width=32 style='float:right'></img>
57+
The view of a camera into world space.
4158

42-
<img src="/favicon-32x32.png" width=32></img>
43-
The inner coordinate system of an *individual voxel*.
59+
### (Homogeneous) Clip Space
60+
<img src="/favicon-32x32.png" width=32 style='float:right'></img>
61+
The camera space with a perspective- or orthographic-projection applied,
62+
forming a prism/box called the *clip volume*.
4463

45-
### NDC Space
64+
- This is the space that we output to in a vertex shader.
65+
- i.e.: `gl_Position` is in clip-space.
66+
- Coordinates are defined to be homogenous here.
4667

47-
<img src="/favicon-32x32.png" width=32></img>
48-
The global coordinate system, as seen by a camera with some projection applied.
68+
### Normalized Device Coordinate(s) Space
69+
<img src="/favicon-32x32.png" width=32 style='float:right'></img>
70+
The clip space after perspective coordinate division, if applicable.
4971

50-
### View Space
72+
### Screen/Window/Framebuffer Space
73+
<img src="/favicon-32x32.png" width=32 style='float:right'></img>
74+
The space where whole-numbered coordinates correspond to pixels on a screen,
75+
falling into a range of either...
5176

52-
<img src="/favicon-32x32.png" width=32></img>
53-
The global coordinate system, as seen by a camera, with *no* projection applied.
77+
1. `[(0,0), (WIDTH-1,HEIGHT-1)]`
78+
2. `[(1,1), (WIDTH,HEIGHT)]`
5479

5580
## References
5681

5782
- [Wikipedia](https://en.wikipedia.org/wiki/Coordinate_system)
58-
- [Learn OpenGL](https://learnopengl.com/Getting-started/Coordinate-Systems)
59-
- [Freya Holmér's Cheat Sheet](https://twitter.com/FreyaHolmer/status/1325556229410861056)
83+
- [Learn OpenGL: Coordinate Systems](https://learnopengl.com/Getting-started/Coordinate-Systems)
84+
- [Freya Holmérs Cheat Sheet](https://twitter.com/FreyaHolmer/status/1325556229410861056)
6085
- [WebGPU Specification](https://gpuweb.github.io/gpuweb/#coordinate-systems)
86+
- [Setting Up a Proper Projection Matrix for Vulkan ](https://johannesugb.github.io/gpu-programming/setting-up-a-proper-vulkan-projection-matrix/)
87+
- [Homogeneous Coordinates, Clip Space, and NDC | WebGPU](https://carmencincotti.com/2022-05-02/homogeneous-coordinates-clip-space-ndc/)
88+
- [Why is clip space always referred to as "homogeneous clip space"?](https://gamedev.stackexchange.com/questions/65789/why-is-clip-space-always-referred-to-as-homogeneous-clip-space)
89+
- [Explaining Homogeneous Coordinates & Projective Geometry](https://www.tomdalling.com/blog/modern-opengl/explaining-homogenous-coordinates-and-projective-geometry/)
90+
- [When does the transition from clip space to screen coordinates happen?](https://stackoverflow.com/questions/21841598/when-does-the-transition-from-clip-space-to-screen-coordinates-happen/21841924#21841924)
91+
- [Scratchapixel: The Perspective and Orthographic Projection Matrix](https://www.scratchapixel.com/lessons/3d-basic-rendering/perspective-and-orthographic-projection-matrix/projection-matrix-GPU-rendering-pipeline-clipping.html)
92+
- [OpenGL Projection Matrix](http://www.songho.ca/opengl/gl_projectionmatrix.html)
93+
- [Lecture 05: Spatial Transformations (CMU 15-462/662)](https://www.youtube.com/watch?v=QmFBHSJS0Gw&list=PL9_jI1bdZmz2emSh0UQ5iOdT2xRHFHL7E&index=7)
94+
- [WebGPU: Point Rasterization](https://www.w3.org/TR/webgpu/#point-rasterization)
95+
- [OpenGL `ARB_clip_control`](https://registry.khronos.org/OpenGL/extensions/ARB/ARB_clip_control.txt)

0 commit comments

Comments
 (0)