You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: tutorials/camera.md
+13-10Lines changed: 13 additions & 10 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,11 +1,14 @@
1
-
## Introduction
1
+
## Introduction <aid=Introduction></a>
2
2
3
3
This tip describes projection and view transforms commonly used in 3D graphics,
4
4
especially when using my [HTML 3D Library](http://peteroupc.github.io/html3dutil).
5
5
6
6
**Download the latest version of the library at the [HTML 3D Library's Releases page](https://github.com/peteroupc/html3dutil/releases).**
7
+
## Contents <aid=Contents></a>
7
8
8
-
## The "Camera" and the Projection and View Transforms
9
+
[Introduction](#Introduction)<br>[Contents](#Contents)<br>[The "Camera" and the Projection and View Transforms](#The_Camera_and_the_Projection_and_View_Transforms)<br> [Overview of Transformations](#Overview_of_Transformations)<br>[Projection Transform](#Projection_Transform)<br> [Perspective Projection](#Perspective_Projection)<br> [Demo](#Demo)<br> [Orthographic Projection](#Orthographic_Projection)<br> [Other Projections](#Other_Projections)<br>[View Transform](#View_Transform)<br>[Other Pages](#Other_Pages)<br>
10
+
11
+
## The "Camera" and the Projection and View Transforms <aid=The_Camera_and_the_Projection_and_View_Transforms></a>
9
12
10
13
The [`Scene3D`](http://peteroupc.github.io/html3dutil/glutil.Scene3D.html) class of the HTML 3D Library has a concept of a "projection transform" and a "view transform". If we use the concept of a "camera", the projection is like setting the camera's focus and lens, and the view transform is like setting its position and orientation. `Scene3D` has methods for setting all these attributes of this abstract "camera". Two of them are [`setPerspective()`](http://peteroupc.github.io/html3dutil/glutil.Scene3D.html#.setPerspective) and [`setLookAt()`](http://peteroupc.github.io/html3dutil/glutil.Scene3D.html#.setLookAt), which are shown in the example below.
11
14
@@ -18,7 +21,7 @@ The [`Scene3D`](http://peteroupc.github.io/html3dutil/glutil.Scene3D.html) class
18
21
// points at (0, 2, 0), that is, up 2 units.
19
22
scene.setLookAt([0,0,30], [0,2,0]);
20
23
21
-
### Overview of Transformations
24
+
### Overview of Transformations <aid=Overview_of_Transformations></a>
22
25
23
26
Here is an overview of transformations used in the graphics system and
24
27
the HTML 3D library.
@@ -32,14 +35,14 @@ is not discussed in this page.
32
35
clip space coordinates to _normalized device coordinates_, then _screen space_
An orthographic projection is one in which the left and right clipping planes are parallel to each other,
107
110
and the top and bottom clipping planes are parallel to each other. This results in the near and far clipping
@@ -132,7 +135,7 @@ or squished in case the view volume's aspect ratio and the scene's aspect ratio
132
135
*`aspect` - Aspect ratio of the viewport. May be omitted, in which case the scene's
133
136
aspect ratio (`scene.getClientAspect()`) is used.
134
137
135
-
### Other Projections
138
+
### Other Projections <aid=Other_Projections></a>
136
139
137
140
There are other kinds of possible projections, such as oblique projections
138
141
or isometric projections. For these
@@ -146,7 +149,7 @@ This method allows you to set the projection matrix to an arbitrary [4x4 matrix]
146
149
147
150
*`matrix` - The 4x4 matrix to use.
148
151
149
-
## View Transform
152
+
## View Transform <aid=View_Transform></a>
150
153
151
154
The view matrix transforms _world space_ coordinates, shared by every object in a scene, to _camera space_
152
155
coordinates, in which the camera is located at the center of the coordinate system: (0, 0, 0). A view matrix essentially rotates the camera and moves it to a given position in world space. Specifically:
@@ -178,7 +181,7 @@ This method allows you to set the view matrix to an arbitrary [4x4 matrix]{@tuto
178
181
179
182
*`matrix` - The 4x4 matrix to use.
180
183
181
-
## Other Pages
184
+
## Other Pages <aid=Other_Pages></a>
182
185
183
186
The following pages of mine on CodeProject also discuss this library:
0 commit comments