   FOV and placing
  Hello,I want to create a FOV where I will accurately be able to place objects in it using a 45 degree angle. Such object could be primitives such as spheres. I tried to create it but I am having trouble with the z dimension as I cannot accurately calculate how to place the object in different z.   
  I'm not sure if the question is clear - could you describe in a little more detail what it is that you're trying to do?   ;  I am creating 3D space where I can place modeled objects or primitives and I want to choose one pixel and that will be the center of my object. I want to create a fov that allows that accuracy.   ;  You mean you're writing some sort of 3D editor, and you want users to be able to pick a single spot in the 3D world to place an object, all from one view angle? If I understand your question, it's not possible. You need to specify three dimensions, and a mouseclick on a screen can only place two. Fundamentally, it's that simple.I don't know about other 3d modeling programs, but the way Blender 3D does this is to have a 3D cursor always in the scene. You can move it around by clicking from different views, and it can be snapped to the grid, other objects, etc., so you can place it exactly where you want. Then new objects are always created at the location of the cursor.   ;  what if I have a predefined z and the user uses the clicks to choose a position.Lets say: z = 10 _________|.............||...x.........||.............||________|that chosen pixel will be the center of a sphere lets sayif the z changes to 20 to be deeper in the 3D world thenI want the same pixel to be the center of the sphere.When I created my fov for a particular z I could place my objectsproperly but if I went deeper or closer to the screen the positioning would get messed up   ;  If you fix the Z coordinate of the picked point, the FOV becomes pretty much irrelevant -- in that there is no selection of a particular FOV and resulting projection matrix computation that is more correct than any other. All (non-degenerate) choices of a field-of-view angle will allow you to transform any picked 2D pixel coordinate into a ray in world space, at point you can intersect that ray with the plane defined by your fixed Z coordinate to determine the coordinates of the picked world-space location. Use this location as the center of the object you place in world space.As long as you are not constantly changing your FOV angle during this whole process, this will result in the center of the placed object to align with the pixel selected by the mouse when rasterized.   ;Quote: You mean you're writing some sort of 3D editor, and you want users to be able to pick a single spot in the 3D world to place an object, all from one view angle? If I understand your question, it's not possible. You need to specify three dimensions, and a mouseclick on a screen can only place two. Fundamentally, it's that simple.Maybe I didn't understood you, but why did I beat to make an Editor where you click at some point, and a mesh gets placed in the world right where you clicked?void DX10Scene::GetMouse3DPos(D3DXVECTOR3* OutLoc,D3DXVECTOR3* OutDir){D3DXVECTOR3 vPickRayDir;D3DXVECTOR3 vPickRayOrig;const DXGI_SURFACE_DESC* pd3dsdBackBuffer = DXUTGetDXGIBackBufferSurfaceDesc();const D3DXMATRIX* pmatProj = &Projection;//Get the cursor 2D positionPOINT ptCursor;GetCursorPos( &ptCursor );ScreenToClient( DXUTGetHWND(), &ptCursor );// Compute the vector of the Mouse in screen spaceD3DXVECTOR3 v;v.x = ( ( ( 2.0f * (ptCursor.x ) ) / pd3dsdBackBuffer->Width ) - 1 ) / pmatProj->_11;v.y = -( ( ( 2.0f * (ptCursor.y ) ) / pd3dsdBackBuffer->Height ) - 1 ) / pmatProj->_22;v.z = 1.0f;// Get the inverse view matrixD3DXMATRIXA16 m;D3DXMatrixInverse( &m, NULL, &View );// Transform the screen space Mouse pos into 3D spacevPickRayDir.x  = v.x*m._11 + v.y*m._21 + v.z*m._31;vPickRayDir.y  = v.x*m._12 + v.y*m._22 + v.z*m._32;vPickRayDir.z  = v.x*m._13 + v.y*m._23 + v.z*m._33;vPickRayOrig.x = m._41;vPickRayOrig.y = m._42;vPickRayOrig.z = m._43;D3DXVec3Normalize(&vPickRayDir,&vPickRayDir);//And finally output them*OutLoc=vPickRayOrig;*OutDir=vPickRayDir;}And when you have the 3D world coords of the mouse, just cast a ray from there through all meshes and/or a ground plane. Then, get the hit location and spawn your mesh there. And this technique is nearly pixel perfect! :)If I totally misunderstood what you wanted, please be sorry :)   ;  OK I'll give an example:D3DXVECTOR3 camPos(0.0f, 0.0f, -10.0f);void CreateFOV(int x, int y){float fovW = (rotation)*PI/180;float fovH = (float)HEIGHT / (float)WIDTH * fovW;float tanFovW = tan(fovW);float tanFovH = tan(fovH);float xz = ( (zoom * (float)x)) / (float)WIDTH *tanFovW;float yz = ( (zoom * (float)y)) / (float)HEIGHT *tanFovH;D3DXVECTOR3 cameraDirection = D3DXVECTOR3(xz- camPos.x, yz-camPos.y, -camPos.z);}void AddObject(int x, int y){GeometricObject* s = NULL;float xz = ((zoom * (float)x)) / (float)WIDTH*tanFovW ;float yz = ((zoom * (float)y)) / (float)HEIGHT*tanFovH ;s = new Sphere();s->position = D3DXVECTOR3(xz, yz, depth);}I wrote this from memory but I think its correct.How will positioning xz and yz be correct every time regardless of depth?   ;  bump   ;  Just call the function I posted above. This will transform you Mouse cursor position into 3D WorldSpace. And it also uses the FOV.   