Original Post
I recently started adding shadow maps to my engine and have finally managed to get a decent sample running. Of course, once a new algorithm is implemented, it is just natural to try to improve what you have done. So I was reading in 'Programming Vertex and Pixel Shaders' by Wolfgang Engel, and he suggests linearizing the depth values in the shadow map by applying the following change to the homogenous projection space z value (this is described on p.293 for those with the book): Zout = (Zin + near)/(far - near) This would be intended to add a smooth distribution of depth values across the depth map range. I tried this and had absolutely no luck at all. The shadow map came out looking like I had not rendered anything at all into it. Does anyone know of a similar technique for linearizing the depth or perhaps a correction to his algorithm? Thanks in advance for any help!