I've read several resources on creating shadow maps using the z-buffer, but in every single one of them, I run into a wall. I understand all of the steps they explain except for one.
Ok, first I'm supposed to render the scene from the light's perspective without any textures (so as to save on fillrate), masking out colours and therefore only writing to the depth buffer. Next I'm supposed to render the scene from the camera's perspective and compare the position of each fragment to it's position in the depth map in order to determine if the fragment is in shadow or not. The problem is that the fragment's position has to be transformed to the light's perspective. How the heck am I supposed to do this?
Ok, first I'm supposed to render the scene from the light's perspective without any textures (so as to save on fillrate), masking out colours and therefore only writing to the depth buffer. Next I'm supposed to render the scene from the camera's perspective and compare the position of each fragment to it's position in the depth map in order to determine if the fragment is in shadow or not. The problem is that the fragment's position has to be transformed to the light's perspective. How the heck am I supposed to do this?