   Shadowmapping render order
  HiI am battling against a non functional shadow mapping routine! I havent even got as far as the shadow, I'm still trying to get the render target to work!I think I am a bit confused about the order of things.Is this right?g_device->BeginScene();g_device->GetRenderTarget( 0, &m_backBuffer );  // save the back bufferg_device->GetDepthStencilSurface( &m_zBuffer );  // save the depth bufferg_device->SetRenderTarget(0, m_shadowSurface );  // switch to shadow render targetg_device->SetDepthStencilSurface( m_shadowZBuffer ); // switch to shadow depth buffer// clear the rendertarget ( the shadow map render target )g_device->Clear(0, NULL, D3DCLEAR_TARGET | D3DCLEAR_ZBUFFER, 0xFFFFFFFF, 1.0f, 0);// Set the techniqueg_shadowEffect->SetTechnique( "techShadow" );  // from softshadows article on gamedev.netg_shadowEffect->SetMatrix( "g_matLightViewProj", &m_lightViewProjMatrix );// Render the effectUINT uPasses = 0;g_shadowEffect->Begin( &uPasses, 0 );g_shadowEffect->BeginPass( 0 );//RENDER OBJECTS using g_shadowEffectg_shadowEffect->EndPass();// End the effectg_shadowEffect->End();g_device->SetRenderTarget(0, m_backBuffer );  // switch backg_device->SetDepthStencilSurface( m_zBuffer );g_device->SetTransform( D3DTS_VIEW, &m_normalViewMatrix );// clear the back bufferg_device->Clear(0, NULL, D3DCLEAR_TARGET | D3DCLEAR_ZBUFFER | D3DCLEAR_STENCIL, D3DCOLOR_ARGB(255, 255, 255, 255), 1.0f, 0);g_simulation->Render();  // render the objects properlyg_guiManager->Render();  // render the GUIg_device->EndScene();g_device->Present( NULL, NULL, NULL, NULL );Is this right, only having a single beginscene/endscene/present, even tho one half is to the shadowmap rendertarget and the other to the back buffer?My shadow map remains plain white.... nothing is being rendered to it!Thanks for you adviceSimon   