   Creating Environment Map
  Hey guys,I have a problem with creating my environment map below is my code.CreateCubeTextureMethodD3DXVECTOR3 oldUp = camera.GetUp();D3DXVECTOR3 oldPosition = *camera.GetPosition();D3DXVECTOR3 oldLookAt = camera.GetLookAt();float FOV = camera.GetFOV();IDirect3DCubeTexture9* envMap;D3DDISPLAYMODE mode;device->GetDisplayMode(0, &mode);LOGHRESULT("CreateCubeTexture: ",device->CreateCubeTexture(256, 0, D3DUSAGE_RENDERTARGET, mode.Format,  D3DPOOL_DEFAULT, &envMap, NULL));D3DXVECTOR3 position = D3DXVECTOR3(x,y,z);for(DWORD i=0; i<6; i++)    {   D3DXVECTOR3 eyePos = position;   D3DXVECTOR3 lookAt, up;IDirect3DSurface9* renderSurface;envMap->GetCubeMapSurface((D3DCUBEMAP_FACES) i, 0, &renderSurface);   switch(i)   {  case D3DCUBEMAP_FACE_POSITIVE_X: lookAt = D3DXVECTOR3(1.0f, 0.0f, 0.0f); up    = D3DXVECTOR3(0.0f, 1.0f, 0.0f); break;  case D3DCUBEMAP_FACE_NEGATIVE_X: lookAt = D3DXVECTOR3(-1.0f, 0.0f, 0.0f); up    = D3DXVECTOR3( 0.0f, 1.0f, 0.0f); break;  case D3DCUBEMAP_FACE_POSITIVE_Y: lookAt = D3DXVECTOR3(0.0f, 1.0f, 0.0f); up    = D3DXVECTOR3(0.0f, 0.0f,-1.0f); break;  case D3DCUBEMAP_FACE_NEGATIVE_Y: lookAt = D3DXVECTOR3(0.0f,-1.0f, 0.0f); up    = D3DXVECTOR3(0.0f, 0.0f, 1.0f); break;  case D3DCUBEMAP_FACE_POSITIVE_Z: lookAt = D3DXVECTOR3( 0.0f, 0.0f, 1.0f); up    = D3DXVECTOR3( 0.0f, 1.0f, 0.0f); break;  case D3DCUBEMAP_FACE_NEGATIVE_Z: lookAt = D3DXVECTOR3(0.0f, 0.0f,-1.0f); up    = D3DXVECTOR3(0.0f, 1.0f, 0.0f); break;}lookAt = position + lookAt;camera.SetPosition(position.x, position.y, position.z);camera.SetLookAt(lookAt.x, lookAt.y, lookAt.z);camera.SetUp(up.x, up.y, up.z);matViewProjection = camera.GetMatView() * camera.GetMatProj();D3DXMatrixInverse(&matInvViewProjection, NULL, &matViewProjection);Render(device, renderSurface, false);RELEASE(renderSurface);}camera.SetFOV(FOV);camera.SetPosition(oldPosition.x, oldPosition.y, oldPosition.z);camera.SetLookAt(oldLookAt.x, oldLookAt.y, oldLookAt.z);camera.SetUp(oldUp.x, oldUp.y, oldUp.z);return skyTexture;Render Methodif(renderTarget == NULL)renderTarget = backBufferSurface;device->SetRenderTarget(0, renderTarget);ClearRenderTargets(device);RenderAttributes(device);CalculateLights(device);// Log To Screen//==============================std::stringstream str;std::string cameraPos;str << "X= " << camera.GetPosition()->x << " Y= " << camera.GetPosition()->y << " Z= " << camera.GetPosition()->z;cameraPos = str.str();//engine->WriteTextToScreen(cameraPos.c_str(), 450, 50);//==============================device->Clear(0, NULL, D3DCLEAR_TARGET, 0xffffff, 1.0f, 0);device->BeginScene();UINT numPasses;if(SUCCEEDED(effects[eDISPLAY]->Begin(&numPasses, NULL))){for(UINT i = 0; i < numPasses; i++){effects[eDISPLAY]->BeginPass(i);quad.Render(device);effects[eDISPLAY]->EndPass();}effects[eDISPLAY]->End();}device->EndScene();if(renderToScreen)device->Present(NULL, NULL, NULL, NULL);device->SetRenderTarget(0,backBufferSurface);I know the render method works but the cube texture returned from the cube texture method will not work and any reflective object which uses it is just rendered black as though the texture does not exist. My reflection shader works as I have tried it by passing a env map from a file and it worked. When I set the cube texture within my shader to the result of the createCubeTexture method the reflective object is black as though the texture was not set. Any ideas would be greatly appreciated.   
  Do a frame capture with PIX - this will let you inspect the state of the render targets of each face after each draw call.  Then you can see if the problem is with rendering to the faces, or if it is something wrong with how you are setting the texture (you can check this too in the frame capture).   ;  Hi,Changing env. map camera parameters during rendering to cubemap faces is a wrong way. Don't change lookAt and Up vectors and also cam. pos. must be (0, 0, 0). If you want to get dynamic reflections, you need to change the position of objects to be rendered.You can look at Here.Hope this helps.Regards,Rohat.   