Convert World Space to Camera Space

   10179   5   1
User Avatar
Member
96 posts
Joined: May 2008
Offline
Hi,

I'm trying to figure out how to convert a point in space into camera space. Let's say I have a sphere at 100,50,-10 and it's in the center left of my camera view. The camera has a resolution of e.g. 800x600. Basically what I want t0 convert is a Vector3(100,50,-10) to a Vector2(200,300) (the xy coordinates relative to the camera's resolution).

I've read the Matrix of the object through the worldTransform() function, but then what? There are some space conversion functions in VOPs apparently, but I have to admit that is not familiar territory… any hints or examples would be much appreciated.

Cheers
Michael
User Avatar
Member
8833 posts
Joined: July 2007
Online
the toNDC VOP will do just what you need
just provide camera path and point position in world space and it will return relative position in the screen space 0-1
so just multiply it with (800,600,0) vector and you have your result
Tomas Slancik
FX Supervisor
Method Studios, NY
User Avatar
Member
96 posts
Joined: May 2008
Offline
Perfect, that works like a charm! Thanks Tomas!
User Avatar
Member
3 posts
Joined: July 2017
Offline
Hi ripclaw and tamte,

I ventured into this from google search. I am trying to do the same thing with one slight difference. I have got a sphere which I want to place it at the corner of my camera view.

How shoud I do it? Could you please help me?

Thanks.
User Avatar
Member
6 posts
Joined: June 2015
Offline
tumurtogtokh
Hi ripclaw and tamte,

I ventured into this from google search. I am trying to do the same thing with one slight difference. I have got a sphere which I want to place it at the corner of my camera view.

How shoud I do it? Could you please help me?

Thanks.


https://www.youtube.com/watch?v=7UuVhbTRcew [www.youtube.com]
~31.30
User Avatar
Member
3 posts
Joined: July 2017
Offline
pietas
tumurtogtokh
Hi ripclaw and tamte,

I ventured into this from google search. I am trying to do the same thing with one slight difference. I have got a sphere which I want to place it at the corner of my camera view.

How shoud I do it? Could you please help me?

Thanks.


https://www.youtube.com/watch?v=7UuVhbTRcew [www.youtube.com]
~31.30

That is it! Thank you mate
  • Quick Links