I\'m trying to reconstruct 3D world coordinates from depth values in my deferred renderer, but I\'m having a heck of a time. Most of the examples I find online assume a standard
Your general approach is correct, you just did not invert the window space transform correctly. Window space z (which you probably wtrot into your depth texture) is [0,1] (by default, more general would be glDepthRange()), but NDC space z is [-1,1]. So you could change that line analogous to your x and y mappings to
clipSpaceLocation.z = texture(depthSampler, texcoord).r * 2.0 - 1.0;