How to do 3D to camera ray, and get the pixel
-
- Goblin
- Posts: 272
- Joined: Thu Jun 10, 2004 4:19 am
- x 26
How to do 3D to camera ray, and get the pixel
I know the camera has a method to get the 3D point from the pixel, but how do I do the reverse?
- spacegaier
- OGRE Team Member
- Posts: 4304
- Joined: Mon Feb 04, 2008 2:02 pm
- Location: Germany
- x 135
- Contact:
Re: How to do 3D to camera ray, and get the pixel
What exactly are you trying to achieve? It's not very clear to me.
Ogre Admin [Admin, Dev, PR, Finance, Wiki, etc.] | BasicOgreFramework | AdvancedOgreFramework
Don't know what to do in your spare time? Help the Ogre wiki grow! Or squash a bug...
Don't know what to do in your spare time? Help the Ogre wiki grow! Or squash a bug...
-
- Goblin
- Posts: 272
- Joined: Thu Jun 10, 2004 4:19 am
- x 26
Re: How to do 3D to camera ray, and get the pixel
I want to take a point in the 3d space, and I assume create a ray, and end up getting a pixel coordinate. So for instance i can make a chat bubble or menu or something.
- Daixiwen
- Greenskin
- Posts: 105
- Joined: Fri Feb 08, 2013 11:30 am
- Location: Oslo
- x 16
Re: How to do 3D to camera ray, and get the pixel
In that case you don't need a ray, you just need to project your 3D point to 2D. You can for example do that by applying the projection matrix to the coordinates. You'll also probably need to offset the result and multiply by the viewport size to get coordinates.
Hardware, n.: part of the computer you can kick