Labs ICT
โญ Pro Login

Coordinate Systems

Screen, world, and normalized device coordinates

Coordinate Systems

Computer graphics relies on multiple coordinate systems to transform objects from their original definition to their final position on screen. Each system serves a specific purpose in the rendering pipeline.

World Coordinates

The global coordinate system where all objects are positioned relative to a common origin. This is where scene designers place objects, lights, and cameras.

World Space:
        Y
        ^
        |   / Z (depth)
        |  /
        | /
        +---------> X

Origin (0,0,0) is arbitrary
Units can be meters, feet, etc.

Screen Coordinates

The 2D coordinate system of the display. The origin is typically at the top-left corner with Y increasing downward (common in windowing systems).

Screen Space:
(0,0) -------------------------> X (width)
  |
  |
  |
  v
  Y (height)

Example: 1920x1080 display
  Top-left:     (0, 0)
  Top-right:    (1919, 0)
  Bottom-left:  (0, 1079)
  Bottom-right: (1919, 1079)

Normalized Device Coordinates (NDC)

A coordinate system where all values range from -1 to 1 (or 0 to 1). This allows graphics hardware to work independently of actual screen resolution.

NDC Space (-1 to 1):

(-1,1) --------------------- (1,1)
  |          |         |       |
  |          |    0    |       |
  |----------+---------+-------|  Y
  |          |         |       |
  |          |         |       |
(-1,-1) ------------------- (1,-1)
                X

Mapping screen to NDC:
  ndc_x = (2 * screen_x / width)  - 1
  ndc_y = 1 - (2 * screen_y / height)

Object/Local Coordinates

The coordinate system relative to an individual object. When modeling, vertices are defined relative to the object's own origin, making it easy to create and manipulate complex shapes.

Local to World Transform:
  [ x_world ]   [ sx  0   0   tx ] [ x_local ]
  [ y_world ] = [ 0   sy  0   ty ] [ y_local ]
  [ z_world ]   [ 0   0   sz  tz ] [ z_local ]
  [ 1       ]   [ 0   0   0   1  ] [ 1       ]

  Where: sx,sy,sz = scale, tx,ty,tz = translation

Camera/View Coordinates

The coordinate system from the camera's perspective. The camera is at the origin, looking down the negative Z-axis (or positive, depending on convention).

๐Ÿงช Quick Quiz

What does NDC stand for in computer graphics?