How unprojectPoint works?
Posted: Tue Aug 03, 2010 08:22
Hey guys
I'm trying to implement the render of CEGUI with an engine called RenderWare these days. When I worked on the virtual class "rendertarget", I can hardly understand the implementation of Direct3dRenderTarget::unprojectPoint.
In that, the method uses the screen coordinate to be unprojected into a 3D coordinate system and constructs an ray with the centre screen coordinate which is unprojected into a 3D coordinate system as well. Then it projects three points (0,0,0)(0,1,0)(1,0,0) into screen coordinate system, and contructs a plane with that three points( in screen coordinate system strangly ). In the end, the method finds the point where the ray intersects the plane and outputs the point.
So strange! The ray is under 3D coordinate system but the plane is just projected into screen coorinate system. How they can work together?
I'm trying to implement the render of CEGUI with an engine called RenderWare these days. When I worked on the virtual class "rendertarget", I can hardly understand the implementation of Direct3dRenderTarget::unprojectPoint.
In that, the method uses the screen coordinate to be unprojected into a 3D coordinate system and constructs an ray with the centre screen coordinate which is unprojected into a 3D coordinate system as well. Then it projects three points (0,0,0)(0,1,0)(1,0,0) into screen coordinate system, and contructs a plane with that three points( in screen coordinate system strangly ). In the end, the method finds the point where the ray intersects the plane and outputs the point.
So strange! The ray is under 3D coordinate system but the plane is just projected into screen coorinate system. How they can work together?