Screen VS Viewport What is the difference

In unity3d, what is the “Screen”, “Viewport”? “Screen” image is not on the “Viewport” is a Camera on it?
Learn unity3d friends, to explain, in unity3d in, “Screen”, “Viewport”, respectively, what is meant by the concept?
“Screen Point”, “Viewport Point”, “World Point”, What is the difference? Camera.ViewportToScreenPoint (), Camera.WorldToScreenPoint () What is the difference (in my opinion is the same, all the points in 3D space projected on the Screen, oh no difference?)

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.

Screen point is defined in pixels. The bottom-left of the screen is (0,0); bottom-right of the screen is (Screen.width,0), left-top is (0, Screen.height) and the right-top is (Screen.width,Screen.height).

A viewport space point is normalized and relative to the Camera. The points on the screen range between 0 and 1. You can determine the the x-coordinate by dividing the screenPoint.x by Screen.width and the y-coordinate by dividing the screenPoint.y by Screen.height.

For more information, check out the link