Screen VS Viewport What is the difference

Screen and Viewport represent same area - on screen, but they have different coordinate systems (IIRC):

  • Screen: from [0,0] to [Screen.width, Screen.height]
  • Viewport: from [0,0] to [1,1]

World point is a point in world space.

I just fixed the Viewport coordinates. It’s [0,0] to [1,1] and not [-1,-1] to [1,1]. The latter are homogeneous device coordinates. This is the space where the GPU actually clips the geometry against the frustum. The result of the projection matrix outputs homogeneous coordinates.

A simplified version of the pipeline is:

local space   [-inf, -inf] to [+inf, +inf]
    \/                                     -- localToWorld (Model)
world space   [-inf, -inf] to [+inf, +inf]
    \/                                     -- worldToCamera (View)
camera space  [-inf, -inf] to [+inf, +inf]
    \/                                     -- projectionMatrix (Projection)
clip space    [  -1,   -1] to [   1,    1]
view space    [   0,    0] to [   1,    1] \
    \/                                      -- handled by GPU / driver
screen space  [   0,    0] to [   W,    H] /

In all cases [0,0] is the bottom left. This only handles normal geometry. The GUI space is a special case where the camera space has to invert the y axis, hence it starts at the top left.