I’ll take your word for it that that gives you EYE-SPACE (sometimes called view space or camera space); haven’t checked your math. The PositonFromDepth_DarkPhoton() function listed in this post definitely does (for a perspective projection).
From there, getting back to WORLD-SPACE is simple. Since VIEWING transform is the WORLD-to-EYE space transform, invert that to get a transform that’ll take you from EYE-to-WORLD space transform.
I took a closer look at your function PositonFromDepth_DarkPhoton(). It seems that You do not apply a transposed inverse projection matrix. Isn’t this neccessary? Instead you’re using right/left/bottom/top variables. What are they?
I think you mean inverse projection matrix. Inverse transpose would be for transforming normals.
No it’s not necessary. Think about the classic application of matrix math to linear algebra. Consider what you use the inverse matrix for. Now consider that if you know the forms of the equation (i.e. you know the equations you’re solving) you can analytically solve for the solution without resorting to inverse matrix computation in terms of the input parameters for the projection. Which brings us to…
For the meaning of left/right/bottom/top, see the glFrustum() man page. Yes, this solution is specifically formulated for a perspective projection.