Public Group

# how to transform a point from space to the screen?

This topic is 4228 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

Hey,all~ there is a point (x, y, z) in the view frustrum space and i want to transform it to the screen space (X, Y) and show a UI Tip on (X, Y) so that when the point(x, y, z) moving in the space and the 2D Tip follow it moving in the screen space. How can i make it ? Thanks!

##### Share on other sites
You can map 3D coordinates to 2D by simply multiplying it with the world * view * projection matrix. This will give you (depending on your projection transformation) i.e. coordinates in the range -1 to +1, which can be simply transformed into pixel coordinates.

##### Share on other sites
Vector3.Project(...)

:)

ooop~

i'll have a try

thanks!

^_^

##### Share on other sites
Hey,there~

i tried to transform the point(50, 50, 100) to the screen space....

the ViewMatrix is:
1 0 0 0
0 1 -0.2 0
0 0.2 1 0
0 0 50 1

the ProjMatrix is:
2.78 0 0 0
0 3.71 0 0
0 0 1 1
0 0 -1 0

then i multiply them together:

point(50, 50, 100) * ViewMatrix * ProjMatrix...

the result is a larrrrrge number and my UI Tip is dispear...

i don't know where is it wrong :(

##### Share on other sites
the coordinates should be in the range -1 to +1 or 0 to +1 and easy to transformed into pixel coordinates....

1. 1
2. 2
Rutin
19
3. 3
4. 4
5. 5

• 14
• 13
• 9
• 12
• 9
• ### Forum Statistics

• Total Topics
631438
• Total Posts
3000073
×