-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathCONVENTIONS
94 lines (76 loc) · 2.47 KB
/
CONVENTIONS
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
--------------------------------------------------------------------------------
Coordinate systems
--------------------------------------------------------------------------------
Tmp3D uses column-vectors.
┌ ┐
| x.x y.x z.x t.x |
| x.y y.y z.y t.y |
| x.z y.z z.z t.z |
| x.w y.w z.w t.w |
└ ┘
A right-handed coordinate system is used, and the untransformed camera is
situated at the origin <0, 0, 0>, looking towards +z.
_ +z
/|
/
/
<0, 0, 0> -----> +x
|
|
|
\|/
+y
The projection plane has its center at <0, 0, zNear>, where `zNear' is
determined by the vertical FOV (`fovy'), where:
screenHeight
zNear = -------------------
2 * tan(fovy / 2)
+z
_______
| |
|__/____|
/
<0, 0, 0> ----> +x
|
|
|
\|/
+y
The camera has six degrees of freedom and its rotations use Rodrigues'
Axis-angle representation. The yaw is always followed by the pitch. The positive
rotations follow the right-hand rule as well: they are clockwise when looking
towards the positive direction of that particular axis.
The screen-space origin is at <0, 0> and the +y points downwards.
<0, 0>-------------> +x
| |
| |
|___________|
|
\|/
+y
The triangles facing the camera have counter-clockwise winding.
/\
/ \
/ \
/ \
/ ↺ \
/ \
/____________\
--------------------------------------------------------------------------------
Renderer
--------------------------------------------------------------------------------
The renderer has no sub-pixel accuracy, the screen coordinates are strictly
integers.
The triangle rasterization routines follow the "top-left" coverage rule (as seen
in OpenGL and D3D):
Every pixel that falls inside the triangle is drawn--A pixel is assumed to be
inside the triangle if it satisfies the top-left rule:
- A pixel is considered to lie inside the triangle if its center lies completely
inside the triangle, without touching any of the edges except for the "top"
and the "left" edges.
- A top edge is above all of the other edges and is perfectly horizontal.
- A left edge is any edge that is not perfectly horizontal and is on the left of
the triangle. At most two edges in a triangle can be identified as a left
edge.
The top-left rule guarantees that pixels that are shared by two adjacent
triangles are drawn exactly once.