The Camera Matrix

Let's say, for a moment, that we do have a camera in WebGL. A camera should be able to rotate and translate to explore this 3D world. As we saw in the previous section, a 4x4 matrix can encode rotations and translations. Therefore, you should use one such matrix to represent our hypothetical camera.

Let's assume that our camera is located at the origin of the world and that it's oriented so that it's looking toward the negative z-axis direction. This is a good starting point; we already know what transformation represents such a configuration in WebGL (Identity matrix of rank four).

For the sake of analysis, let's break the problem down into two subproblems: camera-translation and camera-rotation. We will have a practical demo for each one.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.14.132.214