   Shadow maps in a software renderer
  I am currently having problems getting shadow maps working correctly in my software renderer. Below is the steps I am currently doing to sample the depth map.1. Render g buffer from view space2. render a depth buffer from light view3. invert the view matrix and multiply with the light view matrix  (view matrix is not scaled, to invert I am transpose the corner 3x3 matrix and negating the transform xyz)4. for every pixel the light touches  a. reconstruct the position from depth and window.xy  b. multiply the position by inverseView & lightview matrix (from step 3)  c. perspective transform this position   d. test against the depth stored in the light view depth bufferDoes this look correct?The depth buffer looks correct, and the position reconstruction is working for calculating relative light direction and light falloff.   
  The problem I am having is not being rendered at the correct position, it moves in relation to the view camera. I have added a screenshot[attachment=2033:shadow_problem.png]   