What is the relationship between screenspace, viewport, world, and window positions? What is their relationship to DPI?

Can’t seem to find how the four coordinates relate to one another.
Have had problems that’s solve by multiply a coordinate by the dpi and but still is a bit confused

For example, I want to check if an actor is in a selection box created from two points from Start mouse position and end mouse position

I deproject actors world position to screenspace. Now I need to figure out how to convert screenspace to mouse position which isn’t in screenspace… Or vice versa

World coordinates are the coordinates of actors in your level, as seen in their details panel.

In other engines viewport coordinates are -1 to 1 relative coordinates, while the screen coordinates are the window resolution, with top left being (0,0), and bottom right corner is the window resolution.
I haven’t actually seen anything use relative viewport coordinates so far, but I’m new to Unreal, it’s all window coordinates as far as I can tell.
Printing out the touch input event on a pawn, for example, I get window coordinates.

Not sure how DPI affects anything.
Presumably acts as a multiplier to window coordinates, for widgets.
Though I can’t get window coordinates in widgets, so I have no idea.

Screenspace… I hate this so much, and this is how I found this question.
Screen space is the desktop’s screen coordinates.
This means: top left of your main monitor is (0, 0), everything else is relative to that.
So a monitor set to the left of your main display will have negative X coordinates.
A monitor set up to the right of your main monitor will have X coordinates that start at the resolution of your main display, instead of 0.

There doesn’t seem to be too many methods to translate one to another.
You can project screen to world, in a Pawn blueprint, but there’s nothing to do in Widgets to get viewport/window instead of the screenspace, which is both useless and infuriating.

If anyone knows how to translate from screenspace to viewport, in a widget class, that would great.

1 Like

Not sure, if this helps you. But if you want translate Screen Space (Desktop Space) to Viewport Space this worked out for me. The ScreenSpace gets converted to absolute widget space and if you multiply with the viewport scale it’s kind of viewport space.
These values for example work great with the Deproject Screen to World node to get 3D-Coordinates of a 2D pointer position…