Mr. Latte


Lesson 4 of 10

See Through Camera Coordinates

A chair’s screen position depends on where it sits in a room and where you view it from. Coordinates need a reference frame to be meaningful.

Three spaces

With column vectors, write p_view = V M p_model. M places the object in the world; V expresses the scene relative to the camera.

Move the camera right

Suppose an unrotated camera moves to x=3. A world point at x=5 now lies at camera-relative x=2.

world_point = (5, 1, 4)
camera_position = (3, 0, 0)
view_point = tuple(p - c for p, c in zip(world_point, camera_position))
print(view_point)

The result is (2, 1, 4). Moving the camera right shifts the scene the opposite way in its view, which is why we subtract the camera position.

A rotated camera also requires undoing its rotation. The view transform is the inverse of the transform placing the camera in the world.

Check your understanding

If camera and object move the same distance in the same direction, does their relative position change?

Show explanation

Not if rotation and other conditions remain unchanged. Their position difference stays the same. When an object disappears, first check where it lies relative to the camera.

Looking for a product partner? Founders, teams, businesses: from problem framing to launch.