Time for Action: Translations in World Space vs Camera Space

Let's cover an example showcasing these differences in action:

  1. Open ch04_01_model-view-translation.html in your browser:

  1. From a distance, we are looking at the positive z-axis of a cone located at the origin of the world. There are three sliders that allow you to translate either the world or the camera on the x, y, and z axes, respectively. The world space is activated by default.
  2. By looking at the World matrix on the screen, can you tell where the origin of the world is? Is it [0, 0, 0]?
Hint

Check where we define translations in the Model-View matrix.
  1. We can think of the canvas as the image that our camera sees. If the world's center is at [0, -2, -50], where is the camera?
  1. If we want to get closer to the cone, we need to move the center of the world toward the camera. We know that the camera is far on the positive z-axis of the world, so the translation will occur on the z-axis. Given that we are on world coordinates, do we need to increase or decrease the z-axis slider? Go ahead and test your answer.
  2. Switch to camera coordinates. What is the translation component of this matrix? What do you need to do if you want to move the camera closer to the cone? What does the final translation look like? What can you conclude?
  3. Try to move the camera on the x-axis and the y-axis. Check what the corresponding transformations would be on the Model-View matrix.

What just happened?

We saw that the camera translation is the inverse of the Model-View matrix translation. We also learned where to find translation information in a transformation matrix.

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

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